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

@ -211,4 +211,11 @@ void TwoWire::flush(void)
txLength = 0;
}
void TwoWire::reset(void)
{
i2cReset( i2c );
i2c = NULL;
begin( sda, scl );
}
TwoWire Wire = TwoWire(0);

View File

@ -72,6 +72,8 @@ public:
int peek(void);
void flush(void);
void reset(void);
inline size_t write(const char * s)
{
return write((uint8_t*) s, strlen(s));