#include "app_thread.h" #include "../lvgl/lvgl.h" #include "../lvgl/examples/lv_examples.h" #include "../lvgl/demos/lv_demos.h" #include "square_line/ui.h" #define TICK_MS_TIME 5 #define BUF_HOR_LINES 20 //DRAW BUFFER static lv_disp_draw_buf_t draw_buf; static lv_color_t buf1[DISPLAY_HSIZE_INPUT0 * BUF_HOR_LINES]; //DISPLAY DRIVER static lv_disp_drv_t disp_drv; static void my_flush_cb (lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p); const display_status_t* displayStatus; uint8_t * frameBuffer; /* App Thread entry function */ /* pvParameters contains TaskHandle_t */ void app_thread_entry(void *pvParameters) { FSP_PARAMETER_NOT_USED (pvParameters); fsp_err_t err = FSP_SUCCESS; /* Initialize GLCDC driver */ err = R_GLCDC_Open(&g_display_ctrl, &g_display_cfg); /* Handle error */ if(FSP_SUCCESS != err) { /* GLCDC initialization failed */ } /* Start GLCDC display output */ err = R_GLCDC_Start(&g_display_ctrl); /* Handle error */ if(FSP_SUCCESS != err) { /* GLCDC Start failed */ } //SETUP TIMER RELATED FUNCTIONALITY xTimerChangePeriod(g_timer_lvgl, pdMS_TO_TICKS(TICK_MS_TIME), 0 ); xTimerStart(g_timer_lvgl, 0); frameBuffer= (uint8_t *)fb_background; //START LVGL lv_init(); //INIT DRAW BUFFER lv_disp_draw_buf_init(&draw_buf, buf1, NULL, DISPLAY_HSIZE_INPUT0 * BUF_HOR_LINES); //INIT DISPLAY DRIVER lv_disp_drv_init(&disp_drv); disp_drv.draw_buf = &draw_buf; disp_drv.hor_res = DISPLAY_HSIZE_INPUT0; disp_drv.ver_res = DISPLAY_VSIZE_INPUT0; disp_drv.flush_cb = my_flush_cb; lv_disp_drv_register(&disp_drv); //lv_example_get_started_1(); //lv_example_bar_1(); //ui_init(); //lv_demo_widgets(); //lv_demo_benchmark(); lv_draw_ra6m3_g2d_init(); lv_example_label_1(); while (1) { lv_timer_handler(); vTaskDelay (pdMS_TO_TICKS(TICK_MS_TIME)); } lv_demo_widgets_close(); } void g_timer_lvgl_callback(TimerHandle_t xTimer) { FSP_PARAMETER_NOT_USED(xTimer); lv_tick_inc(TICK_MS_TIME); lv_timer_handler(); } void my_flush_cb (lv_disp_drv_t* displaydrv, const lv_area_t* area, lv_color_t* color_p) { /*int32_t x = 0; int32_t y = 0; uint32_t drawPos = 0; for(y = area->y1; y <= area->y2; y++) { for(x = area->x1; x <= area->x2; x++) { drawPos = (uint32_t)(y * disp_drv.hor_res + x); uint8_t col1 = (uint8_t)(color_p->full & 0xff); uint8_t col2 = (uint8_t)(color_p->full >> 8); fb_background[0][drawPos * 2] = col1; fb_background[0][(drawPos * 2)+1] = col2; color_p++; } }*/ lv_port_gpu_blit(area->x1, area->y1, color_p, area); lv_disp_flush_ready(displaydrv); }