mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-28 13:40:37 +08:00
Merge branch 'feature/i2c_clk_stretch' into 'master'
feature(i2c): add i2c clock stretch See merge request sdk/ESP8266_RTOS_SDK!916
This commit is contained in:
@ -99,9 +99,10 @@ static esp_err_t i2c_example_master_init()
|
||||
i2c_config_t conf;
|
||||
conf.mode = I2C_MODE_MASTER;
|
||||
conf.sda_io_num = I2C_EXAMPLE_MASTER_SDA_IO;
|
||||
conf.sda_pullup_en = 0;
|
||||
conf.sda_pullup_en = 1;
|
||||
conf.scl_io_num = I2C_EXAMPLE_MASTER_SCL_IO;
|
||||
conf.scl_pullup_en = 0;
|
||||
conf.scl_pullup_en = 1;
|
||||
conf.clk_stretch_tick = 300; // 300 ticks, Clock stretch is about 210us, you can make changes according to the actual situation.
|
||||
ESP_ERROR_CHECK(i2c_driver_install(i2c_master_port, conf.mode));
|
||||
ESP_ERROR_CHECK(i2c_param_config(i2c_master_port, &conf));
|
||||
return ESP_OK;
|
||||
|
Reference in New Issue
Block a user