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:
@@ -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_);
|
||||
|
||||
Reference in New Issue
Block a user