From bae2f06b5b213537dab31185f5359e703fa56569 Mon Sep 17 00:00:00 2001 From: Jackson Ming Hu Date: Mon, 26 Aug 2024 22:07:07 +1000 Subject: [PATCH 1/2] lcd_driver: fix LCD peripheral (source) timing issue caused by ESP-IDF v5.3 API breaking changes Ref: https://github.com/vroland/epdiy/issues/345 --- src/output_lcd/lcd_driver.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/output_lcd/lcd_driver.c b/src/output_lcd/lcd_driver.c index 25c52226..234d87c8 100644 --- a/src/output_lcd/lcd_driver.c +++ b/src/output_lcd/lcd_driver.c @@ -518,7 +518,12 @@ static esp_err_t init_lcd_peripheral() { // enable RGB mode and set data width lcd_ll_enable_rgb_mode(lcd.hal.dev, true); +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0) + lcd_ll_set_dma_read_stride(lcd.hal.dev, lcd.config.bus_width); + lcd_ll_set_data_wire_width(lcd.hal.dev, lcd.config.bus_width); +#else lcd_ll_set_data_width(lcd.hal.dev, lcd.config.bus_width); +#endif lcd_ll_set_phase_cycles(lcd.hal.dev, 0, (lcd.dummy_bytes > 0), 1); // enable data phase only lcd_ll_enable_output_hsync_in_porch_region(lcd.hal.dev, false); // enable data phase only @@ -612,7 +617,18 @@ void epd_lcd_set_pixel_clock_MHz(int frequency) { // set pclk int flags = 0; + +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0) + hal_utils_clk_div_t clk_div = {}; + uint32_t freq + = lcd_hal_cal_pclk_freq(&lcd.hal, 240000000, lcd.config.pixel_clock, flags, &clk_div); + lcd_ll_set_group_clock_coeff( + &LCD_CAM, (int)clk_div.integer, (int)clk_div.denominator, (int)clk_div.numerator + ); +#else uint32_t freq = lcd_hal_cal_pclk_freq(&lcd.hal, 240000000, lcd.config.pixel_clock, flags); +#endif + ESP_LOGI(TAG, "pclk freq: %d Hz", freq); lcd.line_length_us = (lcd.lcd_res_h + lcd.config.le_high_time + lcd.config.line_front_porch - 1) * 1000000 / lcd.config.pixel_clock From c42defba44b8e16ecd679c2f83722e1bbc38cf1e Mon Sep 17 00:00:00 2001 From: Jackson Ming Hu Date: Tue, 27 Aug 2024 10:37:29 +1000 Subject: [PATCH 2/2] ci: Add IDF v5.3 in the workflow --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f70dc0b..0a3bb6c4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,6 +25,7 @@ jobs: - release-v4.4 - release-v5.1 - release-v5.2 + - release-v5.3 example: - calibration_helper - demo