|
@@ -53,10 +53,9 @@
|
53
|
53
|
// function out, as we do here.
|
54
|
54
|
|
55
|
55
|
void boardInit(void) {
|
56
|
|
- // afio_remap(AFIO_REMAP_I2C1);
|
|
56
|
+ // afio_remap(AFIO_REMAP_I2C1);
|
57
|
57
|
}
|
58
|
58
|
|
59
|
|
-
|
60
|
59
|
// Pin map: this lets the basic I/O functions (digitalWrite(),
|
61
|
60
|
// analogRead(), pwmWrite()) translate from pin numbers to STM32
|
62
|
61
|
// peripherals.
|
|
@@ -72,86 +71,86 @@ void boardInit(void) {
|
72
|
71
|
// - ADC channel, or ADCx if none
|
73
|
72
|
|
74
|
73
|
extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
|
75
|
|
-/*
|
76
|
|
- gpio_dev *gpio_device; GPIO device
|
77
|
|
- timer_dev *timer_device; Pin's timer device, if any.
|
78
|
|
- const adc_dev *adc_device; ADC device, if any.
|
79
|
|
- uint8 gpio_bit; Pin's GPIO port bit.
|
80
|
|
- uint8 timer_channel; Timer channel, or 0 if none.
|
81
|
|
- uint8 adc_channel; Pin ADC channel, or ADCx if none.
|
82
|
|
-*/
|
83
|
|
-
|
84
|
|
- {&gpioa, &timer2, &adc1, 0, 1, 0}, /* PA0 */
|
85
|
|
- {&gpioa, &timer2, &adc1, 1, 2, 1}, /* PA1 */
|
86
|
|
- {&gpioa, &timer2, &adc1, 2, 3, 2}, /* PA2 */
|
87
|
|
- {&gpioa, &timer2, &adc1, 3, 4, 3}, /* PA3 */
|
88
|
|
- {&gpioa, NULL, &adc1, 4, 0, 4}, /* PA4 */
|
89
|
|
- {&gpioa, NULL, &adc1, 5, 0, 5}, /* PA5 */
|
90
|
|
- {&gpioa, &timer3, &adc1, 6, 1, 6}, /* PA6 */
|
91
|
|
- {&gpioa, &timer3, &adc1, 7, 2, 7}, /* PA7 */
|
92
|
|
- {&gpioa, &timer1, NULL, 8, 1, ADCx}, /* PA8 */
|
93
|
|
- {&gpioa, &timer1, NULL, 9, 2, ADCx}, /* PA9 */
|
94
|
|
- {&gpioa, &timer1, NULL, 10, 3, ADCx}, /* PA10 */
|
95
|
|
- {&gpioa, NULL, NULL, 11, 0, ADCx}, /* PA11 */
|
96
|
|
- {&gpioa, NULL, NULL, 12, 0, ADCx}, /* PA12 */
|
97
|
|
- {&gpioa, NULL, NULL, 13, 0, ADCx}, /* PA13 */
|
98
|
|
- {&gpioa, NULL, NULL, 14, 0, ADCx}, /* PA14 */
|
99
|
|
- {&gpioa, NULL, NULL, 15, 0, ADCx}, /* PA15 */
|
100
|
|
-
|
101
|
|
- {&gpiob, &timer3, &adc1, 0, 3, 8}, /* PB0 */
|
102
|
|
- {&gpiob, &timer3, &adc1, 1, 4, 9}, /* PB1 */
|
103
|
|
- {&gpiob, NULL, NULL, 2, 0, ADCx}, /* PB2 */
|
104
|
|
- {&gpiob, NULL, NULL, 3, 0, ADCx}, /* PB3 */
|
105
|
|
- {&gpiob, NULL, NULL, 4, 0, ADCx}, /* PB4 */
|
106
|
|
- {&gpiob, NULL, NULL, 5, 0, ADCx}, /* PB5 */
|
107
|
|
- {&gpiob, &timer4, NULL, 6, 1, ADCx}, /* PB6 */
|
108
|
|
- {&gpiob, &timer4, NULL, 7, 2, ADCx}, /* PB7 */
|
109
|
|
- {&gpiob, &timer4, NULL, 8, 3, ADCx}, /* PB8 */
|
110
|
|
- {&gpiob, NULL, NULL, 9, 0, ADCx}, /* PB9 */
|
111
|
|
- {&gpiob, NULL, NULL, 10, 0, ADCx}, /* PB10 */
|
112
|
|
- {&gpiob, NULL, NULL, 11, 0, ADCx}, /* PB11 */
|
113
|
|
- {&gpiob, NULL, NULL, 12, 0, ADCx}, /* PB12 */
|
114
|
|
- {&gpiob, NULL, NULL, 13, 0, ADCx}, /* PB13 */
|
115
|
|
- {&gpiob, NULL, NULL, 14, 0, ADCx}, /* PB14 */
|
116
|
|
- {&gpiob, NULL, NULL, 15, 0, ADCx}, /* PB15 */
|
117
|
|
-
|
118
|
|
-
|
119
|
|
- {&gpioc, NULL, &adc1, 0, 0, 10}, /* PC0 */
|
120
|
|
- {&gpioc, NULL, &adc1, 1, 0, 11}, /* PC1 */
|
121
|
|
- {&gpioc, NULL, &adc1, 2, 0, 12}, /* PC2 */
|
122
|
|
- {&gpioc, NULL, &adc1, 3, 0, 13}, /* PC3 */
|
123
|
|
- {&gpioc, NULL, &adc1, 4, 0, 14}, /* PC4 */
|
124
|
|
- {&gpioc, NULL, &adc1, 5, 0, 15}, /* PC5 */
|
125
|
|
- {&gpioc, &timer8, NULL, 6, 1, ADCx}, /* PC6 */
|
126
|
|
- {&gpioc, &timer8, NULL, 7, 2, ADCx}, /* PC7 */
|
127
|
|
- {&gpioc, &timer8, NULL, 8, 3, ADCx}, /* PC8 */
|
128
|
|
- {&gpioc, &timer8, NULL, 9, 4, ADCx}, /* PC9 */
|
129
|
|
- {&gpioc, NULL, NULL, 10, 0, ADCx}, /* PC10 UART4_TX/SDIO_D2 */
|
130
|
|
- {&gpioc, NULL, NULL, 11, 0, ADCx}, /* PC11 UART4_RX/SDIO_D3 */
|
131
|
|
- {&gpioc, NULL, NULL, 12, 0, ADCx}, /* PC12 UART5_TX/SDIO_CK */
|
132
|
|
- {&gpioc, NULL, NULL, 13, 0, ADCx}, /* PC13 TAMPER-RTC */
|
133
|
|
- {&gpioc, NULL, NULL, 14, 0, ADCx}, /* PC14 OSC32_IN */
|
134
|
|
- {&gpioc, NULL, NULL, 15, 0, ADCx}, /* PC15 OSC32_OUT */
|
135
|
|
-
|
136
|
|
- {&gpiod, NULL, NULL, 0, 0, ADCx} , /* PD0 OSC_IN */
|
137
|
|
- {&gpiod, NULL, NULL, 1, 0, ADCx} , /* PD1 OSC_OUT */
|
138
|
|
- {&gpiod, NULL, NULL, 2, 0, ADCx} , /* PD2 TIM3_ETR/UART5_RX SDIO_CMD */
|
|
74
|
+ /*
|
|
75
|
+ gpio_dev *gpio_device; GPIO device
|
|
76
|
+ timer_dev *timer_device; Pin's timer device, if any.
|
|
77
|
+ const adc_dev *adc_device; ADC device, if any.
|
|
78
|
+ uint8 gpio_bit; Pin's GPIO port bit.
|
|
79
|
+ uint8 timer_channel; Timer channel, or 0 if none.
|
|
80
|
+ uint8 adc_channel; Pin ADC channel, or ADCx if none.
|
|
81
|
+ */
|
|
82
|
+
|
|
83
|
+ {&gpioa, &timer2, &adc1, 0, 1, 0}, /* PA0 */
|
|
84
|
+ {&gpioa, &timer2, &adc1, 1, 2, 1}, /* PA1 */
|
|
85
|
+ {&gpioa, &timer2, &adc1, 2, 3, 2}, /* PA2 */
|
|
86
|
+ {&gpioa, &timer2, &adc1, 3, 4, 3}, /* PA3 */
|
|
87
|
+ {&gpioa, NULL, &adc1, 4, 0, 4}, /* PA4 */
|
|
88
|
+ {&gpioa, NULL, &adc1, 5, 0, 5}, /* PA5 */
|
|
89
|
+ {&gpioa, &timer3, &adc1, 6, 1, 6}, /* PA6 */
|
|
90
|
+ {&gpioa, &timer3, &adc1, 7, 2, 7}, /* PA7 */
|
|
91
|
+ {&gpioa, &timer1, NULL, 8, 1, ADCx}, /* PA8 */
|
|
92
|
+ {&gpioa, &timer1, NULL, 9, 2, ADCx}, /* PA9 */
|
|
93
|
+ {&gpioa, &timer1, NULL, 10, 3, ADCx}, /* PA10 */
|
|
94
|
+ {&gpioa, NULL, NULL, 11, 0, ADCx}, /* PA11 */
|
|
95
|
+ {&gpioa, NULL, NULL, 12, 0, ADCx}, /* PA12 */
|
|
96
|
+ {&gpioa, NULL, NULL, 13, 0, ADCx}, /* PA13 */
|
|
97
|
+ {&gpioa, NULL, NULL, 14, 0, ADCx}, /* PA14 */
|
|
98
|
+ {&gpioa, NULL, NULL, 15, 0, ADCx}, /* PA15 */
|
|
99
|
+
|
|
100
|
+ {&gpiob, &timer3, &adc1, 0, 3, 8}, /* PB0 */
|
|
101
|
+ {&gpiob, &timer3, &adc1, 1, 4, 9}, /* PB1 */
|
|
102
|
+ {&gpiob, NULL, NULL, 2, 0, ADCx}, /* PB2 */
|
|
103
|
+ {&gpiob, NULL, NULL, 3, 0, ADCx}, /* PB3 */
|
|
104
|
+ {&gpiob, NULL, NULL, 4, 0, ADCx}, /* PB4 */
|
|
105
|
+ {&gpiob, NULL, NULL, 5, 0, ADCx}, /* PB5 */
|
|
106
|
+ {&gpiob, &timer4, NULL, 6, 1, ADCx}, /* PB6 */
|
|
107
|
+ {&gpiob, &timer4, NULL, 7, 2, ADCx}, /* PB7 */
|
|
108
|
+ {&gpiob, &timer4, NULL, 8, 3, ADCx}, /* PB8 */
|
|
109
|
+ {&gpiob, NULL, NULL, 9, 0, ADCx}, /* PB9 */
|
|
110
|
+ {&gpiob, NULL, NULL, 10, 0, ADCx}, /* PB10 */
|
|
111
|
+ {&gpiob, NULL, NULL, 11, 0, ADCx}, /* PB11 */
|
|
112
|
+ {&gpiob, NULL, NULL, 12, 0, ADCx}, /* PB12 */
|
|
113
|
+ {&gpiob, NULL, NULL, 13, 0, ADCx}, /* PB13 */
|
|
114
|
+ {&gpiob, NULL, NULL, 14, 0, ADCx}, /* PB14 */
|
|
115
|
+ {&gpiob, NULL, NULL, 15, 0, ADCx}, /* PB15 */
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+ {&gpioc, NULL, &adc1, 0, 0, 10}, /* PC0 */
|
|
119
|
+ {&gpioc, NULL, &adc1, 1, 0, 11}, /* PC1 */
|
|
120
|
+ {&gpioc, NULL, &adc1, 2, 0, 12}, /* PC2 */
|
|
121
|
+ {&gpioc, NULL, &adc1, 3, 0, 13}, /* PC3 */
|
|
122
|
+ {&gpioc, NULL, &adc1, 4, 0, 14}, /* PC4 */
|
|
123
|
+ {&gpioc, NULL, &adc1, 5, 0, 15}, /* PC5 */
|
|
124
|
+ {&gpioc, &timer8, NULL, 6, 1, ADCx}, /* PC6 */
|
|
125
|
+ {&gpioc, &timer8, NULL, 7, 2, ADCx}, /* PC7 */
|
|
126
|
+ {&gpioc, &timer8, NULL, 8, 3, ADCx}, /* PC8 */
|
|
127
|
+ {&gpioc, &timer8, NULL, 9, 4, ADCx}, /* PC9 */
|
|
128
|
+ {&gpioc, NULL, NULL, 10, 0, ADCx}, /* PC10 UART4_TX/SDIO_D2 */
|
|
129
|
+ {&gpioc, NULL, NULL, 11, 0, ADCx}, /* PC11 UART4_RX/SDIO_D3 */
|
|
130
|
+ {&gpioc, NULL, NULL, 12, 0, ADCx}, /* PC12 UART5_TX/SDIO_CK */
|
|
131
|
+ {&gpioc, NULL, NULL, 13, 0, ADCx}, /* PC13 TAMPER-RTC */
|
|
132
|
+ {&gpioc, NULL, NULL, 14, 0, ADCx}, /* PC14 OSC32_IN */
|
|
133
|
+ {&gpioc, NULL, NULL, 15, 0, ADCx}, /* PC15 OSC32_OUT */
|
|
134
|
+
|
|
135
|
+ {&gpiod, NULL, NULL, 0, 0, ADCx} , /* PD0 OSC_IN */
|
|
136
|
+ {&gpiod, NULL, NULL, 1, 0, ADCx} , /* PD1 OSC_OUT */
|
|
137
|
+ {&gpiod, NULL, NULL, 2, 0, ADCx} , /* PD2 TIM3_ETR/UART5_RX SDIO_CMD */
|
139
|
138
|
};
|
140
|
139
|
|
141
|
140
|
/* Basically everything that is defined as having a timer us PWM */
|
142
|
141
|
extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
|
143
|
|
- PA0,PA1,PA2,PA3,PA6,PA7,PA8,PA9,PA10,PB0,PB1,PB6,PB7,PB8,PB9,PC6,PC7,PC8,PC9
|
|
142
|
+ PA0,PA1,PA2,PA3,PA6,PA7,PA8,PA9,PA10,PB0,PB1,PB6,PB7,PB8,PB9,PC6,PC7,PC8,PC9
|
144
|
143
|
};
|
145
|
144
|
|
146
|
145
|
/* Basically everything that is defined having ADC */
|
147
|
146
|
extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
|
148
|
|
- PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PB0,PB1,PC0,PC1,PC2,PC3,PC4,PC5
|
|
147
|
+ PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PB0,PB1,PC0,PC1,PC2,PC3,PC4,PC5
|
149
|
148
|
};
|
150
|
149
|
|
151
|
150
|
/* not sure what this us used for */
|
152
|
151
|
extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
|
153
|
|
- BOARD_JTMS_SWDIO_PIN,
|
154
|
|
- BOARD_JTCK_SWCLK_PIN, BOARD_JTDI_PIN, BOARD_JTDO_PIN, BOARD_NJTRST_PIN
|
|
152
|
+ BOARD_JTMS_SWDIO_PIN,
|
|
153
|
+ BOARD_JTCK_SWCLK_PIN, BOARD_JTDI_PIN, BOARD_JTDO_PIN, BOARD_NJTRST_PIN
|
155
|
154
|
};
|
156
|
155
|
|
157
|
156
|
DEFINE_HWSERIAL(Serial1, 1);
|