Skip to content

Commit c0f1ce5

Browse files
committed
Add support across dev boards
1 parent 7fd5e9b commit c0f1ce5

File tree

9 files changed

+136
-6
lines changed

9 files changed

+136
-6
lines changed

ports/stm32f4/boards/pyboard_v11/stm32f4xx_hal_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
/* #define HAL_SD_MODULE_ENABLED */
6262
/* #define HAL_MMC_MODULE_ENABLED */
6363
#define HAL_SPI_MODULE_ENABLED
64-
/* #define HAL_TIM_MODULE_ENABLED */
64+
#define HAL_TIM_MODULE_ENABLED
6565
#define HAL_UART_MODULE_ENABLED
6666
/* #define HAL_USART_MODULE_ENABLED */
6767
/* #define HAL_IRDA_MODULE_ENABLED */

ports/stm32f4/boards/stm32f411ve_discovery/stm32f4xx_hal_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
/* #define HAL_SD_MODULE_ENABLED */
6262
/* #define HAL_MMC_MODULE_ENABLED */
6363
#define HAL_SPI_MODULE_ENABLED
64-
/* #define HAL_TIM_MODULE_ENABLED */
64+
#define HAL_TIM_MODULE_ENABLED
6565
#define HAL_UART_MODULE_ENABLED
6666
/* #define HAL_USART_MODULE_ENABLED */
6767
/* #define HAL_IRDA_MODULE_ENABLED */

ports/stm32f4/boards/stm32f412zg_discovery/stm32f4xx_hal_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#define HAL_SD_MODULE_ENABLED
6262
/* #define HAL_MMC_MODULE_ENABLED */
6363
#define HAL_SPI_MODULE_ENABLED
64-
/* #define HAL_TIM_MODULE_ENABLED */
64+
#define HAL_TIM_MODULE_ENABLED
6565
#define HAL_UART_MODULE_ENABLED
6666
/* #define HAL_USART_MODULE_ENABLED */
6767
/* #define HAL_IRDA_MODULE_ENABLED */

ports/stm32f4/peripherals/stm32f4/stm32f405xx/periph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const mcu_spi_nss_obj_t mcu_spi_nss_list[6] = {
9191
TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
9292
TIM11, TIM12, TIM13, TIM14};
9393

