diff options
author | zvecr <git@zvecr.com> | 2019-03-15 15:55:07 +0000 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-03-15 08:55:07 -0700 |
commit | e0a03bfa6c148da2936b27a2285f1928c5574ac0 (patch) | |
tree | 07da06d5bd1dee48f1a66e03d77b67a4e12a27aa /drivers/avr/i2c_master.c | |
parent | b85e2eef9a44dac2e8d1119199238fd6c225586a (diff) |
Fix return value of i2c_readReg and i2c_receive (#5410)
Diffstat (limited to 'drivers/avr/i2c_master.c')
-rwxr-xr-x | drivers/avr/i2c_master.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/avr/i2c_master.c b/drivers/avr/i2c_master.c index d97a35cd6b..0db949db4a 100755 --- a/drivers/avr/i2c_master.c +++ b/drivers/avr/i2c_master.c @@ -140,7 +140,7 @@ i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16 i2c_stop(); - return status; + return (status < 0) ? status : I2C_STATUS_SUCCESS; } i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) { @@ -188,7 +188,7 @@ i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16 error: i2c_stop(); - return status; + return (status < 0) ? status : I2C_STATUS_SUCCESS; } void i2c_stop(void) { |