1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-06 21:32:21 +01:00

[i2c] Perform register reads as single transactions (#10389)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Clyde Stubbs
2025-08-27 19:30:33 +10:00
committed by GitHub
parent 65d63de9b6
commit c171d13c8c
38 changed files with 329 additions and 643 deletions

View File

@@ -96,7 +96,7 @@ bool PCA9554Component::read_inputs_() {
return false;
}
this->last_error_ = this->read_register(INPUT_REG * this->reg_width_, inputs, this->reg_width_, true);
this->last_error_ = this->read_register(INPUT_REG * this->reg_width_, inputs, this->reg_width_);
if (this->last_error_ != i2c::ERROR_OK) {
this->status_set_warning();
ESP_LOGE(TAG, "read_register_(): I2C I/O error: %d", (int) this->last_error_);
@@ -114,7 +114,7 @@ bool PCA9554Component::write_register_(uint8_t reg, uint16_t value) {
uint8_t outputs[2];
outputs[0] = (uint8_t) value;
outputs[1] = (uint8_t) (value >> 8);
this->last_error_ = this->write_register(reg * this->reg_width_, outputs, this->reg_width_, true);
this->last_error_ = this->write_register(reg * this->reg_width_, outputs, this->reg_width_);
if (this->last_error_ != i2c::ERROR_OK) {
this->status_set_warning();
ESP_LOGE(TAG, "write_register_(): I2C I/O error: %d", (int) this->last_error_);