94-
const mcu_tim_pin_obj_t mcu_tim_pin_list[66] = {
94+
const mcu_tim_pin_obj_t mcu_tim_pin_list[56] = {
9595
TIM(2,1,1,&pin_PA00),
9696
TIM(5,2,1,&pin_PA00),
9797
TIM(2,1,2,&pin_PA01),

ports/stm32f4/peripherals/stm32f4/stm32f405xx/periph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ extern const mcu_spi_nss_obj_t mcu_spi_nss_list[6];
4343

4444
#define TIM_BANK_ARRAY_LEN 14
4545
TIM_TypeDef * mcu_tim_banks[14];
46-
#define TIM_PIN_ARRAY_LEN 66
47-
const mcu_tim_pin_obj_t mcu_tim_pin_list[66];
46+
#define TIM_PIN_ARRAY_LEN 56
47+
const mcu_tim_pin_obj_t mcu_tim_pin_list[56];
4848

4949

5050
#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F405XX_PERIPH_H

ports/stm32f4/peripherals/stm32f4/stm32f411xe/periph.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,55 @@ const mcu_spi_nss_obj_t mcu_spi_nss_list[12] = {
120120
};
121121

122122
//UART, Etc
123+
124+
//Timers
125+
//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
126+
TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL, TIM9, TIM10,
127+
TIM11, NULL, NULL, NULL};
128+
129+
const mcu_tim_pin_obj_t mcu_tim_pin_list[44] = {
130+
TIM(2,1,1,&pin_PA00),
131+
TIM(5,2,1,&pin_PA00),
132+
TIM(2,1,2,&pin_PA01),
133+
TIM(5,2,2,&pin_PA01),
134+
TIM(2,1,3,&pin_PA02),
135+
TIM(5,2,3,&pin_PA02),
136+
TIM(2,1,4,&pin_PA03),
137+
TIM(5,2,4,&pin_PA03),
138+
TIM(9,3,1,&pin_PA02),
139+
TIM(9,3,2,&pin_PA03),
140+
TIM(3,2,1,&pin_PA06),
141+
TIM(3,2,2,&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(3,2,1,&pin_PC06),
160+
TIM(3,2,2,&pin_PC07),
161+
TIM(3,2,3,&pin_PC08),
162+
TIM(3,2,4,&pin_PC09),
163+
TIM(4,2,1,&pin_PD12),
164+
TIM(4,2,2,&pin_PD13),
165+
TIM(4,2,3,&pin_PD14),
166+
TIM(4,2,4,&pin_PD15),
167+
TIM(9,3,1,&pin_PE05),
168+
TIM(9,3,2,&pin_PE06),
169+
TIM(1,1,1,&pin_PE09),
170+
TIM(1,1,2,&pin_PE11),
171+
TIM(1,1,3,&pin_PE13),
172+
TIM(1,1,4,&pin_PE14),
173+
};
174+

ports/stm32f4/peripherals/stm32f4/stm32f411xe/periph.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ extern const mcu_spi_mosi_obj_t mcu_spi_mosi_list[14];
4141
extern const mcu_spi_miso_obj_t mcu_spi_miso_list[12];
4242
extern const mcu_spi_nss_obj_t mcu_spi_nss_list[12];
4343

44+
#define TIM_BANK_ARRAY_LEN 14
45+
TIM_TypeDef * mcu_tim_banks[14];
46+
#define TIM_PIN_ARRAY_LEN 44
47+
const mcu_tim_pin_obj_t mcu_tim_pin_list[44];
48+
4449
#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H

ports/stm32f4/peripherals/stm32f4/stm32f412zx/periph.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,71 @@ const mcu_spi_nss_obj_t mcu_spi_nss_list[12] = {
121121
};
122122

123123
//UART, Etc
124+
125+
//Timers
126+
//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
127+
TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
128+
TIM11, TIM12, TIM13, TIM14};
129+
130+
const mcu_tim_pin_obj_t mcu_tim_pin_list[60] = {
131+
TIM(2,1,1,&pin_PA00),
132+
TIM(5,2,1,&pin_PA00),
133+
TIM(2,1,2,&pin_PA01),
134+
TIM(5,2,2,&pin_PA01),
135+
TIM(2,1,3,&pin_PA02),
136+
TIM(5,2,3,&pin_PA02),
137+
TIM(2,1,4,&pin_PA03),
138+
TIM(5,2,4,&pin_PA03),
139+
TIM(9,3,1,&pin_PA02),
140+
TIM(9,3,2,&pin_PA03),
141+
TIM(3,2,1,&pin_PA06),
142+
TIM(13,9,1,&pin_PA06),
143+
TIM(3,2,2,&pin_PA07),
144+
TIM(14,9,1,&pin_PA07),
145+
TIM(1,1,1,&pin_PA08),
146+
TIM(1,1,2,&pin_PA09),
147+
TIM(1,1,3,&pin_PA10),
148+
TIM(1,1,4,&pin_PA11),
149+
TIM(2,1,1,&pin_PA15),
150+
TIM(3,2,3,&pin_PB00),
151+
TIM(3,2,4,&pin_PB01),
152+
TIM(2,1,2,&pin_PB03),
153+
TIM(3,2,1,&pin_PB04),
154+
TIM(3,2,2,&pin_PB05),
155+
TIM(4,2,1,&pin_PB06),
156+
TIM(4,2,2,&pin_PB07),
157+
TIM(4,2,3,&pin_PB08),
158+
TIM(10,2,1,&pin_PB08),
159+
TIM(4,2,4,&pin_PB09),
160+
TIM(11,2,1,&pin_PB09),
161+
TIM(2,1,3,&pin_PB10),
162+
TIM(2,1,4,&pin_PB11),
163+
TIM(12,9,1,&pin_PB14),
164+
TIM(12,9,2,&pin_PB15),
165+
TIM(3,2,1,&pin_PC06),
166+
TIM(3,2,2,&pin_PC07),
167+
TIM(3,2,3,&pin_PC08),
168+
TIM(3,2,4,&pin_PC09),
169+
TIM(8,3,1,&pin_PC06),
170+
TIM(8,3,2,&pin_PC07),
171+
TIM(8,3,3,&pin_PC08),
172+
TIM(8,3,4,&pin_PC09),
173+
TIM(4,2,1,&pin_PD12),
174+
TIM(4,2,2,&pin_PD13),
175+
TIM(4,2,3,&pin_PD14),
176+
TIM(4,2,4,&pin_PD15),
177+
TIM(9,3,1,&pin_PE05),
178+
TIM(9,3,2,&pin_PE06),
179+
TIM(1,1,1,&pin_PE09),
180+
TIM(1,1,2,&pin_PE11),
181+
TIM(1,1,3,&pin_PE13),
182+
TIM(1,1,4,&pin_PE14),
183+
TIM(10,3,1,&pin_PF06),
184+
TIM(11,3,1,&pin_PF07),
185+
TIM(13,9,1,&pin_PF08),
186+
TIM(14,9,1,&pin_PF09),
187+
TIM(5,2,1,&pin_PF03),
188+
TIM(5,2,2,&pin_PF04),
189+
TIM(5,2,3,&pin_PF05),
190+
TIM(5,2,4,&pin_PF10),
191+
};

ports/stm32f4/peripherals/stm32f4/stm32f412zx/periph.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,9 @@ extern const mcu_spi_mosi_obj_t mcu_spi_mosi_list[14];
4242
extern const mcu_spi_miso_obj_t mcu_spi_miso_list[12];
4343
extern const mcu_spi_nss_obj_t mcu_spi_nss_list[12];
4444

45+
#define TIM_BANK_ARRAY_LEN 14
46+
TIM_TypeDef * mcu_tim_banks[14];
47+
#define TIM_PIN_ARRAY_LEN 60
48+
const mcu_tim_pin_obj_t mcu_tim_pin_list[60];
49+
4550
#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H

0 commit comments

Comments
 (0)