stm32/i2c: Fix clock enable for I2C4 on STM32F7 MCUs.

This was broken by 5aec051f9f

Signed-off-by: Damien George <damien@micropython.org>
Damien George 2024-03-28 13:53:24 +11:00
rodzic e8dd519e2d
commit d2446cb61f
1 zmienionych plików z 9 dodań i 13 usunięć

Wyświetl plik

@ -312,19 +312,15 @@ int i2c_init(i2c_t *i2c, mp_hal_pin_obj_t scl, mp_hal_pin_obj_t sda, uint32_t fr
// Enable I2C peripheral clock // Enable I2C peripheral clock
volatile uint32_t tmp; volatile uint32_t tmp;
(void)tmp; (void)tmp;
switch (i2c_id) { #if defined(STM32H7)
case 0: if (i2c_id == 3) {
case 1: RCC->APB4ENR |= RCC_APB4ENR_I2C4EN;
case 2: tmp = RCC->APB4ENR; // delay after RCC clock enable
RCC->APB1ENR |= RCC_APB1ENR_I2C1EN << i2c_id; } else
tmp = RCC->APB1ENR; // delay after RCC clock enable #endif
break; {
#if defined(STM32H7) RCC->APB1ENR |= RCC_APB1ENR_I2C1EN << i2c_id;
case 3: tmp = RCC->APB1ENR; // delay after RCC clock enable
RCC->APB4ENR |= RCC_APB4ENR_I2C4EN;
tmp = RCC->APB4ENR; // delay after RCC clock enable
break;
#endif
} }
// Initialise I2C peripheral // Initialise I2C peripheral