HAL_ChibiOS: fix G4 I2c bus speeds
This commit is contained in:
parent
483d308781
commit
e6aae3caf6
@ -74,6 +74,13 @@ I2CBus I2CDeviceManager::businfo[ARRAY_SIZE(I2CD)];
|
||||
#define HAL_I2C_L4_400_TIMINGR 0x00702991
|
||||
#endif
|
||||
|
||||
#ifndef HAL_I2C_G4_100_TIMINGR
|
||||
#define HAL_I2C_G4_100_TIMINGR 0x60505F8C
|
||||
#endif
|
||||
#ifndef HAL_I2C_G4_400_TIMINGR
|
||||
#define HAL_I2C_G4_400_TIMINGR 0x20501E65
|
||||
#endif
|
||||
|
||||
/*
|
||||
enable clear (toggling SCL) on I2C bus timeouts which leave SDA stuck low
|
||||
*/
|
||||
@ -151,7 +158,7 @@ I2CDeviceManager::I2CDeviceManager(void)
|
||||
drop the speed to be the minimum speed requested
|
||||
*/
|
||||
businfo[i].busclock = HAL_I2C_MAX_CLOCK;
|
||||
#if defined(STM32F7) || defined(STM32F3) || defined(STM32G4)
|
||||
#if defined(STM32F7) || defined(STM32F3)
|
||||
if (businfo[i].busclock <= 100000) {
|
||||
businfo[i].i2ccfg.timingr = HAL_I2C_F7_100_TIMINGR;
|
||||
businfo[i].busclock = 100000;
|
||||
@ -175,6 +182,14 @@ I2CDeviceManager::I2CDeviceManager(void)
|
||||
businfo[i].i2ccfg.timingr = HAL_I2C_L4_400_TIMINGR;
|
||||
businfo[i].busclock = 400000;
|
||||
}
|
||||
#elif defined(STM32G4)
|
||||
if (businfo[i].busclock <= 100000) {
|
||||
businfo[i].i2ccfg.timingr = HAL_I2C_G4_100_TIMINGR;
|
||||
businfo[i].busclock = 100000;
|
||||
} else {
|
||||
businfo[i].i2ccfg.timingr = HAL_I2C_G4_400_TIMINGR;
|
||||
businfo[i].busclock = 400000;
|
||||
}
|
||||
#else // F1 or F4
|
||||
businfo[i].i2ccfg.op_mode = OPMODE_I2C;
|
||||
businfo[i].i2ccfg.clock_speed = businfo[i].busclock;
|
||||
|
Loading…
Reference in New Issue
Block a user