2929#include "peripherals/pins.h"
3030#include "peripherals/periph.h"
3131
32- // I2C
32+ I2C_TypeDef * mcu_i2c_banks [ I2C_BANK_ARRAY_LEN ] = { I2C1 , I2C2 , I2C3 };
3333
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 ] = {
3735 PERIPH (1 , 4 , & pin_PB07 ),
3836 PERIPH (1 , 4 , & pin_PB09 ),
3937 PERIPH (2 , 4 , & pin_PB11 ),
4038 PERIPH (3 , 4 , & pin_PC09 ),
39+ PERIPH (2 , 4 , & pin_PF00 ),
40+ PERIPH (2 , 4 , & pin_PH05 ),
41+ PERIPH (3 , 4 , & pin_PH08 ),
4142};
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 ),
4445 PERIPH (1 , 4 , & pin_PB06 ),
4546 PERIPH (1 , 4 , & pin_PB08 ),
4647 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 ),
4851};
4952
50- SPI_TypeDef * mcu_spi_banks [3 ] = {SPI1 , SPI2 , SPI3 };
53+ SPI_TypeDef * mcu_spi_banks [SPI_BANK_ARRAY_LEN ] = {SPI1 , SPI2 , SPI3 };
5154
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 ] = {
5356 PERIPH (1 , 5 , & pin_PA05 ),
5457 PERIPH (1 , 5 , & pin_PB03 ),
58+ PERIPH (3 , 6 , & pin_PB03 ),
5559 PERIPH (2 , 5 , & pin_PB10 ),
5660 PERIPH (2 , 5 , & pin_PB13 ),
57- PERIPH (2 , 5 , & pin_PC07 ),
58- PERIPH (3 , 6 , & pin_PB03 ),
5961 PERIPH (3 , 6 , & pin_PC10 ),
62+ PERIPH (2 , 5 , & pin_PI01 ),
6063};
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 ] = {
6365 PERIPH (1 , 5 , & pin_PA07 ),
6466 PERIPH (1 , 5 , & pin_PB05 ),
67+ PERIPH (3 , 6 , & pin_PB05 ),
6568 PERIPH (2 , 5 , & pin_PB15 ),
6669 PERIPH (2 , 5 , & pin_PC03 ),
67- PERIPH (3 , 6 , & pin_PB05 ),
6870 PERIPH (3 , 6 , & pin_PC12 ),
71+ PERIPH (2 , 5 , & pin_PI03 ),
6972};
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 ] = {
7274 PERIPH (1 , 5 , & pin_PA06 ),
7375 PERIPH (1 , 5 , & pin_PB04 ),
76+ PERIPH (3 , 6 , & pin_PB04 ),
7477 PERIPH (2 , 5 , & pin_PB14 ),
7578 PERIPH (2 , 5 , & pin_PC02 ),
76- PERIPH (3 , 6 , & pin_PB04 ),
7779 PERIPH (3 , 6 , & pin_PC11 ),
80+ PERIPH (2 , 5 , & pin_PI02 ),
7881};
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 ] = {
8183 PERIPH (1 , 5 , & pin_PA04 ),
8284 PERIPH (1 , 5 , & pin_PA15 ),
8385 PERIPH (2 , 5 , & pin_PB09 ),
@@ -89,7 +91,7 @@ const mcu_periph_obj_t mcu_spi_nss_list[6] = {
8991USART_TypeDef * mcu_uart_banks [MAX_UART ] = {USART1 , USART2 , USART3 , UART4 , UART5 , USART6 };
9092bool mcu_uart_has_usart [MAX_UART ] = {true, true, true, false, false, true};
9193
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 ] = {
9395 PERIPH (4 , 8 , & pin_PA00 ),
9496 PERIPH (2 , 7 , & pin_PA02 ),
9597 PERIPH (1 , 7 , & pin_PA09 ),
@@ -103,8 +105,7 @@ const mcu_periph_obj_t mcu_uart_tx_list[12] = {
103105 PERIPH (3 , 7 , & pin_PD08 ),
104106 PERIPH (6 , 8 , & pin_PG14 ),
105107};
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 ] = {
108109 PERIPH (4 , 8 , & pin_PA01 ),
109110 PERIPH (2 , 7 , & pin_PA03 ),
110111 PERIPH (1 , 7 , & pin_PA10 ),
@@ -121,74 +122,75 @@ const mcu_periph_obj_t mcu_uart_rx_list[12] = {
121122
122123//Timers
123124//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 ,
125126 TIM11 , TIM12 , TIM13 , TIM14 };
126127
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 ),
194196};
0 commit comments