fix(i2c_oled): fix example hang when i2c transaction fails

Closes https://github.com/espressif/esp-idf/issues/18713
This commit is contained in:
Chen Jichang
2026-07-10 17:57:11 +08:00
parent 4292cd472c
commit 0dad295632
@@ -33,6 +33,7 @@ static const char *TAG = "example";
#define EXAMPLE_PIN_NUM_SCL 4
#define EXAMPLE_PIN_NUM_RST -1
#define EXAMPLE_I2C_HW_ADDR 0x3C
#define EXAMPLE_I2C_TRANSACTION_TIMEOUT_MS 1000
// The pixel number in horizontal and vertical
#if CONFIG_EXAMPLE_LCD_CONTROLLER_SSD1306
@@ -67,10 +68,10 @@ void app_main(void)
esp_lcd_panel_io_i2c_config_t io_config = {
.dev_addr = EXAMPLE_I2C_HW_ADDR,
.scl_speed_hz = EXAMPLE_LCD_PIXEL_CLOCK_HZ,
.transaction_timeout_ms = EXAMPLE_I2C_TRANSACTION_TIMEOUT_MS,
.control_phase_bytes = 1, // According to SSD1306 datasheet
.lcd_cmd_bits = EXAMPLE_LCD_CMD_BITS, // According to SSD1306 datasheet
.lcd_param_bits = EXAMPLE_LCD_CMD_BITS, // According to SSD1306 datasheet
.transaction_timeout_ms = 0, // wait infinitely
#if CONFIG_EXAMPLE_LCD_CONTROLLER_SSD1306
.dc_bit_offset = 6, // According to SSD1306 datasheet
#elif CONFIG_EXAMPLE_LCD_CONTROLLER_SH1107