1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-11 07:42:26 +01:00

Support I2C transactions with combined reads and writes (#996)

* Support I2C transactions with combined reads and writes

* Add optional send_stop parameter to I2CComponent::raw_end_transmission

* Add convenience methods to I2CDevice

* clang-format

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
la7dja
2020-11-06 05:09:28 +01:00
committed by GitHub
parent 051a1e4772
commit 7221337442
2 changed files with 14 additions and 3 deletions

View File

@@ -56,8 +56,8 @@ void I2CComponent::raw_begin_transmission(uint8_t address) {
ESP_LOGVV(TAG, "Beginning Transmission to 0x%02X:", address);
this->wire_->beginTransmission(address);
}
bool I2CComponent::raw_end_transmission(uint8_t address) {
uint8_t status = this->wire_->endTransmission();
bool I2CComponent::raw_end_transmission(uint8_t address, bool send_stop) {
uint8_t status = this->wire_->endTransmission(send_stop);
ESP_LOGVV(TAG, " Transmission ended. Status code: 0x%02X", status);
switch (status) {