|
8 | 8 |
|
9 | 9 | //local_includes |
10 | 10 | #include "lcd_types.h" |
| 11 | + #include "lcd_bus_task.h" |
11 | 12 |
|
12 | 13 | // esp-idf includes |
13 | 14 | #include "hal/lcd_hal.h" |
|
50 | 51 | uint8_t bb_fb_index; // Current frame buffer index which used by bounce buffer |
51 | 52 | } rgb_panel_t; |
52 | 53 |
|
53 | | - typedef struct _rgb_bus_lock_t { |
54 | | - SemaphoreHandle_t handle; |
55 | | - StaticSemaphore_t buffer; |
56 | | - } rgb_bus_lock_t; |
57 | | - |
58 | | - typedef struct _rgb_bus_event_t { |
59 | | - EventGroupHandle_t handle; |
60 | | - StaticEventGroup_t buffer; |
61 | | - } rgb_bus_event_t; |
62 | | - |
63 | | - #if LCD_RGB_OPTIMUM_FB_SIZE |
64 | | - typedef struct _rgb_bus_optimum_fb_size_t { |
65 | | - uint16_t flush_count; |
66 | | - uint8_t sample_count; |
67 | | - uint8_t curr_index; |
68 | | - uint16_t *samples; |
69 | | - rgb_bus_lock_t lock; |
70 | | - } rgb_bus_optimum_fb_size_t; |
71 | | - #endif |
72 | | - |
73 | 54 | typedef struct _mp_lcd_rgb_bus_obj_t { |
74 | 55 | mp_obj_base_t base; |
75 | 56 |
|
|
80 | 61 |
|
81 | 62 | uint32_t buffer_flags; |
82 | 63 |
|
83 | | - bool trans_done; |
84 | | - bool rgb565_byte_swap; |
| 64 | + uint8_t trans_done: 1; |
| 65 | + |
| 66 | + lcd_task_t task; |
| 67 | + lcd_init_t init; |
| 68 | + lcd_bufs_t bufs; |
| 69 | + |
| 70 | + lcd_tx_data_t tx_data; |
| 71 | + lcd_tx_cmds_t tx_cmds; |
| 72 | + |
| 73 | + rotation_data_t r_data; |
85 | 74 |
|
86 | 75 | lcd_panel_io_t panel_io_handle; |
87 | 76 |
|
| 77 | + // ********************** bus specific ********************** |
88 | 78 | esp_lcd_rgb_panel_config_t panel_io_config; |
89 | 79 | esp_lcd_rgb_timing_t bus_config; |
90 | 80 |
|
91 | 81 | esp_lcd_panel_handle_t panel_handle; |
92 | 82 | uint32_t buffer_size; |
93 | 83 |
|
94 | | - uint8_t *active_fb; |
95 | | - uint8_t *idle_fb; |
96 | | - uint8_t *partial_buf; |
97 | | - |
98 | | - int x_start; |
99 | | - int y_start; |
100 | | - int x_end; |
101 | | - int y_end; |
102 | | - uint16_t width; |
103 | | - uint16_t height; |
104 | | - uint8_t rotation: 2; |
105 | | - uint8_t bytes_per_pixel: 2; |
106 | | - uint8_t last_update: 1; |
107 | | - uint8_t rgb565_dither: 1; |
108 | | - |
109 | | - rgb_bus_lock_t copy_lock; |
110 | | - rgb_bus_event_t copy_task_exit; |
111 | | - rgb_bus_lock_t tx_color_lock; |
112 | | - rgb_bus_event_t swap_bufs; |
113 | | - rgb_bus_lock_t init_lock; |
114 | | - |
115 | | - TaskHandle_t copy_task_handle; |
116 | | - |
117 | | - mp_lcd_err_t init_err; |
118 | | - mp_rom_error_text_t init_err_msg; |
119 | | - |
120 | | - #if LCD_RGB_OPTIMUM_FB_SIZE |
121 | | - rgb_bus_optimum_fb_size_t optimum_fb; |
122 | | - #endif |
123 | | - |
124 | 84 | } mp_lcd_rgb_bus_obj_t; |
125 | 85 |
|
126 | | - void rgb_bus_event_init(rgb_bus_event_t *event); |
127 | | - void rgb_bus_event_delete(rgb_bus_event_t *event); |
128 | | - bool rgb_bus_event_isset(rgb_bus_event_t *event); |
129 | | - void rgb_bus_event_set(rgb_bus_event_t *event); |
130 | | - void rgb_bus_event_clear(rgb_bus_event_t *event); |
131 | | - void rgb_bus_event_clear_from_isr(rgb_bus_event_t *event); |
132 | | - bool rgb_bus_event_isset_from_isr(rgb_bus_event_t *event); |
133 | | - void rgb_bus_event_set_from_isr(rgb_bus_event_t *event); |
134 | | - void rgb_bus_event_wait(rgb_bus_event_t *event); |
135 | | - |
136 | | - int rgb_bus_lock_acquire(rgb_bus_lock_t *lock, int32_t wait_ms); |
137 | | - void rgb_bus_lock_release(rgb_bus_lock_t *lock); |
138 | | - void rgb_bus_lock_init(rgb_bus_lock_t *lock); |
139 | | - void rgb_bus_lock_delete(rgb_bus_lock_t *lock); |
140 | | - void rgb_bus_lock_release_from_isr(rgb_bus_lock_t *lock); |
141 | | - |
142 | | - void rgb_bus_copy_task(void *self_in); |
143 | | - |
144 | 86 | extern const mp_obj_type_t mp_lcd_rgb_bus_type; |
145 | 87 |
|
146 | 88 | extern void mp_lcd_rgb_bus_deinit_all(void); |
|
0 commit comments