29
29
#include "peripherals/pins.h"
30
30
#include "peripherals/periph.h"
31
31
32
- // I2C
32
+ I2C_TypeDef * mcu_i2c_banks [ I2C_BANK_ARRAY_LEN ] = { I2C1 , I2C2 , I2C3 };
33
33
34
- I2C_TypeDef * mcu_i2c_banks [3 ] = {I2C1 , I2C2 , I2C3 };
35
-
36
- const mcu_periph_obj_t mcu_i2c_sda_list [4 ] = {
34
+ const mcu_periph_obj_t mcu_i2c_sda_list [I2C_SDA_ARRAY_LEN ] = {
37
35
PERIPH (1 , 4 , & pin_PB07 ),
38
36
PERIPH (1 , 4 , & pin_PB09 ),
39
37
PERIPH (2 , 4 , & pin_PB11 ),
40
38
PERIPH (3 , 4 , & pin_PC09 ),
39
+ PERIPH (2 , 4 , & pin_PF00 ),
40
+ PERIPH (2 , 4 , & pin_PH05 ),
41
+ PERIPH (3 , 4 , & pin_PH08 ),
41
42
};
42
-
43
- const mcu_periph_obj_t mcu_i2c_scl_list [ 4 ] = {
43
+ const mcu_periph_obj_t mcu_i2c_scl_list [ I2C_SCL_ARRAY_LEN ] = {
44
+ PERIPH ( 3 , 4 , & pin_PA08 ),
44
45
PERIPH (1 , 4 , & pin_PB06 ),
45
46
PERIPH (1 , 4 , & pin_PB08 ),
46
47
PERIPH (2 , 4 , & pin_PB10 ),
47
- PERIPH (3 , 4 , & pin_PA08 )
48
+ PERIPH (2 , 4 , & pin_PF01 ),
49
+ PERIPH (2 , 4 , & pin_PH04 ),
50
+ PERIPH (3 , 4 , & pin_PH07 ),
48
51
};
49
52
50
- SPI_TypeDef * mcu_spi_banks [3 ] = {SPI1 , SPI2 , SPI3 };
53
+ SPI_TypeDef * mcu_spi_banks [SPI_BANK_ARRAY_LEN ] = {SPI1 , SPI2 , SPI3 };
51
54
52
- const mcu_periph_obj_t mcu_spi_sck_list [7 ] = {
55
+ const mcu_periph_obj_t mcu_spi_sck_list [SPI_SCK_ARRAY_LEN ] = {
53
56
PERIPH (1 , 5 , & pin_PA05 ),
54
57
PERIPH (1 , 5 , & pin_PB03 ),
58
+ PERIPH (3 , 6 , & pin_PB03 ),
55
59
PERIPH (2 , 5 , & pin_PB10 ),
56
60
PERIPH (2 , 5 , & pin_PB13 ),
57
- PERIPH (2 , 5 , & pin_PC07 ),
58
- PERIPH (3 , 6 , & pin_PB03 ),
59
61
PERIPH (3 , 6 , & pin_PC10 ),
62
+ PERIPH (2 , 5 , & pin_PI01 ),
60
63
};
61
-
62
- const mcu_periph_obj_t mcu_spi_mosi_list [6 ] = {
64
+ const mcu_periph_obj_t mcu_spi_mosi_list [SPI_MOSI_ARRAY_LEN ] = {
63
65
PERIPH (1 , 5 , & pin_PA07 ),
64
66
PERIPH (1 , 5 , & pin_PB05 ),
67
+ PERIPH (3 , 6 , & pin_PB05 ),
65
68
PERIPH (2 , 5 , & pin_PB15 ),
66
69
PERIPH (2 , 5 , & pin_PC03 ),
67
- PERIPH (3 , 6 , & pin_PB05 ),
68
70
PERIPH (3 , 6 , & pin_PC12 ),
71
+ PERIPH (2 , 5 , & pin_PI03 ),
69
72
};
70
-
71
- const mcu_periph_obj_t mcu_spi_miso_list [6 ] = {
73
+ const mcu_periph_obj_t mcu_spi_miso_list [SPI_MISO_ARRAY_LEN ] = {
72
74
PERIPH (1 , 5 , & pin_PA06 ),
73
75
PERIPH (1 , 5 , & pin_PB04 ),
76
+ PERIPH (3 , 6 , & pin_PB04 ),
74
77
PERIPH (2 , 5 , & pin_PB14 ),
75
78
PERIPH (2 , 5 , & pin_PC02 ),
76
- PERIPH (3 , 6 , & pin_PB04 ),
77
79
PERIPH (3 , 6 , & pin_PC11 ),
80
+ PERIPH (2 , 5 , & pin_PI02 ),
78
81
};
79
-
80
- const mcu_periph_obj_t mcu_spi_nss_list [6 ] = {
82
+ const mcu_periph_obj_t mcu_spi_nss_list [SPI_NSS_ARRAY_LEN ] = {
81
83
PERIPH (1 , 5 , & pin_PA04 ),
82
84
PERIPH (1 , 5 , & pin_PA15 ),
83
85
PERIPH (2 , 5 , & pin_PB09 ),
@@ -89,7 +91,7 @@ const mcu_periph_obj_t mcu_spi_nss_list[6] = {
89
91
USART_TypeDef * mcu_uart_banks [MAX_UART ] = {USART1 , USART2 , USART3 , UART4 , UART5 , USART6 };
90
92
bool mcu_uart_has_usart [MAX_UART ] = {true, true, true, false, false, true};
91
93
92
- const mcu_periph_obj_t mcu_uart_tx_list [12 ] = {
94
+ const mcu_periph_obj_t mcu_uart_tx_list [UART_TX_ARRAY_LEN ] = {
93
95
PERIPH (4 , 8 , & pin_PA00 ),
94
96
PERIPH (2 , 7 , & pin_PA02 ),
95
97
PERIPH (1 , 7 , & pin_PA09 ),
@@ -103,8 +105,7 @@ const mcu_periph_obj_t mcu_uart_tx_list[12] = {
103
105
PERIPH (3 , 7 , & pin_PD08 ),
104
106
PERIPH (6 , 8 , & pin_PG14 ),
105
107
};
106
-
107
- const mcu_periph_obj_t mcu_uart_rx_list [12 ] = {
108
+ const mcu_periph_obj_t mcu_uart_rx_list [UART_RX_ARRAY_LEN ] = {
108
109
PERIPH (4 , 8 , & pin_PA01 ),
109
110
PERIPH (2 , 7 , & pin_PA03 ),
110
111
PERIPH (1 , 7 , & pin_PA10 ),
@@ -121,74 +122,120 @@ const mcu_periph_obj_t mcu_uart_rx_list[12] = {
121
122
122
123
//Timers
123
124
//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
124
- TIM_TypeDef * mcu_tim_banks [14 ] = {TIM1 , TIM2 , TIM3 , TIM4 , TIM5 , NULL , NULL , TIM8 , TIM9 , TIM10 ,
125
+ TIM_TypeDef * mcu_tim_banks [TIM_BANK_ARRAY_LEN ] = {TIM1 , TIM2 , TIM3 , TIM4 , TIM5 , NULL , NULL , TIM8 , TIM9 , TIM10 ,
125
126
TIM11 , TIM12 , TIM13 , TIM14 };
126
127
127
- const mcu_tim_pin_obj_t mcu_tim_pin_list [56 ] = {
128
- TIM (2 ,1 ,1 ,& pin_PA00 ),
129
- TIM (5 ,2 ,1 ,& pin_PA00 ),
130
- TIM (2 ,1 ,2 ,& pin_PA01 ),
131
- TIM (5 ,2 ,2 ,& pin_PA01 ),
132
- TIM (2 ,1 ,3 ,& pin_PA02 ),
133
- TIM (5 ,2 ,3 ,& pin_PA02 ),
134
- TIM (2 ,1 ,4 ,& pin_PA03 ),
135
- TIM (5 ,2 ,4 ,& pin_PA03 ),
136
- TIM (9 ,3 ,1 ,& pin_PA02 ),
137
- TIM (9 ,3 ,2 ,& pin_PA03 ),
138
- TIM (3 ,2 ,1 ,& pin_PA06 ),
139
- TIM (13 ,9 ,1 ,& pin_PA06 ),
140
- TIM (3 ,2 ,2 ,& pin_PA07 ),
141
- TIM (14 ,9 ,1 ,& pin_PA07 ),
142
- TIM (1 ,1 ,1 ,& pin_PA08 ),
143
- TIM (1 ,1 ,2 ,& pin_PA09 ),
144
- TIM (1 ,1 ,3 ,& pin_PA10 ),
145
- TIM (1 ,1 ,4 ,& pin_PA11 ),
146
- TIM (2 ,1 ,1 ,& pin_PA15 ),
147
- TIM (3 ,2 ,3 ,& pin_PB00 ),
148
- TIM (3 ,2 ,4 ,& pin_PB01 ),
149
- TIM (2 ,1 ,2 ,& pin_PB03 ),
150
- TIM (3 ,2 ,1 ,& pin_PB04 ),
151
- TIM (3 ,2 ,2 ,& pin_PB05 ),
152
- TIM (4 ,2 ,1 ,& pin_PB06 ),
153
- TIM (4 ,2 ,2 ,& pin_PB07 ),
154
- TIM (4 ,2 ,3 ,& pin_PB08 ),
155
- TIM (10 ,2 ,1 ,& pin_PB08 ),
156
- TIM (4 ,2 ,4 ,& pin_PB09 ),
157
- TIM (11 ,2 ,1 ,& pin_PB09 ),
158
- TIM (2 ,1 ,3 ,& pin_PB10 ),
159
- TIM (2 ,1 ,4 ,& pin_PB11 ),
160
- TIM (12 ,9 ,1 ,& pin_PB14 ),
161
- TIM (12 ,9 ,2 ,& pin_PB15 ),
162
- TIM (3 ,2 ,1 ,& pin_PC06 ),
163
- TIM (3 ,2 ,2 ,& pin_PC07 ),
164
- TIM (3 ,2 ,3 ,& pin_PC08 ),
165
- TIM (3 ,2 ,4 ,& pin_PC09 ),
166
- TIM (8 ,3 ,1 ,& pin_PC06 ),
167
- TIM (8 ,3 ,2 ,& pin_PC07 ),
168
- TIM (8 ,3 ,3 ,& pin_PC08 ),
169
- TIM (8 ,3 ,4 ,& pin_PC09 ),
170
- TIM (4 ,2 ,1 ,& pin_PD12 ),
171
- TIM (4 ,2 ,2 ,& pin_PD13 ),
172
- TIM (4 ,2 ,3 ,& pin_PD14 ),
173
- TIM (4 ,2 ,4 ,& pin_PD15 ),
174
- TIM (9 ,3 ,1 ,& pin_PE05 ),
175
- TIM (9 ,3 ,2 ,& pin_PE06 ),
176
- TIM (1 ,1 ,1 ,& pin_PE09 ),
177
- TIM (1 ,1 ,2 ,& pin_PE11 ),
178
- TIM (1 ,1 ,3 ,& pin_PE13 ),
179
- TIM (1 ,1 ,4 ,& pin_PE14 ),
180
- TIM (10 ,3 ,1 ,& pin_PF06 ),
181
- TIM (11 ,3 ,1 ,& pin_PF07 ),
182
- TIM (13 ,9 ,1 ,& pin_PF08 ),
183
- TIM (14 ,9 ,1 ,& pin_PF09 ),
184
- // TIM(12,9,1,&pin_PH06), //TODO: include these when pin map is expanded
185
- // TIM(12,9,2,&pin_PH09),
186
- // TIM(5,2,1,&pin_PH10),
187
- // TIM(5,2,2,&pin_PH11),
188
- // TIM(5,2,3,&pin_PH12),
189
- // TIM(5,2,4,&pin_PI00),
190
- // TIM(8,3,4,&pin_PI02),
191
- // TIM(8,3,1,&pin_PI05),
192
- // TIM(8,3,2,&pin_PI06),
193
- // TIM(8,3,3,&pin_PI07),
128
+ const mcu_tim_pin_obj_t mcu_tim_pin_list [TIM_PIN_ARRAY_LEN ] = {
129
+ TIM (2 , 1 , 1 , & pin_PA00 ),
130
+ TIM (5 , 2 , 1 , & pin_PA00 ),
131
+ TIM (2 , 1 , 2 , & pin_PA01 ),
132
+ TIM (5 , 2 , 2 , & pin_PA01 ),
133
+ TIM (2 , 1 , 3 , & pin_PA02 ),
134
+ TIM (5 , 2 , 3 , & pin_PA02 ),
135
+ TIM (9 , 3 , 1 , & pin_PA02 ),
136
+ TIM (2 , 1 , 4 , & pin_PA03 ),
137
+ TIM (5 , 2 , 4 , & pin_PA03 ),
138
+ TIM (9 , 3 , 2 , & pin_PA03 ),
139
+ TIM (2 , 1 , 1 , & pin_PA05 ),
140
+ TIM (3 , 2 , 1 , & pin_PA06 ),
141
+ TIM (13 , 9 , 1 , & pin_PA06 ),
142
+ TIM (3 , 2 , 2 , & pin_PA07 ),
143
+ TIM (14 , 9 , 1 , & pin_PA07 ),
144
+ TIM (1 , 1 , 1 , & pin_PA08 ),
145
+ TIM (1 , 1 , 2 , & pin_PA09 ),
146
+ TIM (1 , 1 , 3 , & pin_PA10 ),
147
+ TIM (1 , 1 , 4 , & pin_PA11 ),
148
+ TIM (2 , 1 , 1 , & pin_PA15 ),
149
+ TIM (3 , 2 , 3 , & pin_PB00 ),
150
+ TIM (3 , 2 , 4 , & pin_PB01 ),
151
+ TIM (2 , 1 , 2 , & pin_PB03 ),
152
+ TIM (3 , 2 , 1 , & pin_PB04 ),
153
+ TIM (3 , 2 , 2 , & pin_PB05 ),
154
+ TIM (4 , 2 , 1 , & pin_PB06 ),
155
+ TIM (4 , 2 , 2 , & pin_PB07 ),
156
+ TIM (4 , 2 , 3 , & pin_PB08 ),
157
+ TIM (10 , 3 , 1 , & pin_PB08 ),
158
+ TIM (4 , 2 , 4 , & pin_PB09 ),
159
+ TIM (11 , 3 , 1 , & pin_PB09 ),
160
+ TIM (2 , 1 , 3 , & pin_PB10 ),
161
+ TIM (2 , 1 , 4 , & pin_PB11 ),
162
+ TIM (12 , 9 , 1 , & pin_PB14 ),
163
+ TIM (12 , 9 , 2 , & pin_PB15 ),
164
+ TIM (3 , 2 , 1 , & pin_PC06 ),
165
+ TIM (8 , 3 , 1 , & pin_PC06 ),
166
+ TIM (3 , 2 , 2 , & pin_PC07 ),
167
+ TIM (8 , 3 , 2 , & pin_PC07 ),
168
+ TIM (3 , 2 , 3 , & pin_PC08 ),
169
+ TIM (8 , 3 , 3 , & pin_PC08 ),
170
+ TIM (3 , 2 , 4 , & pin_PC09 ),
171
+ TIM (8 , 3 , 4 , & pin_PC09 ),
172
+ TIM (4 , 2 , 1 , & pin_PD12 ),
173
+ TIM (4 , 2 , 2 , & pin_PD13 ),
174
+ TIM (4 , 2 , 3 , & pin_PD14 ),
175
+ TIM (4 , 2 , 4 , & pin_PD15 ),
176
+ TIM (9 , 3 , 1 , & pin_PE05 ),
177
+ TIM (9 , 3 , 2 , & pin_PE06 ),
178
+ TIM (1 , 1 , 1 , & pin_PE09 ),
179
+ TIM (1 , 1 , 2 , & pin_PE11 ),
180
+ TIM (1 , 1 , 3 , & pin_PE13 ),
181
+ TIM (1 , 1 , 4 , & pin_PE14 ),
182
+ TIM (10 , 3 , 1 , & pin_PF06 ),
183
+ TIM (11 , 3 , 1 , & pin_PF07 ),
184
+ TIM (13 , 9 , 1 , & pin_PF08 ),
185
+ TIM (14 , 9 , 1 , & pin_PF09 ),
186
+ TIM (12 , 9 , 1 , & pin_PH06 ),
187
+ TIM (12 , 9 , 2 , & pin_PH09 ),
188
+ TIM (5 , 2 , 1 , & pin_PH10 ),
189
+ TIM (5 , 2 , 2 , & pin_PH11 ),
190
+ TIM (5 , 2 , 3 , & pin_PH12 ),
191
+ TIM (5 , 2 , 4 , & pin_PI00 ),
192
+ TIM (8 , 3 , 4 , & pin_PI02 ),
193
+ TIM (8 , 3 , 1 , & pin_PI05 ),
194
+ TIM (8 , 3 , 2 , & pin_PI06 ),
195
+ TIM (8 , 3 , 3 , & pin_PI07 ),
196
+ };
197
+
198
+ //SDIO
199
+ SDIO_TypeDef * mcu_sdio_banks [1 ] = {SDIO };
200
+
201
+ const mcu_periph_obj_t mcu_sdio_clock_list [1 ] = {
202
+ PERIPH (1 , 12 , & pin_PC12 ),
203
+ };
204
+ const mcu_periph_obj_t mcu_sdio_command_list [1 ] = {
205
+ PERIPH (1 , 12 , & pin_PD02 ),
206
+ };
207
+ const mcu_periph_obj_t mcu_sdio_data0_list [1 ] = {
208
+ PERIPH (1 , 12 , & pin_PC08 ),
209
+ };
210
+ const mcu_periph_obj_t mcu_sdio_data1_list [1 ] = {
211
+ PERIPH (1 , 12 , & pin_PC09 ),
212
+ };
213
+ const mcu_periph_obj_t mcu_sdio_data2_list [1 ] = {
214
+ PERIPH (1 , 12 , & pin_PC10 ),
215
+ };
216
+ const mcu_periph_obj_t mcu_sdio_data3_list [1 ] = {
217
+ PERIPH (1 , 12 , & pin_PC11 ),
218
+ };
219
+
220
+ //CAN
221
+ CAN_TypeDef * mcu_can_banks [2 ] = {CAN1 , CAN2 };
222
+
223
+ const mcu_periph_obj_t mcu_can_tx_list [6 ] = {
224
+ PERIPH (1 , 9 , & pin_PA11 ),
225
+ PERIPH (1 , 9 , & pin_PB08 ),
226
+ PERIPH (1 , 9 , & pin_PD00 ),
227
+ PERIPH (1 , 9 , & pin_PI09 ),
228
+
229
+ PERIPH (2 , 9 , & pin_PB12 ),
230
+ PERIPH (2 , 9 , & pin_PB05 ),
231
+ };
232
+
233
+ const mcu_periph_obj_t mcu_can_rx_list [6 ] = {
234
+ PERIPH (1 , 9 , & pin_PA12 ),
235
+ PERIPH (1 , 9 , & pin_PB09 ),
236
+ PERIPH (1 , 9 , & pin_PD01 ),
237
+ PERIPH (1 , 9 , & pin_PH13 ),
238
+
239
+ PERIPH (2 , 9 , & pin_PB13 ),
240
+ PERIPH (2 , 9 , & pin_PB06 ),
194
241
};
0 commit comments