summaryrefslogtreecommitdiff
path: root/ports/stm/peripherals
diff options
context:
space:
mode:
Diffstat (limited to 'ports/stm/peripherals')
-rw-r--r--ports/stm/peripherals/periph.h36
-rw-r--r--ports/stm/peripherals/pins.h28
-rw-r--r--ports/stm/peripherals/stm32f4/clocks.c12
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/clocks.h2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c10
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/periph.c18
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/periph.h16
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/pins.c14
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/pins.h20
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/clocks.h2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c14
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/periph.c24
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/periph.h22
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/pins.c2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/clocks.h2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c14
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/periph.c24
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/periph.h22
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/pins.c2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c14
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/periph.c16
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/periph.h16
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/pins.c14
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/pins.h20
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/clocks.h2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c18
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/periph.c20
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/periph.h16
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/pins.c8
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/pins.h28
-rw-r--r--ports/stm/peripherals/stm32f7/clocks.c10
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f746xx/gpio.c16
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f746xx/periph.c20
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f746xx/periph.h16
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f746xx/pins.c2
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c12
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/periph.c22
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/periph.h16
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/pins.c2
-rw-r--r--ports/stm/peripherals/stm32h7/clocks.c21
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c12
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/periph.c20
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/periph.h16
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/pins.c2
-rw-r--r--ports/stm/peripherals/timers.c92
-rw-r--r--ports/stm/peripherals/timers.h22
47 files changed, 383 insertions, 376 deletions
diff --git a/ports/stm/peripherals/periph.h b/ports/stm/peripherals/periph.h
index 34089c849..488541d09 100644
--- a/ports/stm/peripherals/periph.h
+++ b/ports/stm/peripherals/periph.h
@@ -36,34 +36,34 @@
// Comm Peripherals
typedef struct {
- uint8_t periph_index:4; // Index of the peripheral instance
- uint8_t altfn_index:4; // Index of the altfn for this pin (0 to 15)
- const mcu_pin_obj_t * pin; // Pin Object
+ uint8_t periph_index : 4; // Index of the peripheral instance
+ uint8_t altfn_index : 4; // Index of the altfn for this pin (0 to 15)
+ const mcu_pin_obj_t *pin; // Pin Object
} mcu_periph_obj_t;
#define PERIPH(index, alt, p_pin) \
-{ \
- .periph_index = index, \
- .altfn_index = alt, \
- .pin = p_pin, \
-}
+ { \
+ .periph_index = index, \
+ .altfn_index = alt, \
+ .pin = p_pin, \
+ }
// Timer Peripheral
typedef struct {
- uint8_t tim_index:4;
- uint8_t altfn_index:4;
- uint8_t channel_index:4;
- const mcu_pin_obj_t * pin;
+ uint8_t tim_index : 4;
+ uint8_t altfn_index : 4;
+ uint8_t channel_index : 4;
+ const mcu_pin_obj_t *pin;
} mcu_tim_pin_obj_t;
#define TIM(index, alt, channel, tim_pin) \
-{ \
- .tim_index = index, \
- .altfn_index = alt, \
- .channel_index = channel, \
- .pin = tim_pin, \
-}
+ { \
+ .tim_index = index, \
+ .altfn_index = alt, \
+ .channel_index = channel, \
+ .pin = tim_pin, \
+ }
// F4 Series
// Access Lines
diff --git a/ports/stm/peripherals/pins.h b/ports/stm/peripherals/pins.h
index 358313f56..4a516864b 100644
--- a/ports/stm/peripherals/pins.h
+++ b/ports/stm/peripherals/pins.h
@@ -37,21 +37,21 @@
typedef struct {
mp_obj_base_t base;
- uint8_t port:4;
- uint8_t number:4;
- uint8_t adc_unit:3;
- uint8_t adc_channel:5;
+ uint8_t port : 4;
+ uint8_t number : 4;
+ uint8_t adc_unit : 3;
+ uint8_t adc_channel : 5;
} mcu_pin_obj_t;
-//Standard stm32 adc unit combinations
+// Standard stm32 adc unit combinations
#define ADC_1 1
#define ADC_12 3
#define ADC_123 7
#define ADC_3 4
-//STM32 ADC pins can have a combination of 1, 2 or all 3 ADCs on a single pin,
-//but all 3 ADCs will share the same input number per pin.
-//F4 family has 3 ADC max, 24 channels max.
+// STM32 ADC pins can have a combination of 1, 2 or all 3 ADCs on a single pin,
+// but all 3 ADCs will share the same input number per pin.
+// F4 family has 3 ADC max, 24 channels max.
#define ADC_INPUT(mask, number) \
.adc_unit = mask, \
.adc_channel = number,
@@ -65,12 +65,12 @@ extern const mp_obj_type_t mcu_pin_type;
// STM32 can have up to 9 ports, each restricted to 16 pins
// We split the pin/port evenly, in contrast to nrf.
#define PIN(p_port, p_number, p_adc) \
-{ \
- { &mcu_pin_type }, \
- .port = p_port, \
- .number = p_number, \
- p_adc \
-}
+ { \
+ { &mcu_pin_type }, \
+ .port = p_port, \
+ .number = p_number, \
+ p_adc \
+ }
// Use illegal pin value to mark unassigned pins.
#define NO_PIN 0xff
diff --git a/ports/stm/peripherals/stm32f4/clocks.c b/ports/stm/peripherals/stm32f4/clocks.c
index c2d0a452a..a98b38946 100644
--- a/ports/stm/peripherals/stm32f4/clocks.c
+++ b/ports/stm/peripherals/stm32f4/clocks.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
@@ -66,7 +66,7 @@ void stm32_peripherals_clocks_init(void) {
RCC_OscInitStruct.HSEState = BOARD_HSE_SOURCE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
- RCC_OscInitStruct.PLL.PLLM = HSE_VALUE/1000000;
+ RCC_OscInitStruct.PLL.PLLM = HSE_VALUE / 1000000;
RCC_OscInitStruct.PLL.PLLN = CPY_CLK_PLLN;
RCC_OscInitStruct.PLL.PLLP = CPY_CLK_PLLP;
RCC_OscInitStruct.PLL.PLLQ = CPY_CLK_PLLQ;
@@ -74,10 +74,12 @@ void stm32_peripherals_clocks_init(void) {
RCC_OscInitStruct.PLL.PLLR = 2; // Unused but required by HAL
#endif
- if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
+ if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
// Clock issues are too problematic to even attempt recovery.
// If you end up here, check whether your LSE settings match your board.
- while(1);
+ while (1) {
+ ;
+ }
}
// Configure bus clock sources and divisors
@@ -98,7 +100,7 @@ void stm32_peripherals_clocks_init(void) {
#endif
#if (CPY_CLK_USB_USES_AUDIOPLL)
// Not supported by all lines. Should always result in 48M.
- PeriphClkInitStruct.PLLI2S.PLLI2SM = HSE_VALUE/1000000;
+ PeriphClkInitStruct.PLLI2S.PLLI2SM = HSE_VALUE / 1000000;
PeriphClkInitStruct.PLLI2S.PLLI2SQ = 4;
PeriphClkInitStruct.PLLI2S.PLLI2SN = 192;
PeriphClkInitStruct.PeriphClockSelection |= RCC_PERIPHCLK_CK48;
diff --git a/ports/stm/peripherals/stm32f4/stm32f401xe/clocks.h b/ports/stm/peripherals/stm32f4/stm32f401xe/clocks.h
index d157d944a..72efe82eb 100644
--- a/ports/stm/peripherals/stm32f4/stm32f401xe/clocks.h
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/clocks.h
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c b/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c
index d10fcbb6f..86634cf6c 100644
--- a/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c
@@ -36,9 +36,9 @@ void stm32_peripherals_gpio_init(void) {
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
- //Never reset pins
- never_reset_pin_number(2,14); //PC14 OSC32_IN
- never_reset_pin_number(2,15); //PC15 OSC32_OUT
- never_reset_pin_number(0,13); //PA13 SWDIO
- never_reset_pin_number(0,14); //PA14 SWCLK
+ // Never reset pins
+ never_reset_pin_number(2,14); // PC14 OSC32_IN
+ never_reset_pin_number(2,15); // PC15 OSC32_OUT
+ never_reset_pin_number(0,13); // PA13 SWDIO
+ never_reset_pin_number(0,14); // PA14 SWCLK
}
diff --git a/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c
index 868945ecc..23664999b 100644
--- a/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -31,7 +31,7 @@
// I2C
-I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
+I2C_TypeDef *mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
const mcu_periph_obj_t mcu_i2c_sda_list[5] = {
PERIPH(1, 4, &pin_PB07),
@@ -50,7 +50,7 @@ const mcu_periph_obj_t mcu_i2c_scl_list[4] = {
// SPI
-SPI_TypeDef * mcu_spi_banks[4] = {SPI1, SPI2, SPI3, SPI4};
+SPI_TypeDef *mcu_spi_banks[4] = {SPI1, SPI2, SPI3, SPI4};
const mcu_periph_obj_t mcu_spi_sck_list[9] = {
PERIPH(1, 5, &pin_PA05),
@@ -99,7 +99,7 @@ const mcu_periph_obj_t mcu_spi_nss_list[9] = {
PERIPH(4, 5, &pin_PE11),
};
-USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, NULL, NULL, NULL, USART6};
+USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, NULL, NULL, NULL, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, false, false, false, true};
const mcu_periph_obj_t mcu_uart_tx_list[6] = {
@@ -120,12 +120,12 @@ const mcu_periph_obj_t mcu_uart_rx_list[6] = {
PERIPH(2, 7, &pin_PD06),
};
-//Timers
-//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
-TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL, TIM9, TIM10,
- TIM11, NULL, NULL, NULL};
+// Timers
+// TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL, TIM9, TIM10,
+ TIM11, NULL, NULL, NULL};
-//#define TIM(index, alt, channel, tim_pin)
+// #define TIM(index, alt, channel, tim_pin)
const mcu_tim_pin_obj_t mcu_tim_pin_list[44] = {
TIM(2,1,1,&pin_PA00),
TIM(5,2,1,&pin_PA00),
diff --git a/ports/stm/peripherals/stm32f4/stm32f401xe/periph.h b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.h
index c38e9ea98..9bc47b8bf 100644
--- a/ports/stm/peripherals/stm32f4/stm32f401xe/periph.h
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.h
@@ -27,31 +27,31 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PERIPH_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PERIPH_H
-//I2C
-extern I2C_TypeDef * mcu_i2c_banks[3];
+// I2C
+extern I2C_TypeDef *mcu_i2c_banks[3];
extern const mcu_periph_obj_t mcu_i2c_sda_list[5];
extern const mcu_periph_obj_t mcu_i2c_scl_list[4];
-//SPI
-extern SPI_TypeDef * mcu_spi_banks[4];
+// SPI
+extern SPI_TypeDef *mcu_spi_banks[4];
extern const mcu_periph_obj_t mcu_spi_sck_list[9];
extern const mcu_periph_obj_t mcu_spi_mosi_list[9];
extern const mcu_periph_obj_t mcu_spi_miso_list[8];
extern const mcu_periph_obj_t mcu_spi_nss_list[9];
-//UART
-extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+// UART
+extern USART_TypeDef *mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
extern const mcu_periph_obj_t mcu_uart_tx_list[6];
extern const mcu_periph_obj_t mcu_uart_rx_list[6];
-//Timers
+// Timers
#define TIM_BANK_ARRAY_LEN 14
#define TIM_PIN_ARRAY_LEN 44
-extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN];
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PERIPH_H
diff --git a/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c
index ed89f0de6..a155970bb 100644
--- a/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -34,9 +34,9 @@ const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
-const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); //anti-tamp
-const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); //OSC32_IN
-const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT
+const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); // anti-tamp
+const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); // OSC32_IN
+const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); // OSC32_OUT
const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,10));
const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,11));
@@ -94,9 +94,9 @@ const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
-const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); //SWDIO
-const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); //SWCLK
-const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); //JTDI
+const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); // SWDIO
+const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); // SWCLK
+const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); // JTDI
const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
diff --git a/ports/stm/peripherals/stm32f4/stm32f401xe/pins.h b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.h
index c836df69a..ef804ba09 100644
--- a/ports/stm/peripherals/stm32f4/stm32f401xe/pins.h
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.h
@@ -27,13 +27,13 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PINS_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PINS_H
-//Pins in datasheet order: DocID026289 Rev 7 page 38. LQFP100 only
-//pg 38
+// Pins in datasheet order: DocID026289 Rev 7 page 38. LQFP100 only
+// pg 38
extern const mcu_pin_obj_t pin_PE02;
extern const mcu_pin_obj_t pin_PE03;
extern const mcu_pin_obj_t pin_PE04;
extern const mcu_pin_obj_t pin_PE05;
-//pg 39
+// pg 39
extern const mcu_pin_obj_t pin_PE06;
extern const mcu_pin_obj_t pin_PC13;
extern const mcu_pin_obj_t pin_PC14;
@@ -42,7 +42,7 @@ extern const mcu_pin_obj_t pin_PC00;
extern const mcu_pin_obj_t pin_PC01;
extern const mcu_pin_obj_t pin_PC02;
extern const mcu_pin_obj_t pin_PC03;
-//pg 40
+// pg 40
extern const mcu_pin_obj_t pin_PA00;
extern const mcu_pin_obj_t pin_PA01;
extern const mcu_pin_obj_t pin_PA02;
@@ -51,7 +51,7 @@ extern const mcu_pin_obj_t pin_PA04;
extern const mcu_pin_obj_t pin_PA05;
extern const mcu_pin_obj_t pin_PA06;
extern const mcu_pin_obj_t pin_PA07;
-//pg 41
+// pg 41
extern const mcu_pin_obj_t pin_PC04;
extern const mcu_pin_obj_t pin_PC05;
extern const mcu_pin_obj_t pin_PB00;
@@ -66,7 +66,7 @@ extern const mcu_pin_obj_t pin_PE12;
extern const mcu_pin_obj_t pin_PE13;
extern const mcu_pin_obj_t pin_PE14;
extern const mcu_pin_obj_t pin_PE15;
-//pg 42
+// pg 42
extern const mcu_pin_obj_t pin_PB10;
extern const mcu_pin_obj_t pin_PB12;
extern const mcu_pin_obj_t pin_PB13;
@@ -77,7 +77,7 @@ extern const mcu_pin_obj_t pin_PD09;
extern const mcu_pin_obj_t pin_PD10;
extern const mcu_pin_obj_t pin_PD11;
extern const mcu_pin_obj_t pin_PD12;
-//pg 43
+// pg 43
extern const mcu_pin_obj_t pin_PD13;
extern const mcu_pin_obj_t pin_PD14;
extern const mcu_pin_obj_t pin_PD15;
@@ -87,7 +87,7 @@ extern const mcu_pin_obj_t pin_PC08;
extern const mcu_pin_obj_t pin_PC09;
extern const mcu_pin_obj_t pin_PA08;
extern const mcu_pin_obj_t pin_PA09;
-//pg 44
+// pg 44
extern const mcu_pin_obj_t pin_PA10;
extern const mcu_pin_obj_t pin_PA11;
extern const mcu_pin_obj_t pin_PA12;
@@ -97,7 +97,7 @@ extern const mcu_pin_obj_t pin_PA15;
extern const mcu_pin_obj_t pin_PC10;
extern const mcu_pin_obj_t pin_PC11;
extern const mcu_pin_obj_t pin_PC12;
-//pg 45
+// pg 45
extern const mcu_pin_obj_t pin_PD00;
extern const mcu_pin_obj_t pin_PD01;
extern const mcu_pin_obj_t pin_PD02;
@@ -110,7 +110,7 @@ extern const mcu_pin_obj_t pin_PB03;
extern const mcu_pin_obj_t pin_PB04;
extern const mcu_pin_obj_t pin_PB05;
extern const mcu_pin_obj_t pin_PB06;
-//pg 46
+// pg 46
extern const mcu_pin_obj_t pin_PB07;
extern const mcu_pin_obj_t pin_PB08;
extern const mcu_pin_obj_t pin_PB09;
diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/clocks.h b/ports/stm/peripherals/stm32f4/stm32f405xx/clocks.h
index 87faec035..4239e3318 100644
--- a/ports/stm/peripherals/stm32f4/stm32f405xx/clocks.h
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/clocks.h
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c
index 03fba6289..385766623 100644
--- a/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c
@@ -28,7 +28,7 @@
#include "common-hal/microcontroller/Pin.h"
void stm32_peripherals_gpio_init(void) {
- //Enable all GPIO for now
+ // Enable all GPIO for now
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
@@ -37,12 +37,12 @@ void stm32_peripherals_gpio_init(void) {
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
- //Never reset pins
- never_reset_pin_number(2,13); //PC13 anti tamp
- never_reset_pin_number(2,14); //PC14 OSC32_IN
- never_reset_pin_number(2,15); //PC15 OSC32_OUT
- never_reset_pin_number(0,13); //PA13 SWDIO
- never_reset_pin_number(0,14); //PA14 SWCLK
+ // Never reset pins
+ never_reset_pin_number(2,13); // PC13 anti tamp
+ never_reset_pin_number(2,14); // PC14 OSC32_IN
+ never_reset_pin_number(2,15); // PC15 OSC32_OUT
+ never_reset_pin_number(0,13); // PA13 SWDIO
+ never_reset_pin_number(0,14); // PA14 SWCLK
// never_reset_pin_number(0,15); //PA15 JTDI
// never_reset_pin_number(1,3); //PB3 JTDO
// never_reset_pin_number(1,4); //PB4 JTRST
diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c
index 2f9accbf1..451e4220c 100644
--- a/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -29,7 +29,7 @@
#include "peripherals/pins.h"
#include "peripherals/periph.h"
-I2C_TypeDef * mcu_i2c_banks[I2C_BANK_ARRAY_LEN] = {I2C1, I2C2, I2C3};
+I2C_TypeDef *mcu_i2c_banks[I2C_BANK_ARRAY_LEN] = {I2C1, I2C2, I2C3};
const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN] = {
PERIPH(1, 4, &pin_PB07),
@@ -50,7 +50,7 @@ const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN] = {
PERIPH(3, 4, &pin_PH07),
};
-SPI_TypeDef * mcu_spi_banks[SPI_BANK_ARRAY_LEN] = {SPI1, SPI2, SPI3};
+SPI_TypeDef *mcu_spi_banks[SPI_BANK_ARRAY_LEN] = {SPI1, SPI2, SPI3};
const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN] = {
PERIPH(1, 5, &pin_PA05),
@@ -88,7 +88,7 @@ const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN] = {
PERIPH(3, 6, &pin_PA15),
};
-USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6};
+USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true};
const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN] = {
@@ -120,10 +120,10 @@ const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN] = {
PERIPH(6, 8, &pin_PG09),
};
-//Timers
-//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
-TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
- TIM11, TIM12, TIM13, TIM14};
+// Timers
+// TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
+ TIM11, TIM12, TIM13, TIM14};
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN] = {
TIM(2, 1, 1, &pin_PA00),
@@ -195,8 +195,8 @@ const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN] = {
TIM(8, 3, 3, &pin_PI07),
};
-//SDIO
-SDIO_TypeDef * mcu_sdio_banks[1] = {SDIO};
+// SDIO
+SDIO_TypeDef *mcu_sdio_banks[1] = {SDIO};
const mcu_periph_obj_t mcu_sdio_clock_list[1] = {
PERIPH(1, 12, &pin_PC12),
@@ -217,8 +217,8 @@ const mcu_periph_obj_t mcu_sdio_data3_list[1] = {
PERIPH(1, 12, &pin_PC11),
};
-//CAN
-CAN_TypeDef * mcu_can_banks[2] = {CAN1, CAN2};
+// CAN
+CAN_TypeDef *mcu_can_banks[2] = {CAN1, CAN2};
const mcu_periph_obj_t mcu_can_tx_list[6] = {
PERIPH(1, 9, &pin_PA11),
diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h
index 03198af55..d5433f995 100644
--- a/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h
@@ -27,42 +27,42 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PERIPH_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PERIPH_H
-//I2C
+// I2C
#define I2C_BANK_ARRAY_LEN 3
#define I2C_SDA_ARRAY_LEN 7
#define I2C_SCL_ARRAY_LEN 7
-extern I2C_TypeDef * mcu_i2c_banks[I2C_BANK_ARRAY_LEN];
+extern I2C_TypeDef *mcu_i2c_banks[I2C_BANK_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN];
-//SPI
+// SPI
#define SPI_BANK_ARRAY_LEN 3
#define SPI_SCK_ARRAY_LEN 7
#define SPI_MOSI_ARRAY_LEN 7
#define SPI_MISO_ARRAY_LEN 7
#define SPI_NSS_ARRAY_LEN 6
-extern SPI_TypeDef * mcu_spi_banks[SPI_BANK_ARRAY_LEN];
+extern SPI_TypeDef *mcu_spi_banks[SPI_BANK_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_mosi_list[SPI_MOSI_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_miso_list[SPI_MISO_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN];
-//UART
+// UART
#define UART_TX_ARRAY_LEN 12
#define UART_RX_ARRAY_LEN 12
-extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+extern USART_TypeDef *mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
extern const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN];
-//Timers
+// Timers
#define TIM_BANK_ARRAY_LEN 14
#define TIM_PIN_ARRAY_LEN 67
-extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN];
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
-//SDIO
-extern SDIO_TypeDef * mcu_sdio_banks[1];
+// SDIO
+extern SDIO_TypeDef *mcu_sdio_banks[1];
extern const mcu_periph_obj_t mcu_sdio_clock_list[1];
extern const mcu_periph_obj_t mcu_sdio_command_list[1];
@@ -72,7 +72,7 @@ extern const mcu_periph_obj_t mcu_sdio_data2_list[1];
extern const mcu_periph_obj_t mcu_sdio_data3_list[1];
// CAN
-extern CAN_TypeDef * mcu_can_banks[2];
+extern CAN_TypeDef *mcu_can_banks[2];
extern const mcu_periph_obj_t mcu_can_tx_list[6];
extern const mcu_periph_obj_t mcu_can_rx_list[6];
diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c
index 62acb1955..9fef433ea 100644
--- a/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/clocks.h b/ports/stm/peripherals/stm32f4/stm32f407xx/clocks.h
index 5894b4ae8..28d48e5c1 100644
--- a/ports/stm/peripherals/stm32f4/stm32f407xx/clocks.h
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/clocks.h
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c
index 03fba6289..385766623 100644
--- a/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c
@@ -28,7 +28,7 @@
#include "common-hal/microcontroller/Pin.h"
void stm32_peripherals_gpio_init(void) {
- //Enable all GPIO for now
+ // Enable all GPIO for now
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
@@ -37,12 +37,12 @@ void stm32_peripherals_gpio_init(void) {
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
- //Never reset pins
- never_reset_pin_number(2,13); //PC13 anti tamp
- never_reset_pin_number(2,14); //PC14 OSC32_IN
- never_reset_pin_number(2,15); //PC15 OSC32_OUT
- never_reset_pin_number(0,13); //PA13 SWDIO
- never_reset_pin_number(0,14); //PA14 SWCLK
+ // Never reset pins
+ never_reset_pin_number(2,13); // PC13 anti tamp
+ never_reset_pin_number(2,14); // PC14 OSC32_IN
+ never_reset_pin_number(2,15); // PC15 OSC32_OUT
+ never_reset_pin_number(0,13); // PA13 SWDIO
+ never_reset_pin_number(0,14); // PA14 SWCLK
// never_reset_pin_number(0,15); //PA15 JTDI
// never_reset_pin_number(1,3); //PB3 JTDO
// never_reset_pin_number(1,4); //PB4 JTRST
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/periph.c b/ports/stm/peripherals/stm32f4/stm32f407xx/periph.c
index 2f9accbf1..451e4220c 100644
--- a/ports/stm/peripherals/stm32f4/stm32f407xx/periph.c
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/periph.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -29,7 +29,7 @@
#include "peripherals/pins.h"
#include "peripherals/periph.h"
-I2C_TypeDef * mcu_i2c_banks[I2C_BANK_ARRAY_LEN] = {I2C1, I2C2, I2C3};
+I2C_TypeDef *mcu_i2c_banks[I2C_BANK_ARRAY_LEN] = {I2C1, I2C2, I2C3};
const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN] = {
PERIPH(1, 4, &pin_PB07),
@@ -50,7 +50,7 @@ const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN] = {
PERIPH(3, 4, &pin_PH07),
};
-SPI_TypeDef * mcu_spi_banks[SPI_BANK_ARRAY_LEN] = {SPI1, SPI2, SPI3};
+SPI_TypeDef *mcu_spi_banks[SPI_BANK_ARRAY_LEN] = {SPI1, SPI2, SPI3};
const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN] = {
PERIPH(1, 5, &pin_PA05),
@@ -88,7 +88,7 @@ const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN] = {
PERIPH(3, 6, &pin_PA15),
};
-USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6};
+USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true};
const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN] = {
@@ -120,10 +120,10 @@ const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN] = {
PERIPH(6, 8, &pin_PG09),
};
-//Timers
-//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
-TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
- TIM11, TIM12, TIM13, TIM14};
+// Timers
+// TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
+ TIM11, TIM12, TIM13, TIM14};
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN] = {
TIM(2, 1, 1, &pin_PA00),
@@ -195,8 +195,8 @@ const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN] = {
TIM(8, 3, 3, &pin_PI07),
};
-//SDIO
-SDIO_TypeDef * mcu_sdio_banks[1] = {SDIO};
+// SDIO
+SDIO_TypeDef *mcu_sdio_banks[1] = {SDIO};
const mcu_periph_obj_t mcu_sdio_clock_list[1] = {
PERIPH(1, 12, &pin_PC12),
@@ -217,8 +217,8 @@ const mcu_periph_obj_t mcu_sdio_data3_list[1] = {
PERIPH(1, 12, &pin_PC11),
};
-//CAN
-CAN_TypeDef * mcu_can_banks[2] = {CAN1, CAN2};
+// CAN
+CAN_TypeDef *mcu_can_banks[2] = {CAN1, CAN2};
const mcu_periph_obj_t mcu_can_tx_list[6] = {
PERIPH(1, 9, &pin_PA11),
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/periph.h b/ports/stm/peripherals/stm32f4/stm32f407xx/periph.h
index e6d4526b6..481a8376d 100644
--- a/ports/stm/peripherals/stm32f4/stm32f407xx/periph.h
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/periph.h
@@ -27,42 +27,42 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F407XX_PERIPH_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F407XX_PERIPH_H
-//I2C
+// I2C
#define I2C_BANK_ARRAY_LEN 3
#define I2C_SDA_ARRAY_LEN 7
#define I2C_SCL_ARRAY_LEN 7
-extern I2C_TypeDef * mcu_i2c_banks[I2C_BANK_ARRAY_LEN];
+extern I2C_TypeDef *mcu_i2c_banks[I2C_BANK_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_i2c_sda_list[I2C_SDA_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_i2c_scl_list[I2C_SCL_ARRAY_LEN];
-//SPI
+// SPI
#define SPI_BANK_ARRAY_LEN 3
#define SPI_SCK_ARRAY_LEN 7
#define SPI_MOSI_ARRAY_LEN 7
#define SPI_MISO_ARRAY_LEN 7
#define SPI_NSS_ARRAY_LEN 6
-extern SPI_TypeDef * mcu_spi_banks[SPI_BANK_ARRAY_LEN];
+extern SPI_TypeDef *mcu_spi_banks[SPI_BANK_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_sck_list[SPI_SCK_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_mosi_list[SPI_MOSI_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_miso_list[SPI_MISO_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_spi_nss_list[SPI_NSS_ARRAY_LEN];
-//UART
+// UART
#define UART_TX_ARRAY_LEN 12
#define UART_RX_ARRAY_LEN 12
-extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+extern USART_TypeDef *mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
extern const mcu_periph_obj_t mcu_uart_tx_list[UART_TX_ARRAY_LEN];
extern const mcu_periph_obj_t mcu_uart_rx_list[UART_RX_ARRAY_LEN];
-//Timers
+// Timers
#define TIM_BANK_ARRAY_LEN 14
#define TIM_PIN_ARRAY_LEN 67
-extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN];
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
-//SDIO
-extern SDIO_TypeDef * mcu_sdio_banks[1];
+// SDIO
+extern SDIO_TypeDef *mcu_sdio_banks[1];
extern const mcu_periph_obj_t mcu_sdio_clock_list[1];
extern const mcu_periph_obj_t mcu_sdio_command_list[1];
@@ -72,7 +72,7 @@ extern const mcu_periph_obj_t mcu_sdio_data2_list[1];
extern const mcu_periph_obj_t mcu_sdio_data3_list[1];
// CAN
-extern CAN_TypeDef * mcu_can_banks[2];
+extern CAN_TypeDef *mcu_can_banks[2];
extern const mcu_periph_obj_t mcu_can_tx_list[6];
extern const mcu_periph_obj_t mcu_can_rx_list[6];
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c b/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c
index 62acb1955..9fef433ea 100644
--- a/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h b/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h
index a2fb7bd54..0b38d610c 100644
--- a/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c b/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c
index 08c6b55cd..351607a70 100644
--- a/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c
@@ -29,7 +29,7 @@
#include "common-hal/microcontroller/Pin.h"
void stm32_peripherals_gpio_init(void) {
- //* GPIO Ports Clock Enable */
+ // * GPIO Ports Clock Enable */
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
@@ -37,15 +37,15 @@ void stm32_peripherals_gpio_init(void) {
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
- //Never reset pins
+ // Never reset pins
// TODO: Move this out of peripherals. These helpers shouldn't reference anything CircuitPython
// specific.
- never_reset_pin_number(2,14); //PC14 OSC32_IN
- never_reset_pin_number(2,15); //PC15 OSC32_OUT
+ never_reset_pin_number(2,14); // PC14 OSC32_IN
+ never_reset_pin_number(2,15); // PC15 OSC32_OUT
#if !(BOARD_OVERWRITE_SWD)
- never_reset_pin_number(0,13); //PA13 SWDIO
- never_reset_pin_number(0,14); //PA14 SWCLK
+ never_reset_pin_number(0,13); // PA13 SWDIO
+ never_reset_pin_number(0,14); // PA14 SWCLK
#endif
// Port H is not included in GPIO port array
@@ -53,6 +53,6 @@ void stm32_peripherals_gpio_init(void) {
// never_reset_pin_number(5,1); //PH1 JTRST
}
-//LEDs are inverted on F411 DISCO
+// LEDs are inverted on F411 DISCO
void stm32f4_peripherals_status_led(uint8_t led, uint8_t state) {
}
diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c
index 085663749..dd9cb3d84 100644
--- a/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -31,7 +31,7 @@
// I2C
-I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
+I2C_TypeDef *mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
const mcu_periph_obj_t mcu_i2c_sda_list[7] = {
PERIPH(1, 4, &pin_PB07),
@@ -52,7 +52,7 @@ const mcu_periph_obj_t mcu_i2c_scl_list[4] = {
// SPI
-SPI_TypeDef * mcu_spi_banks[5] = {SPI1, SPI2, SPI3, SPI4, SPI5};
+SPI_TypeDef *mcu_spi_banks[5] = {SPI1, SPI2, SPI3, SPI4, SPI5};
const mcu_periph_obj_t mcu_spi_sck_list[15] = {
PERIPH(1, 5, &pin_PA05),
@@ -119,7 +119,7 @@ const mcu_periph_obj_t mcu_spi_nss_list[12] = {
PERIPH(5, 6, &pin_PE11)
};
-USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, NULL, NULL, NULL, USART6};
+USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, NULL, NULL, NULL, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, false, false, false, true};
const mcu_periph_obj_t mcu_uart_tx_list[7] = {
@@ -142,10 +142,10 @@ const mcu_periph_obj_t mcu_uart_rx_list[7] = {
PERIPH(2, 7, &pin_PD06),
};
-//Timers
-//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
-TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL, TIM9, TIM10,
- TIM11, NULL, NULL, NULL};
+// Timers
+// TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL, TIM9, TIM10,
+ TIM11, NULL, NULL, NULL};
const mcu_tim_pin_obj_t mcu_tim_pin_list[44] = {
TIM(2,1,1,&pin_PA00),
diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/periph.h b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.h
index f78cb57a7..52fc1961a 100644
--- a/ports/stm/peripherals/stm32f4/stm32f411xe/periph.h
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.h
@@ -27,31 +27,31 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PERIPH_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PERIPH_H
-//I2C
-extern I2C_TypeDef * mcu_i2c_banks[3];
+// I2C
+extern I2C_TypeDef *mcu_i2c_banks[3];
extern const mcu_periph_obj_t mcu_i2c_sda_list[7];
extern const mcu_periph_obj_t mcu_i2c_scl_list[4];
-//SPI
-extern SPI_TypeDef * mcu_spi_banks[5];
+// SPI
+extern SPI_TypeDef *mcu_spi_banks[5];
extern const mcu_periph_obj_t mcu_spi_sck_list[15];
extern const mcu_periph_obj_t mcu_spi_mosi_list[14];
extern const mcu_periph_obj_t mcu_spi_miso_list[12];
extern const mcu_periph_obj_t mcu_spi_nss_list[12];
-//UART
-extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+// UART
+extern USART_TypeDef *mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
extern const mcu_periph_obj_t mcu_uart_tx_list[7];
extern const mcu_periph_obj_t mcu_uart_rx_list[7];
-//Timers
+// Timers
#define TIM_BANK_ARRAY_LEN 14
#define TIM_PIN_ARRAY_LEN 44
-extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN];
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PERIPH_H
diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c
index ed89f0de6..a155970bb 100644
--- a/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -34,9 +34,9 @@ const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
-const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); //anti-tamp
-const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); //OSC32_IN
-const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT
+const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); // anti-tamp
+const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); // OSC32_IN
+const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); // OSC32_OUT
const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,10));
const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,11));
@@ -94,9 +94,9 @@ const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
-const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); //SWDIO
-const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); //SWCLK
-const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); //JTDI
+const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); // SWDIO
+const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); // SWCLK
+const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); // JTDI
const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/pins.h b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.h
index b6c18b02e..00e7cf1b4 100644
--- a/ports/stm/peripherals/stm32f4/stm32f411xe/pins.h
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.h
@@ -27,13 +27,13 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PINS_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PINS_H
-//Pins in datasheet order: DocID026289 Rev 7 page 38. LQFP100 only
-//pg 38
+// Pins in datasheet order: DocID026289 Rev 7 page 38. LQFP100 only
+// pg 38
extern const mcu_pin_obj_t pin_PE02;
extern const mcu_pin_obj_t pin_PE03;
extern const mcu_pin_obj_t pin_PE04;
extern const mcu_pin_obj_t pin_PE05;
-//pg 39
+// pg 39
extern const mcu_pin_obj_t pin_PE06;
extern const mcu_pin_obj_t pin_PC13;
extern const mcu_pin_obj_t pin_PC14;
@@ -42,7 +42,7 @@ extern const mcu_pin_obj_t pin_PC00;
extern const mcu_pin_obj_t pin_PC01;
extern const mcu_pin_obj_t pin_PC02;
extern const mcu_pin_obj_t pin_PC03;
-//pg 40
+// pg 40
extern const mcu_pin_obj_t pin_PA00;
extern const mcu_pin_obj_t pin_PA01;
extern const mcu_pin_obj_t pin_PA02;
@@ -51,7 +51,7 @@ extern const mcu_pin_obj_t pin_PA04;
extern const mcu_pin_obj_t pin_PA05;
extern const mcu_pin_obj_t pin_PA06;
extern const mcu_pin_obj_t pin_PA07;
-//pg 41
+// pg 41
extern const mcu_pin_obj_t pin_PC04;
extern const mcu_pin_obj_t pin_PC05;
extern const mcu_pin_obj_t pin_PB00;
@@ -66,7 +66,7 @@ extern const mcu_pin_obj_t pin_PE12;
extern const mcu_pin_obj_t pin_PE13;
extern const mcu_pin_obj_t pin_PE14;
extern const mcu_pin_obj_t pin_PE15;
-//pg 42
+// pg 42
extern const mcu_pin_obj_t pin_PB10;
extern const mcu_pin_obj_t pin_PB12;
extern const mcu_pin_obj_t pin_PB13;
@@ -77,7 +77,7 @@ extern const mcu_pin_obj_t pin_PD09;
extern const mcu_pin_obj_t pin_PD10;
extern const mcu_pin_obj_t pin_PD11;
extern const mcu_pin_obj_t pin_PD12;
-//pg 43
+// pg 43
extern const mcu_pin_obj_t pin_PD13;
extern const mcu_pin_obj_t pin_PD14;
extern const mcu_pin_obj_t pin_PD15;
@@ -87,7 +87,7 @@ extern const mcu_pin_obj_t pin_PC08;
extern const mcu_pin_obj_t pin_PC09;
extern const mcu_pin_obj_t pin_PA08;
extern const mcu_pin_obj_t pin_PA09;
-//pg 44
+// pg 44
extern const mcu_pin_obj_t pin_PA10;
extern const mcu_pin_obj_t pin_PA11;
extern const mcu_pin_obj_t pin_PA12;
@@ -97,7 +97,7 @@ extern const mcu_pin_obj_t pin_PA15;
extern const mcu_pin_obj_t pin_PC10;
extern const mcu_pin_obj_t pin_PC11;
extern const mcu_pin_obj_t pin_PC12;
-//pg 45
+// pg 45
extern const mcu_pin_obj_t pin_PD00;
extern const mcu_pin_obj_t pin_PD01;
extern const mcu_pin_obj_t pin_PD02;
@@ -110,7 +110,7 @@ extern const mcu_pin_obj_t pin_PB03;
extern const mcu_pin_obj_t pin_PB04;
extern const mcu_pin_obj_t pin_PB05;
extern const mcu_pin_obj_t pin_PB06;
-//pg 46
+// pg 46
extern const mcu_pin_obj_t pin_PB07;
extern const mcu_pin_obj_t pin_PB08;
extern const mcu_pin_obj_t pin_PB09;
diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/clocks.h b/ports/stm/peripherals/stm32f4/stm32f412zx/clocks.h
index e1355c8f3..acd353793 100644
--- a/ports/stm/peripherals/stm32f4/stm32f412zx/clocks.h
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/clocks.h
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c
index 5ca4667a4..6fe7bbb9c 100644
--- a/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c
@@ -38,15 +38,15 @@ void stm32_peripherals_gpio_init(void) {
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
- //Never reset pins
- never_reset_pin_number(2,13); //PC13 anti tamp
- never_reset_pin_number(2,14); //PC14 OSC32_IN
- never_reset_pin_number(2,15); //PC15 OSC32_OUT
- never_reset_pin_number(0,13); //PA13 SWDIO
- never_reset_pin_number(0,14); //PA14 SWCLK
- //never_reset_pin_number(0,15); //PA15 JTDI
- //never_reset_pin_number(1,3); //PB3 JTDO
- //never_reset_pin_number(1,4); //PB4 JTRST
+ // Never reset pins
+ never_reset_pin_number(2,13); // PC13 anti tamp
+ never_reset_pin_number(2,14); // PC14 OSC32_IN
+ never_reset_pin_number(2,15); // PC15 OSC32_OUT
+ never_reset_pin_number(0,13); // PA13 SWDIO
+ never_reset_pin_number(0,14); // PA14 SWCLK
+ // never_reset_pin_number(0,15); //PA15 JTDI
+ // never_reset_pin_number(1,3); //PB3 JTDO
+ // never_reset_pin_number(1,4); //PB4 JTRST
// Port H is not included in GPIO port array
// never_reset_pin_number(5,0); //PH0 JTDO
diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c
index e92c88ce5..8cd61fd49 100644
--- a/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -31,12 +31,12 @@
// I2C
-I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
+I2C_TypeDef *mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
const mcu_periph_obj_t mcu_i2c_sda_list[8] = {
PERIPH(1, 4, &pin_PB07),
PERIPH(1, 4, &pin_PB09),
- PERIPH(2, 4, &pin_PB11), //not on LQFP100
+ PERIPH(2, 4, &pin_PB11), // not on LQFP100
PERIPH(2, 9, &pin_PB09),
PERIPH(2, 9, &pin_PB03),
PERIPH(3, 4, &pin_PC09),
@@ -53,7 +53,7 @@ const mcu_periph_obj_t mcu_i2c_scl_list[4] = {
// SPI
-SPI_TypeDef * mcu_spi_banks[5] = {SPI1, SPI2, SPI3, SPI4, SPI5};
+SPI_TypeDef *mcu_spi_banks[5] = {SPI1, SPI2, SPI3, SPI4, SPI5};
const mcu_periph_obj_t mcu_spi_sck_list[15] = {
PERIPH(1, 5, &pin_PA05),
@@ -120,9 +120,9 @@ const mcu_periph_obj_t mcu_spi_nss_list[12] = {
PERIPH(5, 6, &pin_PE11)
};
-//UART
+// UART
-USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, NULL, NULL, USART6};
+USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, NULL, NULL, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true};
const mcu_periph_obj_t mcu_uart_tx_list[11] = {
@@ -154,10 +154,10 @@ const mcu_periph_obj_t mcu_uart_rx_list[12] = {
PERIPH(6, 8, &pin_PG09),
};
-//Timers
-//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
-TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
- TIM11, TIM12, TIM13, TIM14};
+// Timers
+// TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
+ TIM11, TIM12, TIM13, TIM14};
const mcu_tim_pin_obj_t mcu_tim_pin_list[60] = {
TIM(2,1,1,&pin_PA00),
diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/periph.h b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.h
index 40afd27f4..4e861da5d 100644
--- a/ports/stm/peripherals/stm32f4/stm32f412zx/periph.h
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.h
@@ -27,32 +27,32 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PERIPH_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PERIPH_H
-//I2C
-extern I2C_TypeDef * mcu_i2c_banks[3];
+// I2C
+extern I2C_TypeDef *mcu_i2c_banks[3];
extern const mcu_periph_obj_t mcu_i2c_sda_list[8];
extern const mcu_periph_obj_t mcu_i2c_scl_list[4];
-//SPI
-extern SPI_TypeDef * mcu_spi_banks[5];
+// SPI
+extern SPI_TypeDef *mcu_spi_banks[5];
extern const mcu_periph_obj_t mcu_spi_sck_list[15];
extern const mcu_periph_obj_t mcu_spi_mosi_list[14];
extern const mcu_periph_obj_t mcu_spi_miso_list[12];
extern const mcu_periph_obj_t mcu_spi_nss_list[12];
-//UART
-extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+// UART
+extern USART_TypeDef *mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
extern const mcu_periph_obj_t mcu_uart_tx_list[11];
extern const mcu_periph_obj_t mcu_uart_rx_list[12];
-//Timers
+// Timers
#define TIM_BANK_ARRAY_LEN 14
#define TIM_PIN_ARRAY_LEN 60
-extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN];
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PERIPH_H
diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c
index c1b624f4d..4fa70b5bd 100644
--- a/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -34,9 +34,9 @@ const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
-const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); //anti-tamp
-const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); //OSC32_IN
-const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT
+const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); // anti-tamp
+const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); // OSC32_IN
+const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); // OSC32_OUT
const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC); // 144 only
const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC); // 144 only
diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/pins.h b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.h
index 8914530d2..18e25f3f5 100644
--- a/ports/stm/peripherals/stm32f4/stm32f412zx/pins.h
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.h
@@ -27,7 +27,7 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PINS_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PINS_H
-//pg 50
+// pg 50
extern const mcu_pin_obj_t pin_PE02;
extern const mcu_pin_obj_t pin_PE03;
extern const mcu_pin_obj_t pin_PE04;
@@ -35,7 +35,7 @@ extern const mcu_pin_obj_t pin_PE05;
extern const mcu_pin_obj_t pin_PE06;
extern const mcu_pin_obj_t pin_PC13;
extern const mcu_pin_obj_t pin_PC14;
-//pg 51
+// pg 51
extern const mcu_pin_obj_t pin_PC15;
extern const mcu_pin_obj_t pin_PF00; // 144 only
extern const mcu_pin_obj_t pin_PF01; // 144 only
@@ -48,7 +48,7 @@ extern const mcu_pin_obj_t pin_PF07; // 144 only
extern const mcu_pin_obj_t pin_PF08; // 144 only
extern const mcu_pin_obj_t pin_PF09; // 144 only
extern const mcu_pin_obj_t pin_PF10; // 144 only
-//pg 52
+// pg 52
extern const mcu_pin_obj_t pin_PC00;
extern const mcu_pin_obj_t pin_PC01;
extern const mcu_pin_obj_t pin_PC02;
@@ -56,14 +56,14 @@ extern const mcu_pin_obj_t pin_PC03;
extern const mcu_pin_obj_t pin_PA00;
extern const mcu_pin_obj_t pin_PA01;
extern const mcu_pin_obj_t pin_PA02;
-//pg 53
+// pg 53
extern const mcu_pin_obj_t pin_PA03;
extern const mcu_pin_obj_t pin_PA04;
extern const mcu_pin_obj_t pin_PA05;
extern const mcu_pin_obj_t pin_PA06;
extern const mcu_pin_obj_t pin_PA07;
extern const mcu_pin_obj_t pin_PC04;
-//pg 54
+// pg 54
extern const mcu_pin_obj_t pin_PC05;
extern const mcu_pin_obj_t pin_PB00;
extern const mcu_pin_obj_t pin_PB01;
@@ -75,7 +75,7 @@ extern const mcu_pin_obj_t pin_PF14; // 144 only
extern const mcu_pin_obj_t pin_PF15; // 144 only
extern const mcu_pin_obj_t pin_PG00; // 144 only
extern const mcu_pin_obj_t pin_PG01; // 144 only
-//pg 55
+// pg 55
extern const mcu_pin_obj_t pin_PE07;
extern const mcu_pin_obj_t pin_PE08;
extern const mcu_pin_obj_t pin_PE09;
@@ -84,13 +84,13 @@ extern const mcu_pin_obj_t pin_PE11;
extern const mcu_pin_obj_t pin_PE12;
extern const mcu_pin_obj_t pin_PE13;
extern const mcu_pin_obj_t pin_PE14;
-//pg 56
+// pg 56
extern const mcu_pin_obj_t pin_PE15;
extern const mcu_pin_obj_t pin_PB10;
extern const mcu_pin_obj_t pin_PB11; // 144 only
extern const mcu_pin_obj_t pin_PB12;
extern const mcu_pin_obj_t pin_PB13;
-//pg 57
+// pg 57
extern const mcu_pin_obj_t pin_PB14;
extern const mcu_pin_obj_t pin_PB15;
extern const mcu_pin_obj_t pin_PD08;
@@ -98,7 +98,7 @@ extern const mcu_pin_obj_t pin_PD09;
extern const mcu_pin_obj_t pin_PD10;
extern const mcu_pin_obj_t pin_PD11;
extern const mcu_pin_obj_t pin_PD12;
-//pg 58
+// pg 58
extern const mcu_pin_obj_t pin_PD13;
extern const mcu_pin_obj_t pin_PD14;
extern const mcu_pin_obj_t pin_PD15;
@@ -109,7 +109,7 @@ extern const mcu_pin_obj_t pin_PG05; // 144 only
extern const mcu_pin_obj_t pin_PG06; // 144 only
extern const mcu_pin_obj_t pin_PG07; // 144 only
extern const mcu_pin_obj_t pin_PG08; // 144 only
-//pg 59
+// pg 59
extern const mcu_pin_obj_t pin_PC06;
extern const mcu_pin_obj_t pin_PC07;
extern const mcu_pin_obj_t pin_PC08;
@@ -117,7 +117,7 @@ extern const mcu_pin_obj_t pin_PC09;
extern const mcu_pin_obj_t pin_PA08;
extern const mcu_pin_obj_t pin_PA09;
extern const mcu_pin_obj_t pin_PA10;
-//pg 60
+// pg 60
extern const mcu_pin_obj_t pin_PA11;
extern const mcu_pin_obj_t pin_PA12;
extern const mcu_pin_obj_t pin_PA13;
@@ -125,7 +125,7 @@ extern const mcu_pin_obj_t pin_PA14;
extern const mcu_pin_obj_t pin_PA15;
extern const mcu_pin_obj_t pin_PC10;
extern const mcu_pin_obj_t pin_PC11;
-//pg 61
+// pg 61
extern const mcu_pin_obj_t pin_PC12;
extern const mcu_pin_obj_t pin_PD00;
extern const mcu_pin_obj_t pin_PD01;
@@ -135,7 +135,7 @@ extern const mcu_pin_obj_t pin_PD04;
extern const mcu_pin_obj_t pin_PD05;
extern const mcu_pin_obj_t pin_PD06;
extern const mcu_pin_obj_t pin_PD07;
-//pg 62
+// pg 62
extern const mcu_pin_obj_t pin_PG09; // 144 only
extern const mcu_pin_obj_t pin_PG10; // 144 only
extern const mcu_pin_obj_t pin_PG11; // 144 only
@@ -145,7 +145,7 @@ extern const mcu_pin_obj_t pin_PG14; // 144 only
extern const mcu_pin_obj_t pin_PG15; // 144 only
extern const mcu_pin_obj_t pin_PB03;
extern const mcu_pin_obj_t pin_PB04;
-//pg 63
+// pg 63
extern const mcu_pin_obj_t pin_PB05;
extern const mcu_pin_obj_t pin_PB06;
extern const mcu_pin_obj_t pin_PB07;
diff --git a/ports/stm/peripherals/stm32f7/clocks.c b/ports/stm/peripherals/stm32f7/clocks.c
index f13088782..3767d223c 100644
--- a/ports/stm/peripherals/stm32f7/clocks.c
+++ b/ports/stm/peripherals/stm32f7/clocks.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
@@ -61,15 +61,17 @@ void stm32_peripherals_clocks_init(void) {
RCC_OscInitStruct.HSEState = BOARD_HSE_SOURCE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
- RCC_OscInitStruct.PLL.PLLM = HSE_VALUE/1000000;
+ RCC_OscInitStruct.PLL.PLLM = HSE_VALUE / 1000000;
RCC_OscInitStruct.PLL.PLLN = CPY_CLK_PLLN;
RCC_OscInitStruct.PLL.PLLP = CPY_CLK_PLLP;
RCC_OscInitStruct.PLL.PLLQ = CPY_CLK_PLLQ;
- if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
+ if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
// Clock issues are too problematic to even attempt recovery.
// If you end up here, check whether your LSE settings match your board.
- while(1);
+ while (1) {
+ ;
+ }
}
/* Activate the OverDrive to reach the 216 MHz Frequency */
diff --git a/ports/stm/peripherals/stm32f7/stm32f746xx/gpio.c b/ports/stm/peripherals/stm32f7/stm32f746xx/gpio.c
index ca64428eb..b7cc0aad6 100644
--- a/ports/stm/peripherals/stm32f7/stm32f746xx/gpio.c
+++ b/ports/stm/peripherals/stm32f7/stm32f746xx/gpio.c
@@ -29,7 +29,7 @@
#include "common-hal/microcontroller/Pin.h"
void stm32_peripherals_gpio_init(void) {
- //Enable all GPIO for now
+ // Enable all GPIO for now
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
@@ -42,11 +42,11 @@ void stm32_peripherals_gpio_init(void) {
__HAL_RCC_GPIOJ_CLK_ENABLE();
__HAL_RCC_GPIOK_CLK_ENABLE();
- //Never reset pins
- never_reset_pin_number(2,14); //PC14 OSC32_IN
- never_reset_pin_number(2,15); //PC15 OSC32_OUT
- never_reset_pin_number(0,13); //PA13 SWDIO
- never_reset_pin_number(0,14); //PA14 SWCLK
- never_reset_pin_number(7,0); //PH0 OSC_IN
- never_reset_pin_number(7,1); //PH1 OSC_OUT
+ // Never reset pins
+ never_reset_pin_number(2,14); // PC14 OSC32_IN
+ never_reset_pin_number(2,15); // PC15 OSC32_OUT
+ never_reset_pin_number(0,13); // PA13 SWDIO
+ never_reset_pin_number(0,14); // PA14 SWCLK
+ never_reset_pin_number(7,0); // PH0 OSC_IN
+ never_reset_pin_number(7,1); // PH1 OSC_OUT
}
diff --git a/ports/stm/peripherals/stm32f7/stm32f746xx/periph.c b/ports/stm/peripherals/stm32f7/stm32f746xx/periph.c
index 0c3391239..89cd7e27e 100644
--- a/ports/stm/peripherals/stm32f7/stm32f746xx/periph.c
+++ b/ports/stm/peripherals/stm32f7/stm32f746xx/periph.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -32,7 +32,7 @@
// I2C
-I2C_TypeDef * mcu_i2c_banks[4] = {I2C1, I2C2, I2C3, I2C4};
+I2C_TypeDef *mcu_i2c_banks[4] = {I2C1, I2C2, I2C3, I2C4};
const mcu_periph_obj_t mcu_i2c_sda_list[10] = {
PERIPH(1, 4, &pin_PB07),
@@ -59,9 +59,9 @@ const mcu_periph_obj_t mcu_i2c_scl_list[10] = {
PERIPH(4, 4, &pin_PH11),
};
-//SPI
+// SPI
-SPI_TypeDef * mcu_spi_banks[6] = {SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
+SPI_TypeDef *mcu_spi_banks[6] = {SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
const mcu_periph_obj_t mcu_spi_sck_list[14] = {
PERIPH(1, 5, &pin_PA05),
@@ -111,9 +111,9 @@ const mcu_periph_obj_t mcu_spi_miso_list[12] = {
PERIPH(2, 5, &pin_PI02),
};
-//UART
+// UART
-USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6, UART7, UART8};
+USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6, UART7, UART8};
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, true, true, true, true, true};
const mcu_periph_obj_t mcu_uart_tx_list[15] = {
@@ -151,10 +151,10 @@ const mcu_periph_obj_t mcu_uart_rx_list[15] = {
PERIPH(6, 8, &pin_PG09),
};
-//Timers
-//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
-TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
- TIM11, TIM12, TIM13, TIM14};
+// Timers
+// TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
+ TIM11, TIM12, TIM13, TIM14};
const mcu_tim_pin_obj_t mcu_tim_pin_list[55] = {
TIM(2, 1, 1, &pin_PA00),
diff --git a/ports/stm/peripherals/stm32f7/stm32f746xx/periph.h b/ports/stm/peripherals/stm32f7/stm32f746xx/periph.h
index f20896e22..425221f64 100644
--- a/ports/stm/peripherals/stm32f7/stm32f746xx/periph.h
+++ b/ports/stm/peripherals/stm32f7/stm32f746xx/periph.h
@@ -28,30 +28,30 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F746XX_PERIPH_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F746XX_PERIPH_H
-//I2C
-extern I2C_TypeDef * mcu_i2c_banks[4];
+// I2C
+extern I2C_TypeDef *mcu_i2c_banks[4];
extern const mcu_periph_obj_t mcu_i2c_sda_list[10];
extern const mcu_periph_obj_t mcu_i2c_scl_list[10];
-//SPI
-extern SPI_TypeDef * mcu_spi_banks[6];
+// SPI
+extern SPI_TypeDef *mcu_spi_banks[6];
extern const mcu_periph_obj_t mcu_spi_sck_list[14];
extern const mcu_periph_obj_t mcu_spi_mosi_list[15];
extern const mcu_periph_obj_t mcu_spi_miso_list[12];
-//UART
-extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+// UART
+extern USART_TypeDef *mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
extern const mcu_periph_obj_t mcu_uart_tx_list[15];
extern const mcu_periph_obj_t mcu_uart_rx_list[15];
-//Timers
+// Timers
#define TIM_BANK_ARRAY_LEN 14
#define TIM_PIN_ARRAY_LEN 55
-extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN];
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
diff --git a/ports/stm/peripherals/stm32f7/stm32f746xx/pins.c b/ports/stm/peripherals/stm32f7/stm32f746xx/pins.c
index ae940c1a0..0a2682528 100644
--- a/ports/stm/peripherals/stm32f7/stm32f746xx/pins.c
+++ b/ports/stm/peripherals/stm32f7/stm32f746xx/pins.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c b/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c
index 1189948c7..f89af2714 100644
--- a/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c
@@ -28,7 +28,7 @@
#include "common-hal/microcontroller/Pin.h"
void stm32_peripherals_gpio_init(void) {
- //Enable all GPIO for now
+ // Enable all GPIO for now
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
@@ -38,9 +38,9 @@ void stm32_peripherals_gpio_init(void) {
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
- //Never reset pins
- never_reset_pin_number(2,14); //PC14 OSC32_IN
- never_reset_pin_number(2,15); //PC15 OSC32_OUT
- never_reset_pin_number(0,13); //PA13 SWDIO
- never_reset_pin_number(0,14); //PA14 SWCLK
+ // Never reset pins
+ never_reset_pin_number(2,14); // PC14 OSC32_IN
+ never_reset_pin_number(2,15); // PC15 OSC32_OUT
+ never_reset_pin_number(0,13); // PA13 SWDIO
+ never_reset_pin_number(0,14); // PA14 SWCLK
}
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/periph.c b/ports/stm/peripherals/stm32f7/stm32f767xx/periph.c
index 07d226db3..b1ac71248 100644
--- a/ports/stm/peripherals/stm32f7/stm32f767xx/periph.c
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/periph.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -31,7 +31,7 @@
// I2C
-I2C_TypeDef * mcu_i2c_banks[4] = {I2C1, I2C2, I2C3, I2C4};
+I2C_TypeDef *mcu_i2c_banks[4] = {I2C1, I2C2, I2C3, I2C4};
const mcu_periph_obj_t mcu_i2c_sda_list[12] = {
PERIPH(1, 4, &pin_PB07),
@@ -62,9 +62,9 @@ const mcu_periph_obj_t mcu_i2c_scl_list[12] = {
PERIPH(4, 4, &pin_PH11),
};
-//SPI
+// SPI
-SPI_TypeDef * mcu_spi_banks[6] = {SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
+SPI_TypeDef *mcu_spi_banks[6] = {SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
const mcu_periph_obj_t mcu_spi_sck_list[18] = {
PERIPH(1, 5, &pin_PA05),
@@ -124,9 +124,9 @@ const mcu_periph_obj_t mcu_spi_miso_list[15] = {
PERIPH(2, 5, &pin_PI02),
};
-//UART
+// UART
-USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6, UART7, UART8};
+USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6, UART7, UART8};
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, true, true, true, true, true};
const mcu_periph_obj_t mcu_uart_tx_list[24] = {
@@ -183,11 +183,11 @@ const mcu_periph_obj_t mcu_uart_rx_list[25] = {
PERIPH(4, 8, &pin_PI09),
};
-//Timers
-//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
-//TODO: H7 has more timers than this, but are they tied to pins?
-TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, NULL, NULL,
- NULL, TIM12, TIM13, TIM14};
+// Timers
+// TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+// TODO: H7 has more timers than this, but are they tied to pins?
+TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, NULL, NULL,
+ NULL, TIM12, TIM13, TIM14};
const mcu_tim_pin_obj_t mcu_tim_pin_list[55] = {
TIM(2, 1, 1, &pin_PA00),
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/periph.h b/ports/stm/peripherals/stm32f7/stm32f767xx/periph.h
index 70f03f258..ea4797634 100644
--- a/ports/stm/peripherals/stm32f7/stm32f767xx/periph.h
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/periph.h
@@ -27,30 +27,30 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F767XX_PERIPH_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F767XX_PERIPH_H
-//I2C
-extern I2C_TypeDef * mcu_i2c_banks[4];
+// I2C
+extern I2C_TypeDef *mcu_i2c_banks[4];
extern const mcu_periph_obj_t mcu_i2c_sda_list[12];
extern const mcu_periph_obj_t mcu_i2c_scl_list[12];
-//SPI
-extern SPI_TypeDef * mcu_spi_banks[6];
+// SPI
+extern SPI_TypeDef *mcu_spi_banks[6];
extern const mcu_periph_obj_t mcu_spi_sck_list[18];
extern const mcu_periph_obj_t mcu_spi_mosi_list[18];
extern const mcu_periph_obj_t mcu_spi_miso_list[15];
-//UART
-extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+// UART
+extern USART_TypeDef *mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
extern const mcu_periph_obj_t mcu_uart_tx_list[24];
extern const mcu_periph_obj_t mcu_uart_rx_list[25];
-//Timers
+// Timers
#define TIM_BANK_ARRAY_LEN 14
#define TIM_PIN_ARRAY_LEN 55
-extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN];
extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/pins.c b/ports/stm/peripherals/stm32f7/stm32f767xx/pins.c
index 5c9daea98..67814c6b7 100644
--- a/ports/stm/peripherals/stm32f7/stm32f767xx/pins.c
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/pins.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/stm32h7/clocks.c b/ports/stm/peripherals/stm32h7/clocks.c
index a088f78bf..5fde5af6c 100644
--- a/ports/stm/peripherals/stm32h7/clocks.c
+++ b/ports/stm/peripherals/stm32h7/clocks.c
@@ -41,7 +41,8 @@ void stm32_peripherals_clocks_init(void) {
// Set voltage scaling in accordance with system clock speed
HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
__HAL_PWR_VOLTAGESCALING_CONFIG(CPY_CLK_VSCALE);
- while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
+ while (!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {
+ }
// Configure LSE Drive
HAL_PWR_EnableBkUpAccess();
@@ -63,7 +64,7 @@ void stm32_peripherals_clocks_init(void) {
RCC_OscInitStruct.HSEState = BOARD_HSE_SOURCE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
- RCC_OscInitStruct.PLL.PLLM = HSE_VALUE/2000000;
+ RCC_OscInitStruct.PLL.PLLM = HSE_VALUE / 2000000;
RCC_OscInitStruct.PLL.PLLN = CPY_CLK_PLLN;
RCC_OscInitStruct.PLL.PLLP = CPY_CLK_PLLP;
RCC_OscInitStruct.PLL.PLLQ = CPY_CLK_PLLQ;
@@ -71,16 +72,18 @@ void stm32_peripherals_clocks_init(void) {
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_1;
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
RCC_OscInitStruct.PLL.PLLFRACN = 0;
- if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
+ if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
// Clock issues are too problematic to even attempt recovery.
// If you end up here, check whether your LSE settings match your board.
- while(1);
+ while (1) {
+ ;
+ }
}
// Configure bus clock sources and divisors
- RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
- |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
- |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1;
+ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
+ | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2
+ | RCC_CLOCKTYPE_D3PCLK1 | RCC_CLOCKTYPE_D1PCLK1;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.AHBCLKDivider = CPY_CLK_AHBDIV;
@@ -92,8 +95,8 @@ void stm32_peripherals_clocks_init(void) {
// Set up non-bus peripherals
// TODO: I2S settings go here
- PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_USART3
- |RCC_PERIPHCLK_USB;
+ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USART3
+ | RCC_PERIPHCLK_USB;
#if (BOARD_HAS_LOW_SPEED_CRYSTAL)
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
#else
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c b/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c
index 1189948c7..f89af2714 100644
--- a/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c
@@ -28,7 +28,7 @@
#include "common-hal/microcontroller/Pin.h"
void stm32_peripherals_gpio_init(void) {
- //Enable all GPIO for now
+ // Enable all GPIO for now
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
@@ -38,9 +38,9 @@ void stm32_peripherals_gpio_init(void) {
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
- //Never reset pins
- never_reset_pin_number(2,14); //PC14 OSC32_IN
- never_reset_pin_number(2,15); //PC15 OSC32_OUT
- never_reset_pin_number(0,13); //PA13 SWDIO
- never_reset_pin_number(0,14); //PA14 SWCLK
+ // Never reset pins
+ never_reset_pin_number(2,14); // PC14 OSC32_IN
+ never_reset_pin_number(2,15); // PC15 OSC32_OUT
+ never_reset_pin_number(0,13); // PA13 SWDIO
+ never_reset_pin_number(0,14); // PA14 SWCLK
}
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/periph.c b/ports/stm/peripherals/stm32h7/stm32h743xx/periph.c
index 892164600..bf8248f76 100644
--- a/ports/stm/peripherals/stm32h7/stm32h743xx/periph.c
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/periph.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
@@ -31,7 +31,7 @@
// I2C
-I2C_TypeDef * mcu_i2c_banks[4] = {I2C1, I2C2, I2C3, I2C4};
+I2C_TypeDef *mcu_i2c_banks[4] = {I2C1, I2C2, I2C3, I2C4};
const mcu_periph_obj_t mcu_i2c_sda_list[12] = {
PERIPH(1, 4, &pin_PB07),
@@ -65,7 +65,7 @@ const mcu_periph_obj_t mcu_i2c_scl_list[12] = {
// SPI
-SPI_TypeDef * mcu_spi_banks[6] = {SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
+SPI_TypeDef *mcu_spi_banks[6] = {SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
const mcu_periph_obj_t mcu_spi_sck_list[19] = {
PERIPH(1, 5, &pin_PA05),
@@ -130,9 +130,9 @@ const mcu_periph_obj_t mcu_spi_miso_list[16] = {
PERIPH(5, 5, &pin_PJ11),
};
-//UART
+// UART
-USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6, UART7, UART8};
+USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6, UART7, UART8};
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, true, true, true, true, true};
const mcu_periph_obj_t mcu_uart_tx_list[25] = {
@@ -192,11 +192,11 @@ const mcu_periph_obj_t mcu_uart_rx_list[26] = {
PERIPH(8, 8, &pin_PJ09),
};
-//Timers
-//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
-//TODO: H7 has more timers than this, but are they tied to pins?
-TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, NULL, NULL,
- NULL, TIM12, TIM13, TIM14};
+// Timers
+// TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+// TODO: H7 has more timers than this, but are they tied to pins?
+TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, NULL, NULL,
+ NULL, TIM12, TIM13, TIM14};
const mcu_tim_pin_obj_t mcu_tim_pin_list[58] = {
TIM(2, 1, 1, &pin_PA00),
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/periph.h b/ports/stm/peripherals/stm32h7/stm32h743xx/periph.h
index e3902e7c7..3716a0f82 100644
--- a/ports/stm/peripherals/stm32h7/stm32h743xx/periph.h
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/periph.h
@@ -27,29 +27,29 @@
#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PERIPH_H
#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PERIPH_H
-//I2C
-extern I2C_TypeDef * mcu_i2c_banks[4];
+// I2C
+extern I2C_TypeDef *mcu_i2c_banks[4];
extern const mcu_periph_obj_t mcu_i2c_sda_list[12];
extern const mcu_periph_obj_t mcu_i2c_scl_list[12];
-//SPI
-extern SPI_TypeDef * mcu_spi_banks[6];
+// SPI
+extern SPI_TypeDef *mcu_spi_banks[6];
extern const mcu_periph_obj_t mcu_spi_sck_list[19];
extern const mcu_periph_obj_t mcu_spi_mosi_list[19];
extern const mcu_periph_obj_t mcu_spi_miso_list[16];
-//UART
-extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+// UART
+extern USART_TypeDef *mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
extern const mcu_periph_obj_t mcu_uart_tx_list[25];
extern const mcu_periph_obj_t mcu_uart_rx_list[26];
-//Timers
+// Timers
#define TIM_BANK_ARRAY_LEN 14
#define TIM_PIN_ARRAY_LEN 58
-extern TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN];
#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PERIPH_H
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/pins.c b/ports/stm/peripherals/stm32h7/stm32h743xx/pins.c
index 7484781c2..baad62274 100644
--- a/ports/stm/peripherals/stm32h7/stm32h743xx/pins.c
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/pins.c
@@ -1,4 +1,4 @@
- /*
+/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c
index 7bc5ea495..6121deab1 100644
--- a/ports/stm/peripherals/timers.c
+++ b/ports/stm/peripherals/timers.c
@@ -41,8 +41,8 @@
static bool stm_timer_reserved[MP_ARRAY_SIZE(mcu_tim_banks)];
static bool stm_timer_never_reset[MP_ARRAY_SIZE(mcu_tim_banks)];
-static void (*stm_timer_callback[MP_ARRAY_SIZE(mcu_tim_banks)])(void);
-static size_t irq_map[] = {
+static void (*stm_timer_callback[MP_ARRAY_SIZE (mcu_tim_banks)])(void);
+ static size_t irq_map[] = {
#ifdef TIM1
TIM1_CC_IRQn,
#else
@@ -69,11 +69,11 @@ static size_t irq_map[] = {
NULL_IRQ,
#endif
#ifdef TIM6
- #if !defined(DAC_BASE) && !defined(DAC1_BASE)
- TIM6_IRQn,
- #else
- TIM6_DAC_IRQn,
- #endif
+ #if !defined(DAC_BASE) && !defined(DAC1_BASE)
+ TIM6_IRQn,
+ #else
+ TIM6_DAC_IRQn,
+ #endif
#else
NULL_IRQ,
#endif
@@ -139,7 +139,7 @@ static size_t irq_map[] = {
// If the APB prescaler is 1, then the timer clock is equal to its respective
// APB clock. Otherwise (APB prescaler > 1) the timer clock is twice its
// respective APB clock. See DM00031020 Rev 4, page 115.
-uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef * timer) {
+ uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef *timer) {
size_t tim_id = stm_peripherals_timer_get_index(timer);
uint32_t source, clk_div;
if (tim_id == 1 || (8 <= tim_id && tim_id <= 11)) {
@@ -158,12 +158,12 @@ uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef * timer) {
return source;
}
-size_t stm_peripherals_timer_get_irqnum(TIM_TypeDef * instance) {
+ size_t stm_peripherals_timer_get_irqnum(TIM_TypeDef *instance) {
size_t tim_id = stm_peripherals_timer_get_index(instance);
return irq_map[tim_id];
}
-void timers_reset(void) {
+ void timers_reset(void) {
uint16_t never_reset_mask = 0x00;
for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) {
if (!stm_timer_never_reset[i]) {
@@ -175,18 +175,18 @@ void timers_reset(void) {
tim_clock_disable(ALL_CLOCKS & ~(never_reset_mask));
}
-TIM_TypeDef * stm_peripherals_find_timer(void) {
+ TIM_TypeDef *stm_peripherals_find_timer(void) {
// Check for timers on pins outside the package size
for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) {
bool timer_in_package = false;
// Find each timer instance on the given bank
for (size_t j = 0; j < MP_ARRAY_SIZE(mcu_tim_pin_list); j++) {
// If a pin is claimed, we skip it
- if ( (mcu_tim_pin_list[j].tim_index == i + 1)
- && (common_hal_mcu_pin_is_free(mcu_tim_pin_list[j].pin) == true) ) {
+ if ((mcu_tim_pin_list[j].tim_index == i + 1)
+ && (common_hal_mcu_pin_is_free(mcu_tim_pin_list[j].pin) == true)) {
// Search whether any pins in the package array match it
for (size_t k = 0; k < mcu_pin_globals.map.alloc; k++) {
- if ( (mcu_tim_pin_list[j].pin == (mcu_pin_obj_t*)(mcu_pin_globals.map.table[k].value)) ) {
+ if ((mcu_tim_pin_list[j].pin == (mcu_pin_obj_t *)(mcu_pin_globals.map.table[k].value))) {
timer_in_package = true;
}
}
@@ -198,7 +198,7 @@ TIM_TypeDef * stm_peripherals_find_timer(void) {
return mcu_tim_banks[i];
}
}
- //TODO: secondary search for timers outside the pins in the board profile
+ // TODO: secondary search for timers outside the pins in the board profile
// Work backwards - higher index timers have fewer pin allocations
for (size_t i = (MP_ARRAY_SIZE(mcu_tim_banks) - 1); i >= 0; i--) {
@@ -210,7 +210,7 @@ TIM_TypeDef * stm_peripherals_find_timer(void) {
return NULL;
}
-void stm_peripherals_timer_preinit(TIM_TypeDef * instance, uint8_t prio, void (*callback)(void)) {
+ void stm_peripherals_timer_preinit(TIM_TypeDef *instance, uint8_t prio, void (*callback)(void)) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
stm_timer_callback[tim_idx] = callback;
tim_clock_enable(1 << tim_idx);
@@ -218,16 +218,16 @@ void stm_peripherals_timer_preinit(TIM_TypeDef * instance, uint8_t prio, void (*
HAL_NVIC_EnableIRQ(irq_map[tim_idx]);
}
-void stm_peripherals_timer_reserve(TIM_TypeDef * instance) {
+ void stm_peripherals_timer_reserve(TIM_TypeDef *instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
stm_timer_reserved[tim_idx] = true;
}
-void stm_peripherals_timer_set_callback(void(*callback)(void), TIM_TypeDef * timer) {
+ void stm_peripherals_timer_set_callback(void (*callback)(void), TIM_TypeDef *timer) {
stm_timer_callback[stm_peripherals_timer_get_index(timer)] = callback;
}
-void stm_peripherals_timer_free(TIM_TypeDef * instance) {
+ void stm_peripherals_timer_free(TIM_TypeDef *instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
HAL_NVIC_DisableIRQ(irq_map[tim_idx]);
stm_timer_callback[tim_idx] = NULL;
@@ -236,24 +236,24 @@ void stm_peripherals_timer_free(TIM_TypeDef * instance) {
stm_timer_never_reset[tim_idx] = false;
}
-void stm_peripherals_timer_never_reset(TIM_TypeDef * instance) {
+ void stm_peripherals_timer_never_reset(TIM_TypeDef *instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
stm_timer_never_reset[tim_idx] = true;
}
-void stm_peripherals_timer_reset_ok(TIM_TypeDef * instance) {
+ void stm_peripherals_timer_reset_ok(TIM_TypeDef *instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
stm_timer_never_reset[tim_idx] = false;
}
-bool stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance){
+ bool stm_peripherals_timer_is_never_reset(TIM_TypeDef *instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
return stm_timer_never_reset[tim_idx];
}
-bool stm_peripherals_timer_is_reserved(TIM_TypeDef * instance) {
+ bool stm_peripherals_timer_is_reserved(TIM_TypeDef *instance) {
size_t tim_idx = stm_peripherals_timer_get_index(instance);
return stm_timer_reserved[tim_idx];
}
-size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance) {
+ size_t stm_peripherals_timer_get_index(TIM_TypeDef *instance) {
for (size_t i = 0; i < MP_ARRAY_SIZE(mcu_tim_banks); i++) {
if (instance == mcu_tim_banks[i]) {
return i;
@@ -262,7 +262,7 @@ size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance) {
return ~(size_t)0;
}
-void tim_clock_enable(uint16_t mask) {
+ void tim_clock_enable(uint16_t mask) {
#ifdef TIM1
if (mask & (1 << 0)) {
__HAL_RCC_TIM1_CLK_ENABLE();
@@ -288,7 +288,7 @@ void tim_clock_enable(uint16_t mask) {
__HAL_RCC_TIM5_CLK_ENABLE();
}
#endif
- //6 and 7 are reserved ADC timers
+ // 6 and 7 are reserved ADC timers
#ifdef TIM8
if (mask & (1 << 7)) {
__HAL_RCC_TIM8_CLK_ENABLE();
@@ -326,7 +326,7 @@ void tim_clock_enable(uint16_t mask) {
#endif
}
-void tim_clock_disable(uint16_t mask) {
+ void tim_clock_disable(uint16_t mask) {
#ifdef TIM1
if (mask & (1 << 0)) {
__HAL_RCC_TIM1_CLK_DISABLE();
@@ -352,7 +352,7 @@ void tim_clock_disable(uint16_t mask) {
__HAL_RCC_TIM5_CLK_DISABLE();
}
#endif
- //6 and 7 are reserved ADC timers
+ // 6 and 7 are reserved ADC timers
#ifdef TIM8
if (mask & (1 << 7)) {
__HAL_RCC_TIM8_CLK_DISABLE();
@@ -390,65 +390,65 @@ void tim_clock_disable(uint16_t mask) {
#endif
}
-STATIC void callback_router(size_t index) {
+ STATIC void callback_router(size_t index) {
if (stm_timer_callback[index - 1]) {
(*stm_timer_callback[index - 1])();
}
}
-void TIM1_CC_IRQHandler(void) { // Advanced timer
+ void TIM1_CC_IRQHandler(void) { // Advanced timer
callback_router(1);
}
-void TIM2_IRQHandler(void) {
+ void TIM2_IRQHandler(void) {
callback_router(2);
}
-void TIM3_IRQHandler(void) {
+ void TIM3_IRQHandler(void) {
callback_router(3);
}
-void TIM4_IRQHandler(void) {
+ void TIM4_IRQHandler(void) {
callback_router(4);
}
-void TIM5_IRQHandler(void) {
+ void TIM5_IRQHandler(void) {
callback_router(5);
}
-void TIM6_DAC_IRQHandler(void) { // Basic timer (DAC)
+ void TIM6_DAC_IRQHandler(void) { // Basic timer (DAC)
callback_router(6);
}
-void TIM7_IRQHandler(void) { // Basic timer
+ void TIM7_IRQHandler(void) { // Basic timer
callback_router(7);
}
-void TIM8_CC_IRQHandler(void) { // Advanced timer
+ void TIM8_CC_IRQHandler(void) { // Advanced timer
callback_router(8);
}
// Advanced timer interrupts are currently unused.
-void TIM1_BRK_TIM9_IRQHandler(void) {
+ void TIM1_BRK_TIM9_IRQHandler(void) {
callback_router(9);
}
-void TIM1_UP_TIM10_IRQHandler(void) {
+ void TIM1_UP_TIM10_IRQHandler(void) {
callback_router(10);
}
-void TIM1_TRG_COM_TIM11_IRQHandler(void) {
+ void TIM1_TRG_COM_TIM11_IRQHandler(void) {
callback_router(11);
}
-void TIM8_BRK_TIM12_IRQHandler(void) {
+ void TIM8_BRK_TIM12_IRQHandler(void) {
callback_router(12);
}
-void TIM8_UP_TIM13_IRQHandler(void) {
+ void TIM8_UP_TIM13_IRQHandler(void) {
callback_router(13);
}
-void TIM8_TRG_COM_TIM14_IRQHandler(void) {
+ void TIM8_TRG_COM_TIM14_IRQHandler(void) {
callback_router(14);
}
#if (CPY_STM32H7)
-void TIM15_IRQHandler(void) {
+ void TIM15_IRQHandler(void) {
callback_router(15);
}
-void TIM16_IRQHandler(void) {
+ void TIM16_IRQHandler(void) {
callback_router(16);
}
-void TIM17_IRQHandler(void) {
+ void TIM17_IRQHandler(void) {
callback_router(17);
}
#endif
diff --git a/ports/stm/peripherals/timers.h b/ports/stm/peripherals/timers.h
index c4b6c6367..26cba88a0 100644
--- a/ports/stm/peripherals/timers.h
+++ b/ports/stm/peripherals/timers.h
@@ -32,15 +32,15 @@
void tim_clock_enable(uint16_t mask);
void tim_clock_disable(uint16_t mask);
-uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef * timer);
-size_t stm_peripherals_timer_get_irqnum(TIM_TypeDef * instance);
+uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef *timer);
+size_t stm_peripherals_timer_get_irqnum(TIM_TypeDef *instance);
void timers_reset(void);
-TIM_TypeDef * stm_peripherals_find_timer(void);
-void stm_peripherals_timer_preinit(TIM_TypeDef * instance, uint8_t prio, void (*callback)(void));
-void stm_peripherals_timer_reserve(TIM_TypeDef * instance);
-void stm_peripherals_timer_free(TIM_TypeDef * instance);
-void stm_peripherals_timer_never_reset(TIM_TypeDef * instance);
-void stm_peripherals_timer_reset_ok(TIM_TypeDef * instance);
-bool stm_peripherals_timer_is_never_reset(TIM_TypeDef * instance);
-bool stm_peripherals_timer_is_reserved(TIM_TypeDef * instance);
-size_t stm_peripherals_timer_get_index(TIM_TypeDef * instance);
+TIM_TypeDef *stm_peripherals_find_timer(void);
+void stm_peripherals_timer_preinit(TIM_TypeDef *instance, uint8_t prio, void (*callback)(void));
+void stm_peripherals_timer_reserve(TIM_TypeDef *instance);
+void stm_peripherals_timer_free(TIM_TypeDef *instance);
+void stm_peripherals_timer_never_reset(TIM_TypeDef *instance);
+void stm_peripherals_timer_reset_ok(TIM_TypeDef *instance);
+bool stm_peripherals_timer_is_never_reset(TIM_TypeDef *instance);
+bool stm_peripherals_timer_is_reserved(TIM_TypeDef *instance);
+size_t stm_peripherals_timer_get_index(TIM_TypeDef *instance);