1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-26 20:53:50 +00: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

@@ -33,7 +33,7 @@ void PCA6416AComponent::setup() {
}
// Test to see if the device supports pull-up resistors
if (this->read_register(PCAL6416A_PULL_EN0, &value, 1, true) == i2c::ERROR_OK) {
if (this->read_register(PCAL6416A_PULL_EN0, &value, 1) == i2c::ERROR_OK) {
this->has_pullup_ = true;
}
@@ -105,7 +105,7 @@ bool PCA6416AComponent::read_register_(uint8_t reg, uint8_t *value) {
return false;
}
this->last_error_ = this->read_register(reg, value, 1, true);
this->last_error_ = this->read_register(reg, value, 1);
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_);
@@ -122,7 +122,7 @@ bool PCA6416AComponent::write_register_(uint8_t reg, uint8_t value) {
return false;
}
this->last_error_ = this->write_register(reg, &value, 1, true);
this->last_error_ = this->write_register(reg, &value, 1);
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_);