Skip to content

Commit 4793a36

Browse files
committed
Updates to RGB and I80 bus drivers.
1 parent 0999246 commit 4793a36

File tree

4 files changed

+3
-109
lines changed

4 files changed

+3
-109
lines changed

ext_mod/lcd_bus/esp32_include/rgb_bus.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,6 @@
6969
StaticEventGroup_t buffer;
7070
} rgb_bus_event_t;
7171

72-
#if LCD_RGB_OPTIMUM_FB_SIZE
73-
typedef struct _rgb_bus_optimum_fb_size_t {
74-
uint16_t flush_count;
75-
uint8_t sample_count;
76-
uint8_t curr_index;
77-
uint16_t *samples;
78-
rgb_bus_lock_t lock;
79-
} rgb_bus_optimum_fb_size_t;
80-
#endif
81-
8272
typedef struct _mp_lcd_rgb_bus_obj_t {
8373
mp_obj_base_t base;
8474

@@ -126,10 +116,6 @@
126116
mp_lcd_err_t init_err;
127117
mp_rom_error_text_t init_err_msg;
128118

129-
#if LCD_RGB_OPTIMUM_FB_SIZE
130-
rgb_bus_optimum_fb_size_t optimum_fb;
131-
#endif
132-
133119
} mp_lcd_rgb_bus_obj_t;
134120

135121
void rgb_bus_event_init(rgb_bus_event_t *event);
@@ -154,7 +140,6 @@
154140

155141
extern void mp_lcd_rgb_bus_deinit_all(void);
156142

157-
158143
#endif /* _ESP32_RGB_BUS_H_ */
159144
#else
160145
#include "../common_include/rgb_bus.h"

ext_mod/lcd_bus/esp32_src/i80_bus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
}
159159

160160
self->bus_config.bus_width = (size_t) i;
161+
self->bus_config.dma_burst_size = 64
161162

162163
self->panel_io_config.cs_gpio_num = (int)args[ARG_cs].u_int;
163164
self->panel_io_config.pclk_hz = (uint32_t)args[ARG_freq].u_int;

ext_mod/lcd_bus/esp32_src/rgb_bus.c

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
ARG_de_idle_high,
103103
ARG_pclk_idle_high,
104104
ARG_pclk_active_low,
105-
ARG_refresh_on_demand,
106105
ARG_rgb565_dither
107106
};
108107

