Skip to content

Commit

Permalink
Merge branch 'change/add_scl_check_v5.2' into 'release/v5.2'
Browse files Browse the repository at this point in the history
change(i2c): Add check for scl frequency for master_bus_add_device(backport v5.2)

See merge request espressif/esp-idf!27662
  • Loading branch information
jack0c committed Dec 26, 2023
2 parents 5b11097 + 1625943 commit c3b7aa7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/driver/i2c/i2c_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,8 @@ esp_err_t i2c_master_bus_add_device(i2c_master_bus_handle_t bus_handle, const i2
{
esp_err_t ret = ESP_OK;
ESP_RETURN_ON_FALSE((bus_handle != NULL), ESP_ERR_INVALID_ARG, TAG, "this bus is not initialized, please call `i2c_new_master_bus`");
ESP_RETURN_ON_FALSE(dev_config, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
ESP_RETURN_ON_FALSE(dev_config->scl_speed_hz > 0, ESP_ERR_INVALID_ARG, TAG, "invalid scl frequency");
if(bus_handle->base->bus_mode != I2C_BUS_MODE_MASTER) {
ESP_LOGE(TAG, "This is not master bus!");
return ESP_ERR_INVALID_ARG;
Expand Down

0 comments on commit c3b7aa7

Please sign in to comment.