From ae8d97f270922bb2566e08c923747138b7763b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Mon, 27 May 2019 15:56:20 +0100 Subject: [PATCH] I2C: Reduce timeout on F7 from 10s to 10ms F3 and F4 are already using a 10ms timeout References #4751 --- src/main/drivers/bus_i2c_hal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/drivers/bus_i2c_hal.c b/src/main/drivers/bus_i2c_hal.c index d64e0cf51e8..1f8c6f28380 100644 --- a/src/main/drivers/bus_i2c_hal.c +++ b/src/main/drivers/bus_i2c_hal.c @@ -82,7 +82,11 @@ static i2cDevice_t i2cHardwareMap[] = { static volatile uint16_t i2cErrorCount = 0; -#define I2C_DEFAULT_TIMEOUT 10000 +// Note that I2C_TIMEOUT is in us, while the HAL +// functions expect the timeout to be in ticks. +// Since we're setting up the ticks a 1khz, each +// tick equals 1ms. +#define I2C_DEFAULT_TIMEOUT (I2C_TIMEOUT / 1000) typedef struct i2cState_s { volatile bool initialised;