@@ -139,7 +138,6 @@
139138
{ MP_QSTR_de_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
140139
{ MP_QSTR_pclk_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
141140
{ MP_QSTR_pclk_active_low, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
142-
{ MP_QSTR_refresh_on_demand, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
143141
{ MP_QSTR_rgb565_dither, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
144142
};
145143

@@ -190,9 +188,8 @@
190188
self->panel_io_config.data_gpio_nums[14] = (int)args[ARG_data14].u_int;
191189
self->panel_io_config.data_gpio_nums[15] = (int)args[ARG_data15].u_int;
192190
self->panel_io_config.disp_gpio_num = -1; // -1 means no GPIO is assigned to this function
193-
self->panel_io_config.sram_trans_align = 8;
194-
self->panel_io_config.psram_trans_align = 64;
195-
self->panel_io_config.flags.refresh_on_demand = (uint32_t)args[ARG_refresh_on_demand].u_bool;
191+
self->panel_io_config.dma_burst_size = 64
192+
self->panel_io_config.flags.refresh_on_demand = 0;
196193
self->panel_io_config.flags.fb_in_psram = 0;
197194
self->panel_io_config.flags.double_fb = 0;
198195

@@ -398,14 +395,6 @@
398395
rgb_bus_lock_init(&self->init_lock);
399396
rgb_bus_lock_acquire(&self->init_lock, -1);
400397

401-
402-
#if LCD_RGB_OPTIMUM_FB_SIZE
403-
rgb_bus_lock_init(&self->optimum_fb.lock);
404-
rgb_bus_lock_acquire(&self->optimum_fb.lock, -1);
405-
self->optimum_fb.samples = (uint16_t *)malloc(sizeof(uint16_t) * 255);
406-
self->optimum_fb.curr_index = 254;
407-
#endif
408-
409398
LCD_DEBUG_PRINT("h_res=%lu\n", self->panel_io_config.timings.h_res)
410399
LCD_DEBUG_PRINT("v_res=%lu\n", self->panel_io_config.timings.v_res)
411400
LCD_DEBUG_PRINT("bits_per_pixel=%d\n", self->panel_io_config.bits_per_pixel)
@@ -469,70 +458,11 @@
469458
return LCD_OK;
470459
}
471460

472-
#if LCD_RGB_OPTIMUM_FB_SIZE
473-
474-
static void rgb_bus_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest)
475-
{
476-
mp_lcd_rgb_bus_obj_t *self = MP_OBJ_TO_PTR(self_in);
477-
478-
if (attr == MP_QSTR_avg_flushes_per_update) {
479-
if (dest[0] == MP_OBJ_NULL) {
480-
uint32_t total = 0;
481-
482-
rgb_bus_lock_acquire(&self->optimum_fb.lock, -1);
483-
for (uint8_t i=0;i<self->optimum_fb.sample_count;i++) {
484-
total += (uint32_t)self->optimum_fb.samples[i];
485-
}
486-
487-
uint16_t avg = (uint16_t)(total / (uint32_t)self->optimum_fb.sample_count);
488-
489-
rgb_bus_lock_release(&self->optimum_fb.lock);
490-
491-
dest[0] = mp_obj_new_int_from_uint(avg);
492-
} else if (dest[1]) {
493-
uint16_t value = (uint16_t)mp_obj_get_int_truncated(dest[1]);
494-
495-
if (value == 0) {
496-
rgb_bus_lock_acquire(&self->optimum_fb.lock, -1);
497-
for (uint8_t i=0;i<self->optimum_fb.sample_count;i++) {
498-
self->optimum_fb.samples[i] = 0;
499-
}
500-
501-
self->optimum_fb.sample_count = 0;
502-
self->optimum_fb.curr_index = 254;
503-
rgb_bus_lock_release(&self->optimum_fb.lock);
504-
505-
dest[0] = MP_OBJ_NULL;
506-
}
507-
}
508-
} else if (dest[0] == MP_OBJ_NULL) {
509-
const mp_obj_type_t *type = mp_obj_get_type(self_in);
510-
while (MP_OBJ_TYPE_HAS_SLOT(type, locals_dict)) {
511-
// generic method lookup
512-
// this is a lookup in the object (ie not class or type)
513-
assert(MP_OBJ_TYPE_GET_SLOT(type, locals_dict)->base.type == &mp_type_dict); // MicroPython restriction, for now
514-
mp_map_t *locals_map = &MP_OBJ_TYPE_GET_SLOT(type, locals_dict)->map;
515-
mp_map_elem_t *elem = mp_map_lookup(locals_map, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP);
516-
if (elem != NULL) {
517-
mp_convert_member_lookup(self_in, type, elem->value, dest);
518-
break;
519-
}
520-
if (MP_OBJ_TYPE_GET_SLOT_OR_NULL(type, parent) == NULL) break;
521-
// search parents
522-
type = MP_OBJ_TYPE_GET_SLOT(type, parent);
523-
}
524-
}
525-
}
526-
#endif
527-
528461
MP_DEFINE_CONST_OBJ_TYPE(
529462
mp_lcd_rgb_bus_type,
530463
MP_QSTR_RGBBus,
531464
MP_TYPE_FLAG_NONE,
532465
make_new, mp_lcd_rgb_bus_make_new,
533-
#if LCD_RGB_OPTIMUM_FB_SIZE
534-
attr, rgb_bus_attr,
535-
#endif
536466
locals_dict, (mp_obj_dict_t *)&mp_lcd_bus_locals_dict
537467
);
538468

ext_mod/lcd_bus/esp32_src/rgb_bus_rotation.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,6 @@
222222
if (self->partial_buf == NULL) break;
223223
last_update = self->last_update;
224224

225-
226-
#if LCD_RGB_OPTIMUM_FB_SIZE
227-
self->optimum_fb.flush_count += 1;
228-
#endif
229-
230225
idle_fb = self->idle_fb;
231226

232227
copy_pixels(
@@ -269,23 +264,6 @@
269264
}
270265

271266
if (last_update) {
272-
273-
#if LCD_RGB_OPTIMUM_FB_SIZE
274-
if (self->optimum_fb.curr_index == 254) {
275-
self->optimum_fb.curr_index = 0;
276-
} else {
277-
self->optimum_fb.curr_index += 1;
278-
}
279-
if (self->optimum_fb.sample_count < 255) {
280-
self->optimum_fb.sample_count += 1;
281-
}
282-
self->optimum_fb.samples[self->optimum_fb.curr_index] = self->optimum_fb.flush_count;
283-
self->optimum_fb.flush_count = 0;
284-
285-
rgb_bus_lock_release(&self->optimum_fb.lock);
286-
rgb_bus_lock_acquire(&self->optimum_fb.lock, -1);
287-
#endif
288-
289267
mp_lcd_err_t ret = esp_lcd_panel_draw_bitmap(
290268
self->panel_handle,
291269
0,

0 commit comments

Comments
 (0)