Fix crash of uDisplay on ESP32S3 with IDF5.1 (#19383)

* fix compile of uDisplay with IDF5.x on ESP32S3

* fix crash with uDisplay on S3 with IDF5.1
This commit is contained in:
Christian Baars 2023-08-25 12:11:23 +02:00 committed by GitHub
parent b1fba92e87
commit 343618411c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -959,9 +959,16 @@ Renderer *uDisplay::Init(void) {
uint16_t color = random(0xffff); uint16_t color = random(0xffff);
ESP_ERROR_CHECK(_panel_handle->draw_bitmap(_panel_handle, 0, 0, 1, 1, &color)); ESP_ERROR_CHECK(_panel_handle->draw_bitmap(_panel_handle, 0, 0, 1, 1, &color));
#if ESP_IDF_VERSION_MAJOR < 5
_rgb_panel = __containerof(_panel_handle, esp_rgb_panel_t, base); _rgb_panel = __containerof(_panel_handle, esp_rgb_panel_t, base);
rgb_fb = (uint16_t *)_rgb_panel->fb; rgb_fb = (uint16_t *)_rgb_panel->fb;
#else
void * buf = NULL;
esp_lcd_rgb_panel_get_frame_buffer(_panel_handle, 1, &buf);
rgb_fb = (uint16_t *)buf;
#endif
#endif // USE_ESP32_S3 #endif // USE_ESP32_S3
} }
@ -1036,7 +1043,9 @@ Renderer *uDisplay::Init(void) {
esp_lcd_new_i80_bus(&bus_config, &_i80_bus); esp_lcd_new_i80_bus(&bus_config, &_i80_bus);
#if ESP_IDF_VERSION_MAJOR < 5
_dma_chan = _i80_bus->dma_chan; _dma_chan = _i80_bus->dma_chan;
#endif
uint32_t div_a, div_b, div_n, clkcnt; uint32_t div_a, div_b, div_n, clkcnt;
calcClockDiv(&div_a, &div_b, &div_n, &clkcnt, 240*1000*1000, spi_speed*1000000); calcClockDiv(&div_a, &div_b, &div_n, &clkcnt, 240*1000*1000, spi_speed*1000000);

View File

@ -116,7 +116,7 @@ enum uColorType { uCOLOR_BW, uCOLOR_COLOR };
#define SPI_DC_HIGH if (spi_dc >= 0) GPIO_SET_SLOW(spi_dc); #define SPI_DC_HIGH if (spi_dc >= 0) GPIO_SET_SLOW(spi_dc);
#ifdef USE_ESP32_S3 #if defined(USE_ESP32_S3) && ESP_IDF_VERSION_MAJOR < 5
struct esp_lcd_i80_bus_t { struct esp_lcd_i80_bus_t {
int bus_id; // Bus ID, index from 0 int bus_id; // Bus ID, index from 0
portMUX_TYPE spinlock; // spinlock used to protect i80 bus members(hal, device_list, cur_trans) portMUX_TYPE spinlock; // spinlock used to protect i80 bus members(hal, device_list, cur_trans)
@ -163,8 +163,7 @@ struct esp_rgb_panel_t
} flags; } flags;
dma_descriptor_t dma_nodes[]; // DMA descriptor pool of size `num_dma_nodes` dma_descriptor_t dma_nodes[]; // DMA descriptor pool of size `num_dma_nodes`
}; };
#endif //USE_ESP32_S3 && ESP_IDF_VERSION_MAJOR < 5
#endif
class uDisplay : public Renderer { class uDisplay : public Renderer {
@ -360,7 +359,9 @@ class uDisplay : public Renderer {
uint16_t pclk_active_neg; uint16_t pclk_active_neg;
esp_lcd_panel_handle_t _panel_handle = NULL; esp_lcd_panel_handle_t _panel_handle = NULL;
#if ESP_IDF_VERSION_MAJOR < 5
esp_rgb_panel_t *_rgb_panel; esp_rgb_panel_t *_rgb_panel;
#endif //ESP_IDF_VERSION_MAJOR < 5
uint16_t *rgb_fb; uint16_t *rgb_fb;