mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_bunch_of_i2c_issues' into 'master'
I2C: Fix bunch of small issues Closes IDFGH-8722 and IDFGH-8310 See merge request espressif/esp-idf!21891
This commit is contained in:
commit
e96e7ecbee
@ -756,6 +756,7 @@ esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t *i2c_conf)
|
||||
return ret;
|
||||
}
|
||||
i2c_hw_enable(i2c_num);
|
||||
i2c_hal_init(&i2c_context[i2c_num].hal, i2c_num);
|
||||
I2C_ENTER_CRITICAL(&(i2c_context[i2c_num].spinlock));
|
||||
i2c_ll_disable_intr_mask(i2c_context[i2c_num].hal.dev, I2C_LL_INTR_MASK);
|
||||
i2c_ll_clear_intr_mask(i2c_context[i2c_num].hal.dev, I2C_LL_INTR_MASK);
|
||||
|
@ -51,8 +51,10 @@ void i2c_hal_master_init(i2c_hal_context_t *hal)
|
||||
|
||||
void i2c_hal_init(i2c_hal_context_t *hal, int i2c_port)
|
||||
{
|
||||
hal->dev = I2C_LL_GET_HW(i2c_port);
|
||||
i2c_ll_enable_controller_clock(hal->dev, true);
|
||||
if (hal->dev == NULL) {
|
||||
hal->dev = I2C_LL_GET_HW(i2c_port);
|
||||
i2c_ll_enable_controller_clock(hal->dev, true);
|
||||
}
|
||||
}
|
||||
|
||||
void i2c_hal_deinit(i2c_hal_context_t *hal)
|
||||
|
@ -37,7 +37,7 @@ To run this example, you should have any ESP32, ESP32-S and ESP32-C based develo
|
||||
| ESP32-H4 I2C Master | GPIO5 | GPIO6 | GND | GND | 3.3V |
|
||||
| Sensor | SDA | SCL | GND | WAK | VCC |
|
||||
|
||||
**Note: ** There’s no need to add an external pull-up resistors for SDA/SCL pin, because the driver will enable the internal pull-up resistors itself.
|
||||
**Note:** It is recommended to add external pull-up resistors for SDA/SCL pins to make the communication more stable, though the driver will enable internal pull-up resistors.
|
||||
|
||||
### Configure the project
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user