mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
I2C: Fix the reset counter
This commit is contained in:
@ -1472,7 +1472,7 @@ static bool is_cmd_link_buffer_internal(const i2c_cmd_link_t *link)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint8_t clear_bus_cnt[2] = { 0, 0 };
|
static uint8_t clear_bus_cnt[I2C_NUM_MAX] = { 0 };
|
||||||
|
|
||||||
esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle, TickType_t ticks_to_wait)
|
esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle, TickType_t ticks_to_wait)
|
||||||
{
|
{
|
||||||
@ -1557,6 +1557,7 @@ esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle,
|
|||||||
clear_bus_cnt[i2c_num]++;
|
clear_bus_cnt[i2c_num]++;
|
||||||
if (clear_bus_cnt[i2c_num] >= I2C_ACKERR_CNT_MAX) {
|
if (clear_bus_cnt[i2c_num] >= I2C_ACKERR_CNT_MAX) {
|
||||||
clear_bus_cnt[i2c_num] = 0;
|
clear_bus_cnt[i2c_num] = 0;
|
||||||
|
i2c_hw_fsm_reset(i2c_num);
|
||||||
}
|
}
|
||||||
ret = ESP_FAIL;
|
ret = ESP_FAIL;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user