flush_cb not being executed
STM32F746DISC, makefile, Notepad++, gcc
Create driver for Discovery board
I created the driver using https://github.com/Shadofisher/STM32F746_LittleVGL as a base. The examples were used to wrap the code in Micropython. Compile is good and functions visible in Micropython. Init() executes without any problem but the flush_cb is never executed. I tried both registering the driver in C and Micropython but the same result. There is a LED on board that I use to see the activity, but there is no change in LED status. Anybody who have done the driver for 746DISC board?
Code to reproduce
Add the relevant code snippets here.
The code block(s) should be between ```c
and ```
tags:
#define LAYER0_ADDRESS (0xc0000000)
static uint32_t * my_fb = (uint32_t *)LAYER0_ADDRESS;
void CopyBuffer(const uint32_t *pSrc, uint32_t *pDst, uint16_t x, uint16_t y, uint16_t xsize, uint16_t ysize)
{
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_1, GPIO_PIN_SET); /* LED ON */
uint32_t row;
for(row = y; row < y + ysize; row++ ) {
memcpy(&pDst[row * 480 + x], pSrc, xsize * 2);
pSrc += xsize;
}
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_1, GPIO_PIN_RESET); /* LED OFF */
}
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
CopyBuffer((const uint32_t *)color_p, my_fb, area->x1, area->y1, lv_area_get_width(area), lv_area_get_height(area));
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);
}
STATIC mp_obj_t init(void) {
//static lv_disp_buf_t disp_buf;
//static lv_color_t buf_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/
//static lv_color_t buf_2[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/
//lv_disp_buf_init(&disp_buf, buf_1, NULL, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
//lv_disp_buf_init(&disp_buf, (lv_color_t *)0xC0000000, (lv_color_t *)0xC0050000, 130560);
//lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
//lv_disp_drv_init(&disp_drv); /*Basic initialization*/
//disp_drv.hor_res = 480;
//disp_drv.ver_res = 272;
/*Used to copy the buffer's content to the display*/
//disp_drv.flush_cb = disp_flush;
/*Set a display buffer*/
//disp_drv.buffer = &disp_buf;
/*Finally register the driver*/
//lv_disp_drv_register(&disp_drv);
disp_init(); /* This part set the LTDC and DMA2D peripherals */
return mp_const_none;
}
// Define a Python reference to the function above
STATIC MP_DEFINE_CONST_FUN_OBJ_1(init_obj, init);
DEFINE_PTR_OBJ(disp_flush);
// Define all properties of the example module.
// Table entries are key/value pairs of the attribute name (a string)
// and the MicroPython object reference.
// All identifiers and strings are written as MP_QSTR_xxx and will be
// optimized to word-sized integers by the build system (interned strings).
STATIC const mp_rom_map_elem_t ltdc_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ltdc) },
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&init_obj) },
{ MP_ROM_QSTR(MP_QSTR_disp_flush), MP_ROM_PTR(&PTR_OBJ(disp_flush))},
};
STATIC MP_DEFINE_CONST_DICT(ltdc_module_globals, ltdc_globals_table);
// Define module object.
const mp_obj_module_t ltdc_cmodule = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)<dc_module_globals,
};
// Register the module to make it available in Python
MP_REGISTER_MODULE(MP_QSTR_ltdc, ltdc_cmodule, MODULE_LTDC_ENABLED);
// For the Micropython code :
import lvgl as lv
import ltdc
import lvstm32
lv.init()
ltdc.init()
disp_buf1 = lv.disp_buf_t()
buf1_1 = bytearray(480*272)
lv.disp_buf_init(disp_buf1,buf1_1, None, len(buf1_1)//4)
disp_drv = lv.disp_drv_t()
lv.disp_drv_init(disp_drv)
disp_drv.buffer = disp_buf1
disp_drv.flush_cb = ltdc.disp_flush
disp_drv.hor_res = 480
disp_drv.ver_res = 272
lv.disp_drv_register(disp_drv)
scr = lv.obj()
btn = lv.btn(scr)
btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text("Hello World!")
lv.scr_load(scr)
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.