Skip to content

Commit

Permalink
change(i2c): Add check for scl frequency for master_bus_add_device
Browse files Browse the repository at this point in the history
  • Loading branch information
mythbuster5 authored and movsb committed Dec 1, 2023
1 parent 406e4ac commit eab4fa6
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 @@ -874,6 +874,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 eab4fa6

Please sign in to comment.