From e8c56ceadcae5494e179f38f3f90119151895657 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Fri, 29 Jun 2018 13:10:40 +0200 Subject: [PATCH] cpu/stm32_common/i2c: Fix return error code --- cpu/stm32_common/periph/i2c_2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/stm32_common/periph/i2c_2.c b/cpu/stm32_common/periph/i2c_2.c index 2eac5ced0c..211019211d 100644 --- a/cpu/stm32_common/periph/i2c_2.c +++ b/cpu/stm32_common/periph/i2c_2.c @@ -436,7 +436,7 @@ static int _start(I2C_TypeDef *i2c, uint8_t address, uint8_t rw_flag, uint8_t fl while (!(i2c->SR1 & I2C_SR1_ADDR) && tick--) { if ((i2c->SR1 & ERROR_FLAG) || !tick) { i2c->CR1 |= I2C_CR1_STOP; - return -ETIMEDOUT; + return -EIO; } } @@ -500,7 +500,7 @@ static inline int _wait_ready(I2C_TypeDef *i2c) while ((i2c->SR2 & I2C_SR2_BUSY) && tick--) { if (!tick) { DEBUG("[i2c] wait_ready: timeout\n"); - return -EIO; + return -ETIMEDOUT; } }