Merge pull request #68 from adafruit/add-end
add end() to de-init i2c peripheral
This commit is contained in:
commit
e5c99032f5
|
|
@ -35,6 +35,18 @@ bool Adafruit_I2CDevice::begin(bool addr_detect) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief De-initialize device, turn off the Wire interface
|
||||||
|
*/
|
||||||
|
void Adafruit_I2CDevice::end(void) {
|
||||||
|
#ifndef ESP8266
|
||||||
|
// ESP8266 does not implement Wire::end()
|
||||||
|
_wire->end();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_begun = false;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Scans I2C for the address - note will give a false-positive
|
* @brief Scans I2C for the address - note will give a false-positive
|
||||||
* if there's no pullups on I2C
|
* if there's no pullups on I2C
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ public:
|
||||||
Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
|
Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
|
||||||
uint8_t address(void);
|
uint8_t address(void);
|
||||||
bool begin(bool addr_detect = true);
|
bool begin(bool addr_detect = true);
|
||||||
|
void end(void);
|
||||||
bool detected(void);
|
bool detected(void);
|
||||||
|
|
||||||
bool read(uint8_t *buffer, size_t len, bool stop = true);
|
bool read(uint8_t *buffer, size_t len, bool stop = true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue