mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
I2C: Fix issue that pointer would be NULL if calls i2c_param first,
Closes https://github.com/espressif/esp-idf/issues/10163
This commit is contained in:
parent
c948a70895
commit
467356cfcd
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user