mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
I2C bus reset with info to user
I2C slave might stil have something to send when ESP826 starts I2C, thus keeping the bus stuck. Happens e.g. when power failure/reset during transmission. Thanks to work of drmpf there is a solution. Implemented as separate method so as not to interfere with existing. Usage: Wire.begin(); if (Wire.status() != I2C_OK) Serial.writeln("Something wrong with I2C bus that cannot be recovered. Perform power cycle or search for other masters on bus.";
This commit is contained in:
@ -77,6 +77,10 @@ void TwoWire::begin(uint8_t address){
|
||||
begin();
|
||||
}
|
||||
|
||||
uint8_t TwoWire::status(){
|
||||
return twi_status();
|
||||
}
|
||||
|
||||
void TwoWire::begin(int address){
|
||||
begin((uint8_t)address);
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ class TwoWire : public Stream
|
||||
uint8_t endTransmission(void);
|
||||
uint8_t endTransmission(uint8_t);
|
||||
size_t requestFrom(uint8_t address, size_t size, bool sendStop);
|
||||
uint8_t status();
|
||||
|
||||
uint8_t requestFrom(uint8_t, uint8_t);
|
||||
uint8_t requestFrom(uint8_t, uint8_t, uint8_t);
|
||||
|
Reference in New Issue
Block a user