|
| 1 | +/****************************************************************************** |
| 2 | + * The MIT License |
| 3 | + * |
| 4 | + * Copyright (c) 2011 LeafLabs, LLC. |
| 5 | + * |
| 6 | + * Permission is hereby granted, free of charge, to any person |
| 7 | + * obtaining a copy of this software and associated documentation |
| 8 | + * files (the "Software"), to deal in the Software without |
| 9 | + * restriction, including without limitation the rights to use, copy, |
| 10 | + * modify, merge, publish, distribute, sublicense, and/or sell copies |
| 11 | + * of the Software, and to permit persons to whom the Software is |
| 12 | + * furnished to do so, subject to the following conditions: |
| 13 | + * |
| 14 | + * The above copyright notice and this permission notice shall be |
| 15 | + * included in all copies or substantial portions of the Software. |
| 16 | + * |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 18 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 19 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 20 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 21 | + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 22 | + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 23 | + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 24 | + * SOFTWARE. |
| 25 | + *****************************************************************************/ |
| 26 | + |
| 27 | +/** |
| 28 | + * &file wirish/boards/maple_mini/board.cpp |
| 29 | + * &author Marti Bolivar <mbolivar&leaflabs.com> |
| 30 | + * &brief Maple Mini board file. |
| 31 | + */ |
| 32 | + |
| 33 | +#include <board/board.h> |
| 34 | + |
| 35 | +#include <libmaple/gpio.h> |
| 36 | +#include <libmaple/timer.h> |
| 37 | + |
| 38 | +/* Roger Clark. Added next to includes for changes to Serial */ |
| 39 | +#include <libmaple/usart.h> |
| 40 | +#include <HardwareSerial.h> |
| 41 | + |
| 42 | +#include <wirish_debug.h> |
| 43 | +#include <wirish_types.h> |
| 44 | + |
| 45 | +/* Since we want the Serial Wire/JTAG pins as GPIOs, disable both SW |
| 46 | + * and JTAG debug support, unless configured otherwise. */ |
| 47 | +void boardInit(void) { |
| 48 | +#ifndef CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG |
| 49 | + disableDebugPorts(); |
| 50 | +#endif |
| 51 | +} |
| 52 | + |
| 53 | +// Note. See the enum of pin names in board.h |
| 54 | + |
| 55 | +extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = { |
| 56 | + |
| 57 | + |
| 58 | + {&gpioa, &timer2, &adc1, 0, 1, 0}, /* PA0 */ |
| 59 | + {&gpioa, &timer2, &adc1, 1, 2, 1}, /* PA1 */ |
| 60 | + {&gpioa, &timer2, &adc1, 2, 3, 2}, /* PA2 */ |
| 61 | + {&gpioa, &timer2, &adc1, 3, 4, 3}, /* PA3 */ |
| 62 | + {&gpioa, NULL, &adc1, 4, 0, 4}, /* PA4 */ |
| 63 | + {&gpioa, NULL, &adc1, 5, 0, 5}, /* PA5 */ |
| 64 | + {&gpioa, &timer3, &adc1, 6, 1, 6}, /* PA6 */ |
| 65 | + {&gpioa, &timer3, &adc1, 7, 2, 7}, /* PA7 */ |
| 66 | + {&gpioa, &timer1, NULL, 8, 1, ADCx}, /* PA8 */ |
| 67 | + {&gpioa, &timer1, NULL, 9, 2, ADCx}, /* PA9 */ |
| 68 | + {&gpioa, &timer1, NULL, 10, 3, ADCx}, /* PA10 */ |
| 69 | + {&gpioa, &timer1, NULL, 11, 4, ADCx}, /* PA11 */ |
| 70 | + {&gpioa, NULL, NULL, 12, 0, ADCx}, /* PA12 */ |
| 71 | + {&gpioa, NULL, NULL, 13, 0, ADCx}, /* PA13 */ |
| 72 | + {&gpioa, NULL, NULL, 14, 0, ADCx}, /* PA14 */ |
| 73 | + {&gpioa, NULL, NULL, 15, 0, ADCx}, /* PA15 */ |
| 74 | + |
| 75 | + {&gpiob, &timer3, &adc1, 0, 3, 8}, /* PB0 */ |
| 76 | + {&gpiob, &timer3, &adc1, 1, 4, 9}, /* PB1 */ |
| 77 | + {&gpiob, NULL, NULL, 2, 0, ADCx}, /* PB2 */ |
| 78 | + {&gpiob, NULL, NULL, 3, 0, ADCx}, /* PB3 */ |
| 79 | + {&gpiob, NULL, NULL, 4, 0, ADCx}, /* PB4 */ |
| 80 | + {&gpiob, NULL, NULL, 5, 0, ADCx}, /* PB5 */ |
| 81 | + {&gpiob, &timer4, NULL, 6, 1, ADCx}, /* PB6 */ |
| 82 | + {&gpiob, &timer4, NULL, 7, 2, ADCx}, /* PB7 */ |
| 83 | + {&gpiob, &timer4, NULL, 8, 3, ADCx}, /* PB8 */ |
| 84 | + {&gpiob, &timer4, NULL, 9, 4, ADCx}, /* PB9 */ |
| 85 | + {&gpiob, NULL, NULL, 10, 0, ADCx}, /* PB10 */ |
| 86 | + {&gpiob, NULL, NULL, 11, 0, ADCx}, /* PB11 */ |
| 87 | + {&gpiob, NULL, NULL, 12, 0, ADCx}, /* PB12 */ |
| 88 | + {&gpiob, NULL, NULL, 13, 0, ADCx}, /* PB13 */ |
| 89 | + {&gpiob, NULL, NULL, 14, 0, ADCx}, /* PB14 */ |
| 90 | + {&gpiob, NULL, NULL, 15, 0, ADCx}, /* PB15 */ |
| 91 | + |
| 92 | + {&gpioc, NULL, NULL, 13, 0, ADCx}, /* PC13 */ |
| 93 | + {&gpioc, NULL, NULL, 14, 0, ADCx}, /* PC14 */ |
| 94 | + {&gpioc, NULL, NULL, 15, 0, ADCx}, /* PC15 */ |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | +}; |
| 99 | + |
| 100 | +extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = { |
| 101 | + PB0, PA7, PA6, PA3, PA2, PA1, PA0, PB7, PB6, PA10, PA9, PA8 |
| 102 | +}; |
| 103 | + |
| 104 | +extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = { |
| 105 | + PB0, PA7, PA6 , PA5 , PA4 , PA3 , PA2 , PA1 , PA0 |
| 106 | +}; |
| 107 | + |
| 108 | +// Note. These defines are not really used by generic boards. They are for Maple Serial USB |
| 109 | +#define USB_DP PA12 |
| 110 | +#define USB_DM PA11 |
| 111 | + |
| 112 | +// NOte. These definitions are not really used for generic boards, they only relate to boards modified to behave like Maple boards |
| 113 | +extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = { |
| 114 | + USB_DP, USB_DM |
| 115 | +}; |
| 116 | + |
| 117 | + |
| 118 | +/* |
| 119 | + * Roger Clark |
| 120 | + * |
| 121 | + * 2015/05/28 |
| 122 | + * |
| 123 | + * Moved definitions for Hardware Serial devices from HardwareSerial.cpp so that each board can define which Arduino "Serial" instance |
| 124 | + * Maps to which hardware serial port on the microprocessor |
| 125 | + */ |
| 126 | + |
| 127 | +#ifdef SERIAL_USB |
| 128 | + DEFINE_HWSERIAL(Serial1, 1); |
| 129 | + |
| 130 | + DEFINE_HWSERIAL(Serial2, 2); |
| 131 | + |
| 132 | + DEFINE_HWSERIAL(Serial3, 3); |
| 133 | +#else |
| 134 | + DEFINE_HWSERIAL(Serial, 1); |
| 135 | + |
| 136 | + DEFINE_HWSERIAL(Serial1, 2); |
| 137 | + |
| 138 | + DEFINE_HWSERIAL(Serial2, 3); |
| 139 | +#endif |
0 commit comments