diff options
Diffstat (limited to 'platforms/avr/drivers/i2c_master.c')
-rw-r--r-- | platforms/avr/drivers/i2c_master.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/platforms/avr/drivers/i2c_master.c b/platforms/avr/drivers/i2c_master.c index d4024378ca..c1a7b5f72d 100644 --- a/platforms/avr/drivers/i2c_master.c +++ b/platforms/avr/drivers/i2c_master.c @@ -25,12 +25,12 @@ #include "wait.h" #ifndef F_SCL -# define F_SCL 400000UL // SCL frequency +# define F_SCL 400000UL // SCL frequency #endif #ifndef I2C_START_RETRY_COUNT # define I2C_START_RETRY_COUNT 20 -#endif // I2C_START_RETRY_COUNT +#endif // I2C_START_RETRY_COUNT #define I2C_ACTION_READ 0x01 #define I2C_ACTION_WRITE 0x00 @@ -98,7 +98,7 @@ static i2c_status_t i2c_start_impl(uint8_t address, uint16_t timeout) { i2c_status_t i2c_start(uint8_t address, uint16_t timeout) { // Retry i2c_start_impl a bunch times in case the remote side has interrupts disabled. uint16_t timeout_timer = timer_read(); - uint16_t time_slice = MAX(1, (timeout == (I2C_TIMEOUT_INFINITE)) ? 5 : (timeout / (I2C_START_RETRY_COUNT))); // if it's infinite, wait 1ms between attempts, otherwise split up the entire timeout into the number of retries + uint16_t time_slice = MAX(1, (timeout == (I2C_TIMEOUT_INFINITE)) ? 5 : (timeout / (I2C_START_RETRY_COUNT))); // if it's infinite, wait 1ms between attempts, otherwise split up the entire timeout into the number of retries i2c_status_t status; do { status = i2c_start_impl(address, time_slice); |