I2c reset functionality (#678)

* Addition of a i2cReset method and timeout handling for the case where the i2c hardware FSM (state machine) gets stuck in a busy state.

* Use newly added i2cReset function within the wire library.
This commit is contained in:
Jason K
2017-09-29 09:17:13 -04:00
committed by Me No Dev
parent 10ff1def6d
commit 0cd62852da
4 changed files with 47 additions and 3 deletions

View File

@ -27,7 +27,8 @@ typedef enum {
I2C_ERROR_DEV,
I2C_ERROR_ACK,
I2C_ERROR_TIMEOUT,
I2C_ERROR_BUS
I2C_ERROR_BUS,
I2C_ERROR_BUSY
} i2c_err_t;
struct i2c_struct_t;
@ -50,6 +51,7 @@ i2c_err_t i2cDetachSDA(i2c_t * i2c, int8_t sda);
i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data, uint8_t len, bool sendStop);
i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data, uint8_t len, bool sendStop);
void i2cReset(i2c_t* i2c);
#ifdef __cplusplus
}