|
102 | 102 | ARG_de_idle_high, |
103 | 103 | ARG_pclk_idle_high, |
104 | 104 | ARG_pclk_active_low, |
105 | | - ARG_refresh_on_demand, |
106 | 105 | ARG_rgb565_dither |
107 | 106 | }; |
108 | 107 |
|
|
139 | 138 | { MP_QSTR_de_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } }, |
140 | 139 | { MP_QSTR_pclk_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } }, |
141 | 140 | { 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 } }, |
143 | 141 | { MP_QSTR_rgb565_dither, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } }, |
144 | 142 | }; |
145 | 143 |
|
|
190 | 188 | self->panel_io_config.data_gpio_nums[14] = (int)args[ARG_data14].u_int; |
191 | 189 | self->panel_io_config.data_gpio_nums[15] = (int)args[ARG_data15].u_int; |
192 | 190 | 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; |
196 | 193 | self->panel_io_config.flags.fb_in_psram = 0; |
197 | 194 | self->panel_io_config.flags.double_fb = 0; |
198 | 195 |
|
|
398 | 395 | rgb_bus_lock_init(&self->init_lock); |
399 | 396 | rgb_bus_lock_acquire(&self->init_lock, -1); |
400 | 397 |
|
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 | | - |
409 | 398 | LCD_DEBUG_PRINT("h_res=%lu\n", self->panel_io_config.timings.h_res) |
410 | 399 | LCD_DEBUG_PRINT("v_res=%lu\n", self->panel_io_config.timings.v_res) |
411 | 400 | LCD_DEBUG_PRINT("bits_per_pixel=%d\n", self->panel_io_config.bits_per_pixel) |
|
469 | 458 | return LCD_OK; |
470 | 459 | } |
471 | 460 |
|
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 | | - |
528 | 461 | MP_DEFINE_CONST_OBJ_TYPE( |
529 | 462 | mp_lcd_rgb_bus_type, |
530 | 463 | MP_QSTR_RGBBus, |
531 | 464 | MP_TYPE_FLAG_NONE, |
532 | 465 | make_new, mp_lcd_rgb_bus_make_new, |
533 | | - #if LCD_RGB_OPTIMUM_FB_SIZE |
534 | | - attr, rgb_bus_attr, |
535 | | - #endif |
536 | 466 | locals_dict, (mp_obj_dict_t *)&mp_lcd_bus_locals_dict |
537 | 467 | ); |
538 | 468 |
|
|
0 commit comments