add end() to de-init i2c peripheral

This commit is contained in:
hathach 2021-11-24 14:10:05 +07:00
parent 8b0ccda6bd
commit a2befb15de
2 changed files with 7 additions and 0 deletions

View File

@ -35,6 +35,12 @@ bool Adafruit_I2CDevice::begin(bool addr_detect) {
return true;
}
void Adafruit_I2CDevice::end(void)
{
_wire->end();
_begun = false;
}
/*!
* @brief Scans I2C for the address - note will give a false-positive
* if there's no pullups on I2C

View File

@ -10,6 +10,7 @@ public:
Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
uint8_t address(void);
bool begin(bool addr_detect = true);
void end(void);
bool detected(void);
bool read(uint8_t *buffer, size_t len, bool stop = true);