Hello Everyone, I managed to write my own Drivers for my TFT LCD (ILI9486) along with the RPi Pico and want to add LVGL to the project now. I read the basic documentation here
For the most part I have done everything correctly but my LCD seems to be misbehaving (Please see the attached LCD Image Output). It almost seems like the Frame Buffer is getting Corrupted somehow. Can anyone please help me out with this issue.
Here is my Initialisation Code for My LCD and LVGL:
#define LVGL_TICKS_MS 10
#define MY_DISP_HOR_RES 480
#define MY_DISP_VER_RES 320
#define BYTE_PER_PIXEL (LV_COLOR_FORMAT_GET_SIZE(LV_COLOR_FORMAT_RGB565))
struct repeating_timer lvgl_timer;
static uint8_t buf1[MY_DISP_HOR_RES * MY_DISP_VER_RES / 10 * BYTE_PER_PIXEL];
bool lvgl_timer_callback(struct repeating_timer* t)
{
lv_tick_inc(LVGL_TICKS_MS);
return true;
}
void my_disp_flush(lv_display_t* disp, const lv_area_t* area, lv_color_t* color_p)
{
ili9486_draw_bitmap(area->x1, area->y1, area->x2, area->y2, color_p);
lv_display_flush_ready(disp);
}
int main(void)
{
stdio_init_all();
gpio_set_function(led, GPIO_FUNC_SIO);
gpio_set_dir(led, GPIO_OUT);
ili9486_init();
ili9486_set_rotation(TFT_ROTATION_1);
lv_init(
lv_display_t* display = lv_display_create(MY_DISP_HOR_RES, MY_DISP_VER_RES);
lv_display_set_buffers(display, buf1, NULL, sizeof(buf1), LV_DISPLAY_RENDER_MODE_PARTIAL);
lv_display_set_flush_cb(display, (lv_display_flush_cb_t)my_disp_flush);
add_repeating_timer_ms(LVGL_TICKS_MS, lvgl_timer_callback, NULL, &lvgl_timer);
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003A57), LV_PART_MAIN);
while(1)
{
uint32_t lvgl_timer_delay = lv_timer_handler();
sleep_ms(lvgl_timer_delay);
}
}
Is there something that I’m missing here?
Thanks in Advance!
LCD Output Image: