mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
Update esp-idf i2c timeout unit conversion
This commit is contained in:
parent
4a80a09db3
commit
f6caf6e1ac
1 changed files with 2 additions and 2 deletions
|
@ -50,13 +50,13 @@ void IDFI2CBus::setup() {
|
||||||
ESP_LOGW(TAG, "i2c timeout of %" PRIu32 "us greater than max of 13ms on esp-idf, setting to max", timeout_);
|
ESP_LOGW(TAG, "i2c timeout of %" PRIu32 "us greater than max of 13ms on esp-idf, setting to max", timeout_);
|
||||||
timeout_ = 13000;
|
timeout_ = 13000;
|
||||||
}
|
}
|
||||||
err = i2c_set_timeout(port_, timeout_ * 80); // unit: APB 80MHz clock cycle
|
err = i2c_set_timeout(port_, timeout_ / (APB_CLK_FREQ / 1000000));
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "i2c_set_timeout failed: %s", esp_err_to_name(err));
|
ESP_LOGW(TAG, "i2c_set_timeout failed: %s", esp_err_to_name(err));
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGV(TAG, "i2c_timeout set to %" PRIu32 " ticks (%" PRIu32 " us)", timeout_ * 80, timeout_);
|
ESP_LOGV(TAG, "i2c_timeout set to %" PRIu32 " ticks (%" PRIu32 " us)", timeout_ / (APB_CLK_FREQ / 1000000), timeout_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = i2c_driver_install(port_, I2C_MODE_MASTER, 0, 0, ESP_INTR_FLAG_IRAM);
|
err = i2c_driver_install(port_, I2C_MODE_MASTER, 0, 0, ESP_INTR_FLAG_IRAM);
|
||||||
|
|
Loading…
Reference in a new issue