fix(i2c_master): Fix I2C new master cannot continously probe

This commit is contained in:
Cao Sen Miao
2023-09-05 12:27:18 +08:00
parent 7d0c434e2c
commit c7740b4c2b
2 changed files with 14 additions and 2 deletions
@@ -132,7 +132,7 @@ TEST_CASE("I2C device add & remove check", "[i2c]")
TEST_CASE("I2C master probe device test", "[i2c]")
{
// 0x22 does not exist on the I2C bus, so it's expected to return `not found` error
// 0x22,33,44,55 does not exist on the I2C bus, so it's expected to return `not found` error
// TODO: Add exist slave for testing probe success after i2c slave is merged.
i2c_master_bus_config_t i2c_mst_config_1 = {
.clk_source = I2C_CLK_SRC_DEFAULT,
@@ -145,5 +145,8 @@ TEST_CASE("I2C master probe device test", "[i2c]")
TEST_ESP_OK(i2c_new_master_bus(&i2c_mst_config_1, &bus_handle));
TEST_ESP_ERR(i2c_master_probe(bus_handle, 0x22, -1), ESP_ERR_NOT_FOUND);
TEST_ESP_ERR(i2c_master_probe(bus_handle, 0x33, -1), ESP_ERR_NOT_FOUND);
TEST_ESP_ERR(i2c_master_probe(bus_handle, 0x44, -1), ESP_ERR_NOT_FOUND);
TEST_ESP_ERR(i2c_master_probe(bus_handle, 0x55, -1), ESP_ERR_NOT_FOUND);
TEST_ESP_OK(i2c_del_master_bus(bus_handle));
}