Skip to content

Commit 88ba1cf

Browse files
committed
Hopefully will fix the RGB bus driver
1 parent e0540b2 commit 88ba1cf

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

ext_mod/lcd_bus/esp32_include/rgb_bus.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "esp_lcd_panel_ops.h"
2020
#include "esp_lcd_panel_interface.h"
2121
#include "esp_lcd_panel_rgb.h"
22+
#include "esp_private/gdma.h"
23+
#include "esp_private/gdma_link.h"
2224

2325
#include "freertos/FreeRTOS.h"
2426
#include "freertos/task.h"
@@ -31,6 +33,11 @@
3133
#include "py/obj.h"
3234
#include "py/objarray.h"
3335

36+
37+
#if CONFIG_IDF_TARGET_ESP32S3
38+
#define RGB_LCD_BUS_NEEDS_SEPARATE_RESTART_LINK 1
39+
#endif
40+
3441
typedef struct {
3542
esp_lcd_panel_t base; // Base class of generic lcd panel
3643
int panel_id; // LCD panel ID
@@ -39,15 +46,22 @@
3946
size_t fb_bits_per_pixel; // Frame buffer color depth, in bpp
4047
size_t num_fbs; // Number of frame buffers
4148
size_t output_bits_per_pixel; // Color depth seen from the output data line. Default to fb_bits_per_pixel, but can be changed by YUV-RGB conversion
42-
size_t sram_trans_align; // Alignment for framebuffer that allocated in SRAM
43-
size_t psram_trans_align; // Alignment for framebuffer that allocated in PSRAM
49+
size_t dma_burst_size; // DMA transfer burst size
4450
int disp_gpio_num; // Display control GPIO, which is used to perform action like "disp_off"
4551
intr_handle_t intr; // LCD peripheral interrupt handle
4652
esp_pm_lock_handle_t pm_lock; // Power management lock
4753
size_t num_dma_nodes; // Number of DMA descriptors that used to carry the frame buffer
54+
gdma_channel_handle_t dma_chan; // DMA channel handle
55+
gdma_link_list_handle_t dma_fb_links[RGB_LCD_PANEL_MAX_FB_NUM]; // DMA link lists for multiple frame buffers
56+
gdma_link_list_handle_t dma_bb_link; // DMA link list for bounce buffer
57+
#if RGB_LCD_BUS_NEEDS_SEPARATE_RESTART_LINK
58+
gdma_link_list_handle_t dma_restart_link; // DMA link list for restarting the DMA
59+
#endif
4860
uint8_t *fbs[3]; // Frame buffers
61+
uint8_t *bounce_buffer[2]; // Pointer to the bounce buffers
62+
size_t fb_size; // Size of frame buffer, in bytes
63+
size_t bb_size; // Size of the bounce buffer, in bytes. If not-zero, the driver uses two bounce buffers allocated from internal memory
4964
uint8_t cur_fb_index; // Current frame buffer index
50-
uint8_t bb_fb_index; // Current frame buffer index which used by bounce buffer
5165
} rgb_panel_t;
5266

5367
typedef struct _rgb_bus_lock_t {

make.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def create_lvgl_header():
246246

247247

248248
if __name__ == '__main__':
249-
249+
250250
if 'EXTRA_CFLAGS' not in os.environ:
251251
os.environ['EXTRA_CFLAGS'] = f'-Wno-unterminated-string-initialization'
252252
elif '-Wno-unterminated-string-initialization' not in os.environ['EXTRA_CFLAGS']:

micropy_updates/esp32/machine_hw_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ mp_obj_t machine_hw_spi_bus_make_new(const mp_obj_type_t *type, size_t n_args, s
431431
if (args[ARG_dual_pins].u_obj != mp_const_none) {
432432
mp_obj_tuple_t *dual_data_pins = MP_OBJ_TO_PTR(args[ARG_dual_pins].u_obj);
433433

434-
if (dual_data_pins->len != 4) {
434+
if (dual_data_pins->len != 2) {
435435
mp_raise_msg_varg(
436436
&mp_type_ValueError,
437437
MP_ERROR_TEXT("2 pins needed for quad SPI not %d"),

0 commit comments

Comments
 (0)