Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BSP_DISCO_F746NG
Revision 3:4f5dc253eb7b, committed 2021-04-24
- Comitter:
- JohnnyK
- Date:
- Sat Apr 24 19:08:28 2021 +0000
- Parent:
- 2:afc050526249
- Child:
- 4:4208cec163ef
- Commit message:
- Rework to LVGL 7.10.1 and MbedOS 6.10
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F746NG.lib Sat Apr 24 19:08:28 2021 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#85dbcff443aa
--- a/Drivers/BSP_DISCO_F746NG.lib Tue Apr 07 08:06:45 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#85dbcff443aa
--- a/Drivers/lv_LCD/lv_port_disp.c Tue Apr 07 08:06:45 2020 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,270 +0,0 @@
-/**
- * @file lv_port_disp_templ.c
- *
- */
-
- /*Copy this file as "lv_port_disp.c" and set this value to "1" to enable content*/
-#if 1
-
-/*********************
- * INCLUDES
- *********************/
-#include "lv_port_disp.h"
-#include "lvgl/lvgl.h"
-#include "stm32f7xx.h"
-#include "stm32746g_discovery.h"
-#include "stm32746g_discovery_sdram.h"
-#include "stm32746g_discovery_lcd.h"
-#include "stm32746g_discovery_ts.h"
-
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * STATIC PROTOTYPES
- **********************/
-static void disp_init(void);
-
-static void disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p);
-
-#if LV_USE_GPU
-DMA2D_HandleTypeDef Dma2dHandle;
-static void DMA2D_Config(void);
-static void Error_Handler(void);
-static void DMA2D_TransferComplete(DMA2D_HandleTypeDef *hdma2d);
-static void DMA2D_TransferError(DMA2D_HandleTypeDef *hdma2d);
-static void gpu_blend(lv_disp_drv_t * disp_drv,lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
-static void gpu_fill(lv_disp_drv_t * disp_drv,lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color);
-#endif
-
-/**********************
- * STATIC VARIABLES
- **********************/
-
-/**********************
- * MACROS
- **********************/
-
-/**********************
- * GLOBAL FUNCTIONS
- **********************/
-
-void lv_port_disp_init(void)
-{
- /*-------------------------
- * Initialize your display
- * -----------------------*/
- disp_init();
-
- /*-----------------------------
- * Create a buffer for drawing
- *----------------------------*/
-
- /* LittlevGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row
- *
- * There are three buffering configurations:
- * 1. Create ONE buffer with some rows:
- * LittlevGL will draw the display's content here and writes it to your display
- *
- * 2. Create TWO buffer with some rows:
- * LittlevGL will draw the display's content to a buffer and writes it your display.
- * You should use DMA to write the buffer's content to the display.
- * It will enable LittlevGL to draw the next part of the screen to the other buffer while
- * the data is being sent form the first buffer. It makes rendering and flushing parallel.
- *
- * 3. Create TWO screen-sized buffer:
- * Similar to 2) but the buffer have to be screen sized. When LittlevGL is ready it will give the
- * whole frame to display. This way you only need to change the frame buffer's address instead of
- * copying the pixels.
- * */
-
- /* Example for 1) */
- static lv_disp_buf_t disp_buf_1;
- static lv_color_t buf1_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
- lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
-
- /* Example for 2) */
- //static lv_disp_buf_t disp_buf_2;
- //static lv_color_t buf2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
- //static lv_color_t buf2_2[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/
- //lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
-
- /* Example for 3) */
- //static lv_disp_buf_t disp_buf_3;
- //static lv_color_t buf3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/
- //static lv_color_t buf3_2[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/
- //lv_disp_buf_init(&disp_buf_3, buf3_1, buf3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
-
-
- /*-----------------------------------
- * Register the display in LittlevGL
- *----------------------------------*/
-
- lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
- lv_disp_drv_init(&disp_drv); /*Basic initialization*/
- /*Set up the functions to access to your display*/
- /*Set the resolution of the display*/
- 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_1;
-#if LV_USE_GPU
- /*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/
- DMA2D_Config();
- /*Blend two color array using opacity*/
- disp_drv.gpu_blend_cb = gpu_blend;
- /*Fill a memory array with a color*/
- disp_drv.gpu_fill_cb = gpu_fill;
-#endif
- /*Finally register the driver*/
- lv_disp_drv_register(&disp_drv);
-}
-
-/**********************
- * STATIC FUNCTIONS
- **********************/
-
-/* Initialize your display and the required peripherals. */
-static void disp_init(void){
- /*You code here*/
- BSP_LCD_Init();
-#if LV_COLOR_DEPTH == 16
- Dma2dHandle.LayerCfg[0].InputColorMode = DMA2D_INPUT_RGB565;
- BSP_LCD_LayerRgb565Init(1, LCD_FB_START_ADDRESS));
-#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
- BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
-#endif
- BSP_LCD_DisplayOn();
- BSP_LCD_SelectLayer(0);
-}
-
-/* Flush the content of the internal buffer the specific area on the display
- * You can use DMA or any hardware acceleration to do this operation in the background but
- * 'lv_disp_flush_ready()' has to be called when finished. */
-static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p){
- //The most simple case (but also the slowest) to put all pixels to the screen one-by-one
- uint16_t x, y;
- for(y = area->y1; y <= area->y2; y++) {
- for(x = area->x1; x <= area->x2; x++) {
- //put_px(x, y, *color_p)
- BSP_LCD_DrawPixel( x, y, color_p->full);
- color_p++;
- }
- }
- // IMPORTANT!!!* Inform the graphics library that you are ready with the flushing
- lv_disp_flush_ready(disp_drv);
-}
-
-
-/*OPTIONAL: GPU INTERFACE*/
-#if LV_USE_GPU
-
-/* If your MCU has hardware accelerator (GPU) then you can use it to blend to memories using opacity
- * It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/
-
-static void DMA2D_Config(void){
- //onfigure the DMA2D Mode, Color Mode and output offset
- Dma2dHandle.Init.Mode = DMA2D_M2M_BLEND;
-#if LV_COLOR_DEPTH == 16
- Dma2dHandle.Init.ColorMode = DMA2D_RGB565;
-#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
- Dma2dHandle.Init.ColorMode = DMA2D_ARGB8888;
-#endif
- Dma2dHandle.Init.OutputOffset = 0x0;
- //DMA2D Callbacks Configuration
- Dma2dHandle.XferCpltCallback = DMA2D_TransferComplete;
- Dma2dHandle.XferErrorCallback = DMA2D_TransferError;
- //Foreground Configuration
- Dma2dHandle.LayerCfg[1].AlphaMode = DMA2D_REPLACE_ALPHA;
- Dma2dHandle.LayerCfg[1].InputAlpha = 0xFF;
-#if LV_COLOR_DEPTH == 16
- Dma2dHandle.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
-#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
- Dma2dHandle.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888;
-#endif
- Dma2dHandle.LayerCfg[1].InputOffset = 0x0;
- //Background Configuration
- Dma2dHandle.LayerCfg[0].AlphaMode = DMA2D_REPLACE_ALPHA;
- Dma2dHandle.LayerCfg[0].InputAlpha = 0xFF;
-#if LV_COLOR_DEPTH == 16
- Dma2dHandle.LayerCfg[0].InputColorMode = DMA2D_INPUT_RGB565;
-#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
- Dma2dHandle.LayerCfg[0].InputColorMode = DMA2D_INPUT_ARGB8888;
-#endif
- Dma2dHandle.LayerCfg[0].InputOffset = 0x0;
- Dma2dHandle.Instance = DMA2D;
- //DMA2D Initialization
- if(HAL_DMA2D_Init(&Dma2dHandle) != HAL_OK){
- Error_Handler();// Initialization Error
- }
- HAL_DMA2D_ConfigLayer(&Dma2dHandle, 0);
- HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1);
-}
-
-static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa){
- /*Wait for the previous operation*/
- HAL_DMA2D_PollForTransfer(&Dma2dHandle, 100);
- Dma2dHandle.Init.Mode = DMA2D_M2M_BLEND;
- /* DMA2D Initialization */
- if(HAL_DMA2D_Init(&Dma2dHandle) != HAL_OK){
- /* Initialization Error */
- while(1);
- }
- Dma2dHandle.LayerCfg[1].InputAlpha = opa;
- HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1);
- HAL_DMA2D_BlendingStart(&Dma2dHandle, (uint32_t) src, (uint32_t) dest, (uint32_t)dest, length, 1);
-}
-
-/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color
- * It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/
-static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color){
- /*Wait for the previous operation*/
- HAL_DMA2D_PollForTransfer(&Dma2dHandle, 100);
- Dma2dHandle.Init.Mode = DMA2D_R2M;
- /* DMA2D Initialization */
- if(HAL_DMA2D_Init(&Dma2dHandle) != HAL_OK){
- /* Initialization Error */
- while(1);
- }
- Dma2dHandle.LayerCfg[1].InputAlpha = 0xff;
- HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1);
- lv_color_t * dest_buf_ofs = dest_buf;
- dest_buf_ofs += dest_width * fill_area->y1;
- dest_buf_ofs += fill_area->x1;
- lv_coord_t area_w = lv_area_get_width(fill_area);
- uint32_t i;
- for(i = fill_area->y1; i <= fill_area->y2; i++) {
- /*Wait for the previous operation*/
- HAL_DMA2D_PollForTransfer(&Dma2dHandle, 100);
- HAL_DMA2D_BlendingStart(&Dma2dHandle, (uint32_t) lv_color_to32(color), (uint32_t) dest_buf_ofs, (uint32_t)dest_buf_ofs, area_w, 1);
- dest_buf_ofs += dest_width;
- }
-}
-
-static void Error_Handler(void){
- while(1){}
-}
-
-static void DMA2D_TransferComplete(DMA2D_HandleTypeDef *hdma2d){
-
-}
-
-static void DMA2D_TransferError(DMA2D_HandleTypeDef *hdma2d){
-
-}
-
-#endif /*LV_USE_GPU*/
-
-#else /* Enable this file at the top */
-
-/* This dummy typedef exists purely to silence -Wpedantic. */
-typedef int keep_pedantic_happy;
-#endif
-
--- a/Drivers/lv_LCD/lv_port_disp.h Tue Apr 07 08:06:45 2020 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/**
- * @file lv_port_disp_templ.h
- *
- */
-
- /*Copy this file as "lv_port_disp.h" and set this value to "1" to enable content*/
-#if 1
-
-#ifndef LV_PORT_DISP_H
-#define LV_PORT_DISP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*********************
- * INCLUDES
- *********************/
-#include "lvgl/lvgl.h"
-
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * GLOBAL PROTOTYPES
- **********************/
- void lv_port_disp_init(void);
-/**********************
- * MACROS
- **********************/
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /*LV_PORT_DISP_TEMPL_H*/
-
-#endif /*Disable/Enable content*/
-
--- a/Drivers/lv_TS/lv_port_indev.c Tue Apr 07 08:06:45 2020 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,480 +0,0 @@
-/**
- * @file lv_port_indev_templ.c
- *
- */
-
- /*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/
-#if 1
-
-/*********************
- * INCLUDES
- *********************/
-#include "lv_port_indev.h"
-#include "../lv_core/lv_indev.h"
-#include "stm32746g_discovery.h"
-#include "stm32746g_discovery_lcd.h"
-#include "stm32746g_discovery_ts.h"
-
-/*********************
- * DEFINES
- *********************/
-#define TOUCHPAD 1
-#define KEYBOARD 0
-#define MOUSE 0
-#define ENCODER 0
-#define BUTTON 0
-
-
-/**********************
- * TYPEDEFS
- **********************/
-TS_StateTypeDef TS_State;
-/**********************
- * STATIC PROTOTYPES
- **********************/
-#if TOUCHPAD ==1
-static void touchpad_init(void);
-static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
-static bool touchpad_is_pressed(void);
-static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y);
-#endif
-#if MOUSE == 1
-static void mouse_init(void);
-static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
-static bool mouse_is_pressed(void);
-static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y);
-#endif
-#if KEYBOARD == 1
-static void keypad_init(void);
-static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
-static uint32_t keypad_get_key(void);
-#endif
-#if ENCODER == 1
-static void encoder_init(void);
-static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
-static void encoder_handler(void);
-#endif
-#if BUTTON == 1
-static void button_init(void);
-static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
-static int8_t button_get_pressed_id(void);
-static bool button_is_pressed(uint8_t id);
-#endif
-
-/**********************
- * STATIC VARIABLES
- **********************/
-#if TOUCHPAD == 1
-lv_indev_t * indev_touchpad;
-#endif
-#if MOUSE == 1
-lv_indev_t * indev_mouse;
-#endif
-#if KEYBOARD == 1
-lv_indev_t * indev_keypad;
-#endif
-#if ENCODER == 1
-lv_indev_t * indev_encoder;
-#endif
-#if BUTTON == 1
-lv_indev_t * indev_button;
-#endif
-
-#if ENCODER == 1
-static int32_t encoder_diff;
-static lv_indev_state_t encoder_state;
-#endif
-/**********************
- * MACROS
- **********************/
-
-/**********************
- * GLOBAL FUNCTIONS
- **********************/
-
-void lv_port_indev_init(void)
-{
- /* Here you will find example implementation of input devices supported by LittelvGL:
- * - Touchpad
- * - Mouse (with cursor support)
- * - Keypad (supports GUI usage only with key)
- * - Encoder (supports GUI usage only with: left, right, push)
- * - Button (external buttons to press points on the screen)
- *
- * The `..._read()` function are only examples.
- * You should shape them according to your hardware
- */
-
- lv_indev_drv_t indev_drv;
-#if TOUCHPAD ==1
- /*------------------
- * Touchpad
- * -----------------*/
-
- /*Initialize your touchpad if you have*/
- touchpad_init();
-
- /*Register a touchpad input device*/
- lv_indev_drv_init(&indev_drv);
- indev_drv.type = LV_INDEV_TYPE_POINTER;
- indev_drv.read_cb = touchpad_read;
- indev_touchpad = lv_indev_drv_register(&indev_drv);
-
-#endif
-#if MOUSE == 1
-
- /*------------------
- * Mouse
- * -----------------*/
-
- /*Initialize your touchpad if you have*/
- mouse_init();
-
- /*Register a mouse input device*/
- lv_indev_drv_init(&indev_drv);
- indev_drv.type = LV_INDEV_TYPE_POINTER;
- indev_drv.read_cb = mouse_read;
- indev_mouse = lv_indev_drv_register(&indev_drv);
-
- /*Set cursor. For simplicity set a HOME symbol now.*/
- lv_obj_t * mouse_cursor = lv_img_create(lv_disp_get_scr_act(NULL), NULL);
- lv_img_set_src(mouse_cursor, LV_SYMBOL_HOME);
- lv_indev_set_cursor(indev_mouse, mouse_cursor);
-
-#endif
-#if KEYBOARD == 1
-
- /*------------------
- * Keypad
- * -----------------*/
-
- /*Initialize your keypad or keyboard if you have*/
- keypad_init();
-
- /*Register a keypad input device*/
- lv_indev_drv_init(&indev_drv);
- indev_drv.type = LV_INDEV_TYPE_KEYPAD;
- indev_drv.read_cb = keypad_read;
- indev_keypad = lv_indev_drv_register(&indev_drv);
-
- /* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
- * add objects to the group with `lv_group_add_obj(group, obj)`
- * and assign this input device to group to navigate in it:
- * `lv_indev_set_group(indev_keypad, group);` */
-
-#endif
-#if ENCODER == 1
-
- /*------------------
- * Encoder
- * -----------------*/
-
- /*Initialize your encoder if you have*/
- encoder_init();
-
- /*Register a encoder input device*/
- lv_indev_drv_init(&indev_drv);
- indev_drv.type = LV_INDEV_TYPE_KEYPAD;
- indev_drv.read_cb = encoder_read;
- indev_encoder = lv_indev_drv_register(&indev_drv);
-
- /* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
- * add objects to the group with `lv_group_add_obj(group, obj)`
- * and assign this input device to group to navigate in it:
- * `lv_indev_set_group(indev_keypad, group);` */
-
-#endif
-#if BUTTON == 1
-
- /*------------------
- * Button
- * -----------------*/
-
- /*Initialize your button if you have*/
- button_init();
-
- /*Register a button input device*/
- lv_indev_drv_init(&indev_drv);
- indev_drv.type = LV_INDEV_TYPE_BUTTON;
- indev_drv.read_cb = button_read;
- indev_button = lv_indev_drv_register(&indev_drv);
-
- /*Assign buttons to points on the screen*/
- static const lv_point_t btn_points[2] = {
- {10, 10}, /*Button 0 -> x:10; y:10*/
- {40, 100}, /*Button 1 -> x:40; y:100*/
- };
- lv_indev_set_button_points(indev_button, btn_points);
-
-#endif
-}
-
-/**********************
- * STATIC FUNCTIONS
- **********************/
-
-
-#if TOUCHPAD ==1
-/*------------------
- * Touchpad
- * -----------------*/
-
-/*Initialize your touchpad*/
-static void touchpad_init(void)
-{
- /*Your code comes here*/
- BSP_TS_Init(BSP_LCD_GetXSize(),BSP_LCD_GetYSize());
-}
-
-/* Will be called by the library to read the touchpad */
-static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
-{
- static lv_coord_t last_x = 0;
- static lv_coord_t last_y = 0;
-
- /*Save the pressed coordinates and the state*/
- BSP_TS_GetState(&TS_State);
- if(touchpad_is_pressed()) {
- touchpad_get_xy(&last_x, &last_y);
- data->state = LV_INDEV_STATE_PR;
- } else {
- data->state = LV_INDEV_STATE_REL;
- }
-
- /*Set the last pressed coordinates*/
- data->point.x = last_x;
- data->point.y = last_y;
-
- /*Return `false` because we are not buffering and no more data to read*/
- return false;
-}
-
-/*Return true is the touchpad is pressed*/
-static bool touchpad_is_pressed(void)
-{
- /*Your code comes here*/
- return TS_State.touchDetected;
-}
-
-/*Get the x and y coordinates if the touchpad is pressed*/
-static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
-{
- /*Your code comes here*/
- (*x) = TS_State.touchX[0];
- (*y) = TS_State.touchY[0];
-}
-
-#endif
-#if MOUSE == 1
-
-/*------------------
- * Mouse
- * -----------------*/
-
-/* Initialize your mouse */
-static void mouse_init(void)
-{
- /*Your code comes here*/
-}
-
-/* Will be called by the library to read the mouse */
-static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
-{
- /*Get the current x and y coordinates*/
- mouse_get_xy(&data->point.x, &data->point.y);
-
- /*Get whether the mouse button is pressed or released*/
- if(mouse_is_pressed()) {
- data->state = LV_INDEV_STATE_PR;
- } else {
- data->state = LV_INDEV_STATE_REL;
- }
-
- /*Return `false` because we are not buffering and no more data to read*/
- return false;
-}
-
-/*Return true is the mouse button is pressed*/
-static bool mouse_is_pressed(void)
-{
- /*Your code comes here*/
-
- return false;
-}
-
-/*Get the x and y coordinates if the mouse is pressed*/
-static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y)
-{
- /*Your code comes here*/
-
- (*x) = 0;
- (*y) = 0;
-}
-
-#endif
-#if KEYBOARD == 1
-
-/*------------------
- * Keypad
- * -----------------*/
-
-/* Initialize your keypad */
-static void keypad_init(void)
-{
- /*Your code comes here*/
-}
-
-/* Will be called by the library to read the mouse */
-static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
-{
- static uint32_t last_key = 0;
-
- /*Get the current x and y coordinates*/
- mouse_get_xy(&data->point.x, &data->point.y);
-
- /*Get whether the a key is pressed and save the pressed key*/
- uint32_t act_key = keypad_get_key();
- if(act_key != 0) {
- data->state = LV_INDEV_STATE_PR;
-
- /*Translate the keys to LittlevGL control characters according to your key definitions*/
- switch(act_key) {
- case 1:
- act_key = LV_KEY_NEXT;
- break;
- case 2:
- act_key = LV_KEY_PREV;
- break;
- case 3:
- act_key = LV_KEY_LEFT;
- break;
- case 4:
- act_key = LV_KEY_RIGHT;
- break;
- case 5:
- act_key = LV_KEY_ENTER;
- break;
- }
-
- last_key = act_key;
- } else {
- data->state = LV_INDEV_STATE_REL;
- }
-
- data->key = last_key;
-
- /*Return `false` because we are not buffering and no more data to read*/
- return false;
-}
-
-/*Get the currently being pressed key. 0 if no key is pressed*/
-static uint32_t keypad_get_key(void)
-{
- /*Your code comes here*/
-
- return 0;
-}
-
-#endif
-#if ENCODER == 1
-
-/*------------------
- * Encoder
- * -----------------*/
-
-/* Initialize your keypad */
-static void encoder_init(void)
-{
- /*Your code comes here*/
-}
-
-/* Will be called by the library to read the encoder */
-static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
-{
-
- data->enc_diff = encoder_diff;
- data->state = encoder_state;
-
- /*Return `false` because we are not buffering and no more data to read*/
- return false;
-}
-
-/*Call this function in an interrupt to process encoder events (turn, press)*/
-static void encoder_handler(void)
-{
- /*Your code comes here*/
-
- encoder_diff += 0;
- encoder_state = LV_INDEV_STATE_REL;
-}
-
-#endif
-#if BUTTON == 1
-
-/*------------------
- * Button
- * -----------------*/
-
-/* Initialize your buttons */
-static void button_init(void)
-{
- /*Your code comes here*/
-}
-
-/* Will be called by the library to read the button */
-static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
-{
-
- static uint8_t last_btn = 0;
-
- /*Get the pressed button's ID*/
- int8_t btn_act = button_get_pressed_id();
-
- if(btn_act >= 0) {
- data->state = LV_INDEV_STATE_PR;
- last_btn = btn_act;
- } else {
- data->state = LV_INDEV_STATE_REL;
- }
-
- /*Save the last pressed button's ID*/
- data->btn_id = last_btn;
-
- /*Return `false` because we are not buffering and no more data to read*/
- return false;
-}
-
-/*Get ID (0, 1, 2 ..) of the pressed button*/
-static int8_t button_get_pressed_id(void)
-{
- uint8_t i;
-
- /*Check to buttons see which is being pressed (assume there are 2 buttons)*/
- for(i = 0; i < 2; i++) {
- /*Return the pressed button's ID*/
- if(button_is_pressed(i)) {
- return i;
- }
- }
-
- /*No button pressed*/
- return -1;
-}
-
-/*Test if `id` button is pressed or not*/
-static bool button_is_pressed(uint8_t id)
-{
-
- /*Your code comes here*/
-
- return false;
-}
-#endif
-
-
-#else /* Enable this file at the top */
-
-/* This dummy typedef exists purely to silence -Wpedantic. */
-typedef int keep_pedantic_happy;
-#endif
-
--- a/Drivers/lv_TS/lv_port_indev.h Tue Apr 07 08:06:45 2020 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-
-/**
- * @file lv_port_indev_templ.h
- *
- */
-
- /*Copy this file as "lv_port_indev.h" and set this value to "1" to enable content*/
-#if 1
-
-#ifndef LV_PORT_INDEV_H
-#define LV_PORT_INDEV_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*********************
- * INCLUDES
- *********************/
-#include "lvgl/lvgl.h"
-
-/*********************
- * DEFINES
- *********************/
-
-/**********************
- * TYPEDEFS
- **********************/
-
-/**********************
- * GLOBAL PROTOTYPES
- **********************/
-void lv_port_indev_init(void);
-/**********************
- * MACROS
- **********************/
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /*LV_PORT_INDEV_TEMPL_H*/
-
-#endif /*Disable/Enable content*/
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hal_stm_lvgl/tft/tft.c Sat Apr 24 19:08:28 2021 +0000
@@ -0,0 +1,606 @@
+/**
+ * @file tft.c
+ *
+ */
+
+/*********************
+ * INCLUDES
+ *********************/
+#include "lv_conf.h"
+#include "lvgl/lvgl.h"
+#include <string.h>
+#include <stdlib.h>
+
+#include "tft.h"
+#include "stm32f7xx.h"
+#include "stm32746g_discovery.h"
+#include "stm32746g_discovery_sdram.h"
+#include "stm32746g_discovery_ts.h"
+#include "../Components/rk043fn48h/rk043fn48h.h"
+
+/*********************
+ * DEFINES
+ *********************/
+
+#if LV_COLOR_DEPTH != 16 && LV_COLOR_DEPTH != 24 && LV_COLOR_DEPTH != 32
+#error LV_COLOR_DEPTH must be 16, 24, or 32
+#endif
+
+/**
+ * @brief LCD status structure definition
+ */
+#define LCD_OK ((uint8_t)0x00)
+#define LCD_ERROR ((uint8_t)0x01)
+#define LCD_TIMEOUT ((uint8_t)0x02)
+
+/**
+ * @brief LCD special pins
+ */
+/* Display enable pin */
+#define LCD_DISP_PIN GPIO_PIN_12
+#define LCD_DISP_GPIO_PORT GPIOI
+#define LCD_DISP_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE()
+#define LCD_DISP_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE()
+
+/* Backlight control pin */
+#define LCD_BL_CTRL_PIN GPIO_PIN_3
+#define LCD_BL_CTRL_GPIO_PORT GPIOK
+#define LCD_BL_CTRL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOK_CLK_ENABLE()
+#define LCD_BL_CTRL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOK_CLK_DISABLE()
+
+#define CPY_BUF_DMA_STREAM DMA2_Stream0
+#define CPY_BUF_DMA_CHANNEL DMA_CHANNEL_0
+#define CPY_BUF_DMA_STREAM_IRQ DMA2_Stream0_IRQn
+#define CPY_BUF_DMA_STREAM_IRQHANDLER DMA2_Stream0_IRQHandler
+
+/**********************
+ * TYPEDEFS
+ **********************/
+
+/**********************
+ * STATIC PROTOTYPES
+ **********************/
+
+/*These 3 functions are needed by LittlevGL*/
+static void ex_disp_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t * color_p);
+#if LV_USE_GPU
+static void gpu_mem_blend(lv_disp_drv_t *disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
+static void gpu_mem_fill(lv_disp_drv_t *disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color);
+#endif
+
+static uint8_t LCD_Init(void);
+static void LCD_LayerRgb565Init(uint32_t FB_Address);
+static void LCD_DisplayOn(void);
+
+static void DMA_Config(void);
+static void DMA_TransferComplete(DMA_HandleTypeDef *han);
+static void DMA_TransferError(DMA_HandleTypeDef *han);
+
+#if LV_USE_GPU
+static void DMA2D_Config(void);
+#endif
+
+/**********************
+ * STATIC VARIABLES
+ **********************/
+#if LV_USE_GPU
+static DMA2D_HandleTypeDef Dma2dHandle;
+#endif
+static LTDC_HandleTypeDef hLtdcHandler;
+
+#if LV_COLOR_DEPTH == 16
+typedef uint16_t uintpixel_t;
+#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
+typedef uint32_t uintpixel_t;
+#endif
+
+/* You can try to change buffer to internal ram by uncommenting line below and commenting
+ * SDRAM one. */
+//static uintpixel_t my_fb[TFT_HOR_RES * TFT_VER_RES];
+
+static __IO uintpixel_t * my_fb = (__IO uintpixel_t*) (SDRAM_DEVICE_ADDR);
+
+static DMA_HandleTypeDef DmaHandle;
+static int32_t x1_flush;
+static int32_t y1_flush;
+static int32_t x2_flush;
+static int32_t y2_fill;
+static int32_t y_fill_act;
+static const lv_color_t * buf_to_flush;
+
+static lv_disp_t *our_disp = NULL;
+/**********************
+ * MACROS
+ **********************/
+
+/**
+ * Initialize your display here
+ */
+
+void tft_init(void)
+{
+ /* There is only one display on STM32 */
+ if(our_disp != NULL)
+ abort();
+ /* LCD Initialization */
+ LCD_Init();
+
+ /* LCD Initialization */
+ LCD_LayerRgb565Init((uint32_t)my_fb);
+
+ /* Enable the LCD */
+ LCD_DisplayOn();
+
+ DMA_Config();
+
+#if LV_USE_GPU != 0
+ DMA2D_Config();
+#endif
+ /*-----------------------------
+ * Create a buffer for drawing
+ *----------------------------*/
+
+ /* LittlevGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row*/
+
+ static lv_disp_buf_t disp_buf_1;
+ static lv_color_t buf1_1[LV_HOR_RES_MAX * 68];
+ static lv_color_t buf1_2[LV_HOR_RES_MAX * 68];
+ lv_disp_buf_init(&disp_buf_1, buf1_1, buf1_2, LV_HOR_RES_MAX * 68); /*Initialize the display buffer*/
+
+
+ /*-----------------------------------
+ * Register the display in LittlevGL
+ *----------------------------------*/
+
+ lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
+ lv_disp_drv_init(&disp_drv); /*Basic initialization*/
+
+ /*Set up the functions to access to your display*/
+
+ /*Set the resolution of the display*/
+ disp_drv.hor_res = 480;
+ disp_drv.ver_res = 272;
+
+ /*Used to copy the buffer's content to the display*/
+ disp_drv.flush_cb = ex_disp_flush;
+
+ /*Set a display buffer*/
+ disp_drv.buffer = &disp_buf_1;
+
+
+ /*Finally register the driver*/
+ our_disp = lv_disp_drv_register(&disp_drv);
+}
+
+/**********************
+ * STATIC FUNCTIONS
+ **********************/
+
+/* Flush the content of the internal buffer the specific area on the display
+ * You can use DMA or any hardware acceleration to do this operation in the background but
+ * 'lv_flush_ready()' has to be called when finished
+ * This function is required only when LV_VDB_SIZE != 0 in lv_conf.h*/
+static void ex_disp_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t * color_p)
+{
+ int32_t x1 = area->x1;
+ int32_t x2 = area->x2;
+ int32_t y1 = area->y1;
+ int32_t y2 = area->y2;
+ /*Return if the area is out the screen*/
+
+ if(x2 < 0) return;
+ if(y2 < 0) return;
+ if(x1 > TFT_HOR_RES - 1) return;
+ if(y1 > TFT_VER_RES - 1) return;
+
+ /*Truncate the area to the screen*/
+ int32_t act_x1 = x1 < 0 ? 0 : x1;
+ int32_t act_y1 = y1 < 0 ? 0 : y1;
+ int32_t act_x2 = x2 > TFT_HOR_RES - 1 ? TFT_HOR_RES - 1 : x2;
+ int32_t act_y2 = y2 > TFT_VER_RES - 1 ? TFT_VER_RES - 1 : y2;
+
+ x1_flush = act_x1;
+ y1_flush = act_y1;
+ x2_flush = act_x2;
+ y2_fill = act_y2;
+ y_fill_act = act_y1;
+ buf_to_flush = color_p;
+
+ SCB_CleanInvalidateDCache();
+ SCB_InvalidateICache();
+ /*##-7- Start the DMA transfer using the interrupt mode #*/
+ /* Configure the source, destination and buffer size DMA fields and Start DMA Stream transfer */
+ /* Enable All the DMA interrupts */
+ HAL_StatusTypeDef err;
+ uint32_t length = (x2_flush - x1_flush + 1);
+#if LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
+ length *= 2; /* STM32 DMA uses 16-bit chunks so multiply by 2 for 32-bit color */
+#endif
+ err = HAL_DMA_Start_IT(&DmaHandle,(uint32_t)buf_to_flush, (uint32_t)&my_fb[y_fill_act * TFT_HOR_RES + x1_flush],
+ length);
+ if(err != HAL_OK)
+ {
+ while(1); /*Halt on error*/
+ }
+}
+
+
+/**
+ * @brief Configure LCD pins, and peripheral clocks.
+ */
+static void LCD_MspInit(void)
+{
+ GPIO_InitTypeDef gpio_init_structure;
+
+ /* Enable the LTDC and DMA2D clocks */
+ __HAL_RCC_LTDC_CLK_ENABLE();
+#if LV_USE_GPU != 0
+ __HAL_RCC_DMA2D_CLK_ENABLE();
+#endif
+ /* Enable GPIOs clock */
+ __HAL_RCC_GPIOE_CLK_ENABLE();
+ __HAL_RCC_GPIOG_CLK_ENABLE();
+ __HAL_RCC_GPIOI_CLK_ENABLE();
+ __HAL_RCC_GPIOJ_CLK_ENABLE();
+ __HAL_RCC_GPIOK_CLK_ENABLE();
+ LCD_DISP_GPIO_CLK_ENABLE();
+ LCD_BL_CTRL_GPIO_CLK_ENABLE();
+
+ /*** LTDC Pins configuration ***/
+ /* GPIOE configuration */
+ gpio_init_structure.Pin = GPIO_PIN_4;
+ gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+ gpio_init_structure.Pull = GPIO_NOPULL;
+ gpio_init_structure.Speed = GPIO_SPEED_FAST;
+ gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+ HAL_GPIO_Init(GPIOE, &gpio_init_structure);
+
+ /* GPIOG configuration */
+ gpio_init_structure.Pin = GPIO_PIN_12;
+ gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+ gpio_init_structure.Alternate = GPIO_AF9_LTDC;
+ HAL_GPIO_Init(GPIOG, &gpio_init_structure);
+
+ /* GPIOI LTDC alternate configuration */
+ gpio_init_structure.Pin = GPIO_PIN_9 | GPIO_PIN_10 | \
+ GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+ gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+ gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+ HAL_GPIO_Init(GPIOI, &gpio_init_structure);
+
+ /* GPIOJ configuration */
+ gpio_init_structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | \
+ GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | \
+ GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | \
+ GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+ gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+ gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+ HAL_GPIO_Init(GPIOJ, &gpio_init_structure);
+
+ /* GPIOK configuration */
+ gpio_init_structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_4 | \
+ GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7;
+ gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+ gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+ HAL_GPIO_Init(GPIOK, &gpio_init_structure);
+
+ /* LCD_DISP GPIO configuration */
+ gpio_init_structure.Pin = LCD_DISP_PIN; /* LCD_DISP pin has to be manually controlled */
+ gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
+ HAL_GPIO_Init(LCD_DISP_GPIO_PORT, &gpio_init_structure);
+
+ /* LCD_BL_CTRL GPIO configuration */
+ gpio_init_structure.Pin = LCD_BL_CTRL_PIN; /* LCD_BL_CTRL pin has to be manually controlled */
+ gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
+ HAL_GPIO_Init(LCD_BL_CTRL_GPIO_PORT, &gpio_init_structure);
+}
+
+/**
+ * @brief Configure LTDC PLL.
+ */
+static void LCD_ClockConfig(void)
+{
+ static RCC_PeriphCLKInitTypeDef periph_clk_init_struct;
+
+ /* RK043FN48H LCD clock configuration */
+ /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
+ /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */
+ /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/5 = 38.4 Mhz */
+ /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_4 = 38.4/4 = 9.6Mhz */
+ periph_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
+ periph_clk_init_struct.PLLSAI.PLLSAIN = 192;
+ periph_clk_init_struct.PLLSAI.PLLSAIR = RK043FN48H_FREQUENCY_DIVIDER;
+ periph_clk_init_struct.PLLSAIDivR = RCC_PLLSAIDIVR_4;
+ HAL_RCCEx_PeriphCLKConfig(&periph_clk_init_struct);
+}
+
+/**
+ * @brief Initializes the LCD.
+ * @retval LCD state
+ */
+static uint8_t LCD_Init(void)
+{
+ /* Select the used LCD */
+
+ /* The RK043FN48H LCD 480x272 is selected */
+ /* Timing Configuration */
+ hLtdcHandler.Init.HorizontalSync = (RK043FN48H_HSYNC - 1);
+ hLtdcHandler.Init.VerticalSync = (RK043FN48H_VSYNC - 1);
+ hLtdcHandler.Init.AccumulatedHBP = (RK043FN48H_HSYNC + RK043FN48H_HBP - 1);
+ hLtdcHandler.Init.AccumulatedVBP = (RK043FN48H_VSYNC + RK043FN48H_VBP - 1);
+ hLtdcHandler.Init.AccumulatedActiveH = (RK043FN48H_HEIGHT + RK043FN48H_VSYNC + RK043FN48H_VBP - 1);
+ hLtdcHandler.Init.AccumulatedActiveW = (RK043FN48H_WIDTH + RK043FN48H_HSYNC + RK043FN48H_HBP - 1);
+ hLtdcHandler.Init.TotalHeigh = (RK043FN48H_HEIGHT + RK043FN48H_VSYNC + RK043FN48H_VBP + RK043FN48H_VFP - 1);
+ hLtdcHandler.Init.TotalWidth = (RK043FN48H_WIDTH + RK043FN48H_HSYNC + RK043FN48H_HBP + RK043FN48H_HFP - 1);
+
+ /* LCD clock configuration */
+ LCD_ClockConfig();
+
+ /* Initialize the LCD pixel width and pixel height */
+ hLtdcHandler.LayerCfg->ImageWidth = RK043FN48H_WIDTH;
+ hLtdcHandler.LayerCfg->ImageHeight = RK043FN48H_HEIGHT;
+
+ /* Background value */
+ hLtdcHandler.Init.Backcolor.Blue = 0;
+ hLtdcHandler.Init.Backcolor.Green = 0;
+ hLtdcHandler.Init.Backcolor.Red = 0;
+
+ /* Polarity */
+ hLtdcHandler.Init.HSPolarity = LTDC_HSPOLARITY_AL;
+ hLtdcHandler.Init.VSPolarity = LTDC_VSPOLARITY_AL;
+ hLtdcHandler.Init.DEPolarity = LTDC_DEPOLARITY_AL;
+ hLtdcHandler.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
+ hLtdcHandler.Instance = LTDC;
+
+ if(HAL_LTDC_GetState(&hLtdcHandler) == HAL_LTDC_STATE_RESET)
+ {
+ /* Initialize the LCD Msp: this __weak function can be rewritten by the application */
+ LCD_MspInit();
+ }
+ HAL_LTDC_Init(&hLtdcHandler);
+
+ /* Assert display enable LCD_DISP pin */
+ HAL_GPIO_WritePin(LCD_DISP_GPIO_PORT, LCD_DISP_PIN, GPIO_PIN_SET);
+
+ /* Assert backlight LCD_BL_CTRL pin */
+ HAL_GPIO_WritePin(LCD_BL_CTRL_GPIO_PORT, LCD_BL_CTRL_PIN, GPIO_PIN_SET);
+
+ BSP_SDRAM_Init();
+
+ uint32_t i;
+ for(i = 0; i < (TFT_HOR_RES * TFT_VER_RES) ; i++)
+ {
+ my_fb[i] = 0;
+ }
+
+ return LCD_OK;
+}
+
+static void LCD_LayerRgb565Init(uint32_t FB_Address)
+{
+ LTDC_LayerCfgTypeDef layer_cfg;
+
+ /* Layer Init */
+ layer_cfg.WindowX0 = 0;
+ layer_cfg.WindowX1 = TFT_HOR_RES;
+ layer_cfg.WindowY0 = 0;
+ layer_cfg.WindowY1 = TFT_VER_RES;
+
+#if LV_COLOR_DEPTH == 16
+ layer_cfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
+#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
+ layer_cfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;
+#else
+#error Unsupported color depth (see tft.c)
+#endif
+ layer_cfg.FBStartAdress = FB_Address;
+ layer_cfg.Alpha = 255;
+ layer_cfg.Alpha0 = 0;
+ layer_cfg.Backcolor.Blue = 0;
+ layer_cfg.Backcolor.Green = 0;
+ layer_cfg.Backcolor.Red = 0;
+ layer_cfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
+ layer_cfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
+ layer_cfg.ImageWidth = TFT_HOR_RES;
+ layer_cfg.ImageHeight = TFT_VER_RES;
+
+ HAL_LTDC_ConfigLayer(&hLtdcHandler, &layer_cfg, 0);
+}
+
+static void LCD_DisplayOn(void)
+{
+ /* Display On */
+ __HAL_LTDC_ENABLE(&hLtdcHandler);
+ HAL_GPIO_WritePin(LCD_DISP_GPIO_PORT, LCD_DISP_PIN, GPIO_PIN_SET); /* Assert LCD_DISP pin */
+ HAL_GPIO_WritePin(LCD_BL_CTRL_GPIO_PORT, LCD_BL_CTRL_PIN, GPIO_PIN_SET); /* Assert LCD_BL_CTRL pin */
+}
+
+static void DMA_Config(void)
+{
+ /*## -1- Enable DMA2 clock #################################################*/
+ __HAL_RCC_DMA2_CLK_ENABLE();
+
+ /*##-2- Select the DMA functional Parameters ###############################*/
+ DmaHandle.Init.Channel = CPY_BUF_DMA_CHANNEL; /* DMA_CHANNEL_0 */
+ DmaHandle.Init.Direction = DMA_MEMORY_TO_MEMORY; /* M2M transfer mode */
+ DmaHandle.Init.PeriphInc = DMA_PINC_ENABLE; /* Peripheral increment mode Enable */
+ DmaHandle.Init.MemInc = DMA_MINC_ENABLE; /* Memory increment mode Enable */
+ DmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; /* Peripheral data alignment : 16bit */
+ DmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; /* memory data alignment : 16bit */
+ DmaHandle.Init.Mode = DMA_NORMAL; /* Normal DMA mode */
+ DmaHandle.Init.Priority = DMA_PRIORITY_HIGH; /* priority level : high */
+ DmaHandle.Init.FIFOMode = DMA_FIFOMODE_ENABLE; /* FIFO mode enabled */
+ DmaHandle.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_1QUARTERFULL; /* FIFO threshold: 1/4 full */
+ DmaHandle.Init.MemBurst = DMA_MBURST_SINGLE; /* Memory burst */
+ DmaHandle.Init.PeriphBurst = DMA_PBURST_SINGLE; /* Peripheral burst */
+
+ /*##-3- Select the DMA instance to be used for the transfer : DMA2_Stream0 #*/
+ DmaHandle.Instance = CPY_BUF_DMA_STREAM;
+
+ /*##-4- Initialize the DMA stream ##########################################*/
+ if(HAL_DMA_Init(&DmaHandle) != HAL_OK)
+ {
+ while(1)
+ {
+ }
+ }
+
+ /*##-5- Select Callbacks functions called after Transfer complete and Transfer error */
+ HAL_DMA_RegisterCallback(&DmaHandle, HAL_DMA_XFER_CPLT_CB_ID, DMA_TransferComplete);
+ HAL_DMA_RegisterCallback(&DmaHandle, HAL_DMA_XFER_ERROR_CB_ID, DMA_TransferError);
+
+ /*##-6- Configure NVIC for DMA transfer complete/error interrupts ##########*/
+ HAL_NVIC_SetPriority(CPY_BUF_DMA_STREAM_IRQ, 0, 0);
+ HAL_NVIC_EnableIRQ(CPY_BUF_DMA_STREAM_IRQ);
+}
+
+/**
+ * @brief DMA conversion complete callback
+ * @note This function is executed when the transfer complete interrupt
+ * is generated
+ * @retval None
+ */
+static void DMA_TransferComplete(DMA_HandleTypeDef *han)
+{
+ y_fill_act ++;
+
+ if(y_fill_act > y2_fill) {
+ SCB_CleanInvalidateDCache();
+ SCB_InvalidateICache();
+ lv_disp_flush_ready(&our_disp->driver);
+ } else {
+ uint32_t length = (x2_flush - x1_flush + 1);
+ buf_to_flush += x2_flush - x1_flush + 1;
+ /*##-7- Start the DMA transfer using the interrupt mode ####################*/
+ /* Configure the source, destination and buffer size DMA fields and Start DMA Stream transfer */
+ /* Enable All the DMA interrupts */
+#if LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
+ length *= 2; /* STM32 DMA uses 16-bit chunks so multiply by 2 for 32-bit color */
+#endif
+ if(HAL_DMA_Start_IT(han,(uint32_t)buf_to_flush, (uint32_t)&my_fb[y_fill_act * TFT_HOR_RES + x1_flush],
+ length) != HAL_OK)
+ {
+ while(1); /*Halt on error*/
+ }
+ }
+}
+
+/**
+ * @brief DMA conversion error callback
+ * @note This function is executed when the transfer error interrupt
+ * is generated during DMA transfer
+ * @retval None
+ */
+static void DMA_TransferError(DMA_HandleTypeDef *han)
+{
+
+}
+
+/**
+ * @brief This function handles DMA Stream interrupt request.
+ * @param None
+ * @retval None
+ */
+void CPY_BUF_DMA_STREAM_IRQHANDLER(void)
+{
+ /* Check the interrupt and clear flag */
+ HAL_DMA_IRQHandler(&DmaHandle);
+}
+
+
+#if LV_USE_GPU != 0
+
+static void Error_Handler(void)
+{
+ while(1)
+ {
+ }
+}
+/**
+ * @brief DMA2D Transfer completed callback
+ * @param hdma2d: DMA2D handle.
+ * @note This example shows a simple way to report end of DMA2D transfer, and
+ * you can add your own implementation.
+ * @retval None
+ */
+static void DMA2D_TransferComplete(DMA2D_HandleTypeDef *hdma2d)
+{
+
+}
+
+/**
+ * @brief DMA2D error callbacks
+ * @param hdma2d: DMA2D handle
+ * @note This example shows a simple way to report DMA2D transfer error, and you can
+ * add your own implementation.
+ * @retval None
+ */
+static void DMA2D_TransferError(DMA2D_HandleTypeDef *hdma2d)
+{
+
+}
+
+/**
+ * @brief DMA2D configuration.
+ * @note This function Configure the DMA2D peripheral :
+ * 1) Configure the Transfer mode as memory to memory with blending.
+ * 2) Configure the output color mode as RGB565 pixel format.
+ * 3) Configure the foreground
+ * - first image loaded from FLASH memory
+ * - constant alpha value (decreased to see the background)
+ * - color mode as RGB565 pixel format
+ * 4) Configure the background
+ * - second image loaded from FLASH memory
+ * - color mode as RGB565 pixel format
+ * @retval None
+ */
+static void DMA2D_Config(void)
+{
+ /* Configure the DMA2D Mode, Color Mode and output offset */
+ Dma2dHandle.Init.Mode = DMA2D_M2M_BLEND;
+#if LV_COLOR_DEPTH == 16
+ Dma2dHandle.Init.ColorMode = DMA2D_RGB565;
+#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
+ Dma2dHandle.Init.ColorMode = DMA2D_ARGB8888;
+#endif
+ Dma2dHandle.Init.OutputOffset = 0x0;
+
+ /* DMA2D Callbacks Configuration */
+ Dma2dHandle.XferCpltCallback = DMA2D_TransferComplete;
+ Dma2dHandle.XferErrorCallback = DMA2D_TransferError;
+
+ /* Foreground Configuration */
+ Dma2dHandle.LayerCfg[1].AlphaMode = DMA2D_REPLACE_ALPHA;
+ Dma2dHandle.LayerCfg[1].InputAlpha = 0xFF;
+#if LV_COLOR_DEPTH == 16
+ Dma2dHandle.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
+#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
+ Dma2dHandle.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888;
+#endif
+
+ Dma2dHandle.LayerCfg[1].InputOffset = 0x0;
+
+ /* Background Configuration */
+ Dma2dHandle.LayerCfg[0].AlphaMode = DMA2D_REPLACE_ALPHA;
+ Dma2dHandle.LayerCfg[0].InputAlpha = 0xFF;
+#if LV_COLOR_DEPTH == 16
+ Dma2dHandle.LayerCfg[0].InputColorMode = DMA2D_INPUT_RGB565;
+#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
+ Dma2dHandle.LayerCfg[0].InputColorMode = DMA2D_INPUT_ARGB8888;
+#endif
+ Dma2dHandle.LayerCfg[0].InputOffset = 0x0;
+
+ Dma2dHandle.Instance = DMA2D;
+
+ /* DMA2D Initialization */
+ if(HAL_DMA2D_Init(&Dma2dHandle) != HAL_OK)
+ {
+ /* Initialization Error */
+ Error_Handler();
+ }
+
+ HAL_DMA2D_ConfigLayer(&Dma2dHandle, 0);
+ HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1);
+}
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hal_stm_lvgl/tft/tft.h Sat Apr 24 19:08:28 2021 +0000
@@ -0,0 +1,43 @@
+/**
+ * @file tft.h
+ *
+ */
+
+#ifndef DISP_H
+#define DISP_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/*********************
+ * INCLUDES
+ *********************/
+#include <stdint.h>
+#include "lvgl/src/lv_misc/lv_color.h"
+#include "lvgl/src/lv_misc/lv_area.h"
+
+/*********************
+ * DEFINES
+ *********************/
+#define TFT_HOR_RES 480
+#define TFT_VER_RES 272
+
+/**********************
+ * TYPEDEFS
+ **********************/
+
+/**********************
+ * GLOBAL PROTOTYPES
+ **********************/
+void tft_init(void);
+
+/**********************
+ * MACROS
+ **********************/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hal_stm_lvgl/touchpad/touchpad.c Sat Apr 24 19:08:28 2021 +0000
@@ -0,0 +1,89 @@
+/**
+ * @file indev.c
+ *
+ */
+
+/*********************
+ * INCLUDES
+ *********************/
+#include "hal_stm_lvgl/tft/tft.h"
+#include "lvgl/src/lv_hal/lv_hal.h"
+
+#include "stm32746g_discovery.h"
+#include "stm32746g_discovery_ts.h"
+
+/*********************
+ * DEFINES
+ *********************/
+
+/**********************
+ * TYPEDEFS
+ **********************/
+
+/**********************
+ * STATIC PROTOTYPES
+ **********************/
+static bool touchpad_read(lv_indev_drv_t *drv, lv_indev_data_t *data);
+
+/**********************
+ * STATIC VARIABLES
+ **********************/
+static TS_StateTypeDef TS_State;
+
+/**********************
+ * MACROS
+ **********************/
+
+/**********************
+ * GLOBAL FUNCTIONS
+ **********************/
+
+/**
+ * Initialize your input devices here
+ */
+void touchpad_init(void)
+{
+ BSP_TS_Init(TFT_HOR_RES, TFT_VER_RES);
+
+ lv_indev_drv_t indev_drv; /*Descriptor of an input device driver*/
+ lv_indev_drv_init(&indev_drv); /*Basic initialization*/
+ indev_drv.type = LV_INDEV_TYPE_POINTER; /*The touchpad is pointer type device*/
+ indev_drv.read_cb = touchpad_read;
+
+ lv_indev_drv_register(&indev_drv);
+}
+
+/**********************
+ * STATIC FUNCTIONS
+ **********************/
+
+/**
+ * Read an input device
+ * @param indev_id id of the input device to read
+ * @param x put the x coordinate here
+ * @param y put the y coordinate here
+ * @return true: the device is pressed, false: released
+ */
+static bool touchpad_read(lv_indev_drv_t *indev, lv_indev_data_t *data)
+{
+ /* Read your touchpad */
+ static int16_t last_x = 0;
+ static int16_t last_y = 0;
+ //BSP_LED_Toggle(LED1);
+
+ BSP_TS_GetState(&TS_State);
+ if(TS_State.touchDetected) {
+ data->point.x = TS_State.touchX[0];
+ data->point.y = TS_State.touchY[0];
+ last_x = data->point.x;
+ last_y = data->point.y;
+ data->state = LV_INDEV_STATE_PR;
+ } else {
+ data->point.x = last_x;
+ data->point.y = last_y;
+ data->state = LV_INDEV_STATE_REL;
+ }
+
+ return false; /*false: no more data to read because we are no buffering*/
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hal_stm_lvgl/touchpad/touchpad.h Sat Apr 24 19:08:28 2021 +0000
@@ -0,0 +1,40 @@
+/**
+ * @file indev.h
+ *
+ */
+
+#ifndef INDEV_H
+#define INDEV_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/*********************
+ * INCLUDES
+ *********************/
+#include <stdbool.h>
+#include <stdint.h>
+
+/*********************
+ * DEFINES
+ *********************/
+
+/**********************
+ * TYPEDEFS
+ **********************/
+
+/**********************
+ * GLOBAL PROTOTYPES
+ **********************/
+void touchpad_init(void);
+
+/**********************
+ * MACROS
+ **********************/
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
--- a/lv_conf.h Tue Apr 07 08:06:45 2020 +0000 +++ b/lv_conf.h Sat Apr 24 19:08:28 2021 +0000 @@ -1,502 +1,750 @@ -/** - * @file lv_conf.h - * - */ - -/* - * COPY THIS FILE AS `lv_conf.h` NEXT TO the `lvgl` FOLDER - */ - -#if 1 /*Set it to "1" to enable content*/ - -#ifndef LV_CONF_H -#define LV_CONF_H -/* clang-format off */ - -#include <stdint.h> - -/*==================== - Graphical settings - *====================*/ - -/* Maximal horizontal and vertical resolution to support by the library.*/ -#if defined(TARGET_DISCO_F746NG) - #define LV_HOR_RES_MAX (480) - #define LV_VER_RES_MAX (272) -#elif defined(TARGET_DISCO_F469NI) - #define LV_HOR_RES_MAX (800) - #define LV_VER_RES_MAX (480) -#else -# error Error: You have not set resolution for your board! -#endif - -/* Color depth: - * - 1: 1 byte per pixel - * - 8: RGB233 - * - 16: RGB565 - * - 32: ARGB8888 - */ -#define LV_COLOR_DEPTH 32 - -/* Swap the 2 bytes of RGB565 color. - * Useful if the display has a 8 bit interface (e.g. SPI)*/ -#define LV_COLOR_16_SWAP 0 - -/* 1: Enable screen transparency. - * Useful for OSD or other overlapping GUIs. - * Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/ -#define LV_COLOR_SCREEN_TRANSP 0 - -/*Images pixels with this color will not be drawn (with chroma keying)*/ -#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/ - -/* Enable anti-aliasing (lines, and radiuses will be smoothed) */ -#define LV_ANTIALIAS 1 - -/* Default display refresh period. - * Can be changed in the display driver (`lv_disp_drv_t`).*/ -#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ - -/* Dot Per Inch: used to initialize default sizes. - * E.g. a button with width = LV_DPI / 2 -> half inch wide - * (Not so important, you can adjust it to modify default sizes and spaces)*/ -#define LV_DPI 100 /*[px]*/ - -/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ -typedef int16_t lv_coord_t; - -/*========================= - Memory manager settings - *=========================*/ - -/* LittelvGL's internal memory manager's settings. - * The graphical objects and other related data are stored here. */ - -/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */ -#define LV_MEM_CUSTOM 0 -#if LV_MEM_CUSTOM == 0 -/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ -# define LV_MEM_SIZE (32U * 1024U) - -/* Complier prefix for a big array declaration */ -# define LV_MEM_ATTR - -/* Set an address for the memory pool instead of allocating it as an array. - * Can be in external SRAM too. */ -# define LV_MEM_ADR 0 - -/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */ -# define LV_MEM_AUTO_DEFRAG 1 -#else /*LV_MEM_CUSTOM*/ -# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/ -# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/ -# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/ -#endif /*LV_MEM_CUSTOM*/ - -/* Garbage Collector settings - * Used if lvgl is binded to higher level language and the memory is managed by that language */ -#define LV_ENABLE_GC 0 -#if LV_ENABLE_GC != 0 -# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ -# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/ -# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/ -#endif /* LV_ENABLE_GC */ - -/*======================= - Input device settings - *=======================*/ - -/* Input device default settings. - * Can be changed in the Input device driver (`lv_indev_drv_t`)*/ - -/* Input device read period in milliseconds */ -#define LV_INDEV_DEF_READ_PERIOD 30 - -/* Drag threshold in pixels */ -#define LV_INDEV_DEF_DRAG_LIMIT 10 - -/* Drag throw slow-down in [%]. Greater value -> faster slow-down */ -#define LV_INDEV_DEF_DRAG_THROW 20 - -/* Long press time in milliseconds. - * Time to send `LV_EVENT_LONG_PRESSSED`) */ -#define LV_INDEV_DEF_LONG_PRESS_TIME 400 - -/* Repeated trigger period in long press [ms] - * Time between `LV_EVENT_LONG_PRESSED_REPEAT */ -#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 - -/*================== - * Feature usage - *==================*/ - -/*1: Enable the Animations */ -#define LV_USE_ANIMATION 1 -#if LV_USE_ANIMATION - -/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ -typedef void * lv_anim_user_data_t; - -#endif - -/* 1: Enable shadow drawing*/ -#define LV_USE_SHADOW 1 - -/* 1: Enable object groups (for keyboard/encoder navigation) */ -#define LV_USE_GROUP 1 -#if LV_USE_GROUP -typedef void * lv_group_user_data_t; -#endif /*LV_USE_GROUP*/ - -/* 1: Enable GPU interface*/ -#define LV_USE_GPU 1 - -/* 1: Enable file system (might be required for images */ -#define LV_USE_FILESYSTEM 1 -#if LV_USE_FILESYSTEM -/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/ -typedef void * lv_fs_drv_user_data_t; -#endif - -/*1: Add a `user_data` to drivers and objects*/ -#define LV_USE_USER_DATA 0 - -/*======================== - * Image decoder and cache - *========================*/ - -/* 1: Enable indexed (palette) images */ -#define LV_IMG_CF_INDEXED 1 - -/* 1: Enable alpha indexed images */ -#define LV_IMG_CF_ALPHA 1 - -/* Default image cache size. Image caching keeps the images opened. - * If only the built-in image formats are used there is no real advantage of caching. - * (I.e. no new image decoder is added) - * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. - * However the opened images might consume additional RAM. - * LV_IMG_CACHE_DEF_SIZE must be >= 1 */ -#define LV_IMG_CACHE_DEF_SIZE 1 - -/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/ -typedef void * lv_img_decoder_user_data_t; - -/*===================== - * Compiler settings - *====================*/ -/* Define a custom attribute to `lv_tick_inc` function */ -#define LV_ATTRIBUTE_TICK_INC - -/* Define a custom attribute to `lv_task_handler` function */ -#define LV_ATTRIBUTE_TASK_HANDLER - -/* With size optimization (-Os) the compiler might not align data to - * 4 or 8 byte boundary. This alignment will be explicitly applied where needed. - * E.g. __attribute__((aligned(4))) */ -#define LV_ATTRIBUTE_MEM_ALIGN - -/* Attribute to mark large constant arrays for example - * font's bitmaps */ -#define LV_ATTRIBUTE_LARGE_CONST - -/*=================== - * HAL settings - *==================*/ - -/* 1: use a custom tick source. - * It removes the need to manually update the tick with `lv_tick_inc`) */ -#define LV_TICK_CUSTOM 0 -#if LV_TICK_CUSTOM == 1 -#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/ -#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ -#endif /*LV_TICK_CUSTOM*/ - -typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/ -typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/ - -/*================ - * Log settings - *===============*/ - -/*1: Enable the log module*/ -#define LV_USE_LOG 0 -#if LV_USE_LOG -/* How important log should be added: - * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information - * LV_LOG_LEVEL_INFO Log important events - * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem - * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail - * LV_LOG_LEVEL_NONE Do not log anything - */ -# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN - -/* 1: Print the log with 'printf'; - * 0: user need to register a callback with `lv_log_register_print`*/ -# define LV_LOG_PRINTF 0 -#endif /*LV_USE_LOG*/ - -/*================ - * THEME USAGE - *================*/ -#define LV_THEME_LIVE_UPDATE 0 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/ - -#define LV_USE_THEME_TEMPL 0 /*Just for test*/ -#define LV_USE_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/ -#define LV_USE_THEME_ALIEN 0 /*Dark futuristic theme*/ -#define LV_USE_THEME_NIGHT 0 /*Dark elegant theme*/ -#define LV_USE_THEME_MONO 0 /*Mono color theme for monochrome displays*/ -#define LV_USE_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows*/ -#define LV_USE_THEME_ZEN 0 /*Peaceful, mainly light theme */ -#define LV_USE_THEME_NEMO 0 /*Water-like theme based on the movie "Finding Nemo"*/ - -/*================== - * FONT USAGE - *===================*/ - -/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. - * The symbols are available via `LV_SYMBOL_...` defines - * More info about fonts: https://docs.littlevgl.com/#Fonts - * To create a new font go to: https://littlevgl.com/ttf-font-to-c-array - */ - -/* Robot fonts with bpp = 4 - * https://fonts.google.com/specimen/Roboto */ -#define LV_FONT_ROBOTO_12 0 -#define LV_FONT_ROBOTO_16 1 -#define LV_FONT_ROBOTO_22 1 -#define LV_FONT_ROBOTO_28 1 - -/*Pixel perfect monospace font - * http://pelulamu.net/unscii/ */ -#define LV_FONT_UNSCII_8 0 - -/* Optionally declare your custom fonts here. - * You can use these fonts as default font too - * and they will be available globally. E.g. - * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \ - * LV_FONT_DECLARE(my_font_2) - */ -#define LV_FONT_CUSTOM_DECLARE - -/*Always set a default font from the built-in fonts*/ -#define LV_FONT_DEFAULT &lv_font_roboto_16 - -/* Enable it if you have fonts with a lot of characters. - * The limit depends on the font size, font face and bpp - * but with > 10,000 characters if you see issues probably you need to enable it.*/ -#define LV_FONT_FMT_TXT_LARGE 0 - -/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ -typedef void * lv_font_user_data_t; - -/*================= - * Text settings - *=================*/ - -/* Select a character encoding for strings. - * Your IDE or editor should have the same character encoding - * - LV_TXT_ENC_UTF8 - * - LV_TXT_ENC_ASCII - * */ -#define LV_TXT_ENC LV_TXT_ENC_UTF8 - - /*Can break (wrap) texts on these chars*/ -#define LV_TXT_BREAK_CHARS " ,.;:-_" - -/*=================== - * LV_OBJ SETTINGS - *==================*/ - -/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ -typedef void * lv_obj_user_data_t; - -/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ -#define LV_USE_OBJ_REALIGN 1 - -/* Enable to make the object clickable on a larger area. - * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature - * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px) - * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) - */ -#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF - -/*================== - * LV OBJ X USAGE - *================*/ -/* - * Documentation of the object types: https://docs.littlevgl.com/#Object-types - */ - -/*Arc (dependencies: -)*/ -#define LV_USE_ARC 1 - -/*Bar (dependencies: -)*/ -#define LV_USE_BAR 1 - -/*Button (dependencies: lv_cont*/ -#define LV_USE_BTN 1 -#if LV_USE_BTN != 0 -/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/ -# define LV_BTN_INK_EFFECT 0 -#endif - -/*Button matrix (dependencies: -)*/ -#define LV_USE_BTNM 1 - -/*Calendar (dependencies: -)*/ -#define LV_USE_CALENDAR 1 - -/*Canvas (dependencies: lv_img)*/ -#define LV_USE_CANVAS 1 - -/*Check box (dependencies: lv_btn, lv_label)*/ -#define LV_USE_CB 1 - -/*Chart (dependencies: -)*/ -#define LV_USE_CHART 1 -#if LV_USE_CHART -# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20 -#endif - -/*Container (dependencies: -*/ -#define LV_USE_CONT 1 - -/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/ -#define LV_USE_DDLIST 1 -#if LV_USE_DDLIST != 0 -/*Open and close default animation time [ms] (0: no animation)*/ -# define LV_DDLIST_DEF_ANIM_TIME 200 -#endif - -/*Gauge (dependencies:lv_bar, lv_lmeter)*/ -#define LV_USE_GAUGE 1 - -/*Image (dependencies: lv_label*/ -#define LV_USE_IMG 1 - -/*Image Button (dependencies: lv_btn*/ -#define LV_USE_IMGBTN 1 -#if LV_USE_IMGBTN -/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/ -# define LV_IMGBTN_TILED 0 -#endif - -/*Keyboard (dependencies: lv_btnm)*/ -#define LV_USE_KB 1 - -/*Label (dependencies: -*/ -#define LV_USE_LABEL 1 -#if LV_USE_LABEL != 0 -/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/ -# define LV_LABEL_DEF_SCROLL_SPEED 25 - -/* Waiting period at beginning/end of animation cycle */ -# define LV_LABEL_WAIT_CHAR_COUNT 3 - -/*Enable selecting text of the label */ -# define LV_LABEL_TEXT_SEL 0 - -/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/ -# define LV_LABEL_LONG_TXT_HINT 0 -#endif - -/*LED (dependencies: -)*/ -#define LV_USE_LED 1 - -/*Line (dependencies: -*/ -#define LV_USE_LINE 1 - -/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/ -#define LV_USE_LIST 1 -#if LV_USE_LIST != 0 -/*Default animation time of focusing to a list element [ms] (0: no animation) */ -# define LV_LIST_DEF_ANIM_TIME 100 -#endif - -/*Line meter (dependencies: *;)*/ -#define LV_USE_LMETER 1 - -/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/ -#define LV_USE_MBOX 1 - -/*Page (dependencies: lv_cont)*/ -#define LV_USE_PAGE 1 -#if LV_USE_PAGE != 0 -/*Focus default animation time [ms] (0: no animation)*/ -# define LV_PAGE_DEF_ANIM_TIME 400 -#endif - -/*Preload (dependencies: lv_arc, lv_anim)*/ -#define LV_USE_PRELOAD 1 -#if LV_USE_PRELOAD != 0 -# define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/ -# define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/ -# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC -#endif - -/*Roller (dependencies: lv_ddlist)*/ -#define LV_USE_ROLLER 1 -#if LV_USE_ROLLER != 0 -/*Focus animation time [ms] (0: no animation)*/ -# define LV_ROLLER_DEF_ANIM_TIME 200 - -/*Number of extra "pages" when the roller is infinite*/ -# define LV_ROLLER_INF_PAGES 7 -#endif - -/*Slider (dependencies: lv_bar)*/ -#define LV_USE_SLIDER 1 - -/*Spinbox (dependencies: lv_ta)*/ -#define LV_USE_SPINBOX 1 - -/*Switch (dependencies: lv_slider)*/ -#define LV_USE_SW 1 - -/*Text area (dependencies: lv_label, lv_page)*/ -#define LV_USE_TA 1 -#if LV_USE_TA != 0 -# define LV_TA_DEF_CURSOR_BLINK_TIME 400 /*ms*/ -# define LV_TA_DEF_PWD_SHOW_TIME 1500 /*ms*/ -#endif - -/*Table (dependencies: lv_label)*/ -#define LV_USE_TABLE 1 -#if LV_USE_TABLE -# define LV_TABLE_COL_MAX 12 -#endif - -/*Tab (dependencies: lv_page, lv_btnm)*/ -#define LV_USE_TABVIEW 1 -# if LV_USE_TABVIEW != 0 -/*Time of slide animation [ms] (0: no animation)*/ -# define LV_TABVIEW_DEF_ANIM_TIME 300 -#endif - -/*Tileview (dependencies: lv_page) */ -#define LV_USE_TILEVIEW 1 -#if LV_USE_TILEVIEW -/*Time of slide animation [ms] (0: no animation)*/ -# define LV_TILEVIEW_DEF_ANIM_TIME 300 -#endif - -/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/ -#define LV_USE_WIN 1 - -/*================== - * Non-user section - *==================*/ - -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/ -# define _CRT_SECURE_NO_WARNINGS -#endif - -/*--END OF LV_CONF_H--*/ - -/*Be sure every define has a default value*/ -#include "lvgl/src/lv_conf_checker.h" - -#endif /*LV_CONF_H*/ - -#endif /*End of "Content enable"*/ +/** + * @file lv_conf.h + * Configuration file for v7.3.1 + */ + +/* + * COPY THIS FILE AS `lv_conf.h` NEXT TO the `lvgl` FOLDER + */ + +#if 1 /*Set it to "1" to enable content*/ + +#ifndef LV_CONF_H +#define LV_CONF_H +/* clang-format off */ + +#include <stdint.h> + +/*==================== + Graphical settings + *====================*/ + +/* Maximal horizontal and vertical resolution to support by the library.*/ +#define LV_HOR_RES_MAX (480) +#define LV_VER_RES_MAX (272) + +/* Color depth: + * - 1: 1 byte per pixel + * - 8: RGB332 + * - 16: RGB565 + * - 32: ARGB8888 + */ +#define LV_COLOR_DEPTH 16 + +/* Swap the 2 bytes of RGB565 color. + * Useful if the display has a 8 bit interface (e.g. SPI)*/ +#define LV_COLOR_16_SWAP 0 + +/* 1: Enable screen transparency. + * Useful for OSD or other overlapping GUIs. + * Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/ +#define LV_COLOR_SCREEN_TRANSP 0 + +/*Images pixels with this color will not be drawn (with chroma keying)*/ +#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/ + +/* Enable anti-aliasing (lines, and radiuses will be smoothed) */ +#define LV_ANTIALIAS 1 + +/* Default display refresh period. + * Can be changed in the display driver (`lv_disp_drv_t`).*/ +#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ + +/* Dot Per Inch: used to initialize default sizes. + * E.g. a button with width = LV_DPI / 2 -> half inch wide + * (Not so important, you can adjust it to modify default sizes and spaces)*/ +#define LV_DPI 130 /*[px]*/ + +/* The the real width of the display changes some default values: + * default object sizes, layout of examples, etc. + * According to the width of the display (hor. res. / dpi) + * the displays fall in 4 categories. + * The 4th is extra large which has no upper limit so not listed here + * The upper limit of the categories are set below in 0.1 inch unit. + */ +#define LV_DISP_SMALL_LIMIT 30 +#define LV_DISP_MEDIUM_LIMIT 50 +#define LV_DISP_LARGE_LIMIT 70 + +/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ +typedef int16_t lv_coord_t; + +/*========================= + Memory manager settings + *=========================*/ + +/* LittelvGL's internal memory manager's settings. + * The graphical objects and other related data are stored here. */ + +/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */ +#define LV_MEM_CUSTOM 0 +#if LV_MEM_CUSTOM == 0 +/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ +# define LV_MEM_SIZE (32 * 1024) + +/* Complier prefix for a big array declaration */ +# define LV_MEM_ATTR + +/* Set an address for the memory pool instead of allocating it as an array. + * Can be in external SRAM too. */ +# define LV_MEM_ADR 0 + +/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */ +# define LV_MEM_AUTO_DEFRAG 1 +#else /*LV_MEM_CUSTOM*/ +# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/ +# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/ +# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/ +#endif /*LV_MEM_CUSTOM*/ + +/* Use the standard memcpy and memset instead of LVGL's own functions. + * The standard functions might or might not be faster depending on their implementation. */ +#define LV_MEMCPY_MEMSET_STD 0 + +/* Garbage Collector settings + * Used if lvgl is binded to higher level language and the memory is managed by that language */ +#define LV_ENABLE_GC 0 +#if LV_ENABLE_GC != 0 +# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ +# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/ +# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/ +#endif /* LV_ENABLE_GC */ + +/*======================= + Input device settings + *=======================*/ + +/* Input device default settings. + * Can be changed in the Input device driver (`lv_indev_drv_t`)*/ + +/* Input device read period in milliseconds */ +#define LV_INDEV_DEF_READ_PERIOD 30 + +/* Drag threshold in pixels */ +#define LV_INDEV_DEF_DRAG_LIMIT 10 + +/* Drag throw slow-down in [%]. Greater value -> faster slow-down */ +#define LV_INDEV_DEF_DRAG_THROW 10 + +/* Long press time in milliseconds. + * Time to send `LV_EVENT_LONG_PRESSSED`) */ +#define LV_INDEV_DEF_LONG_PRESS_TIME 400 + +/* Repeated trigger period in long press [ms] + * Time between `LV_EVENT_LONG_PRESSED_REPEAT */ +#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 + + +/* Gesture threshold in pixels */ +#define LV_INDEV_DEF_GESTURE_LIMIT 50 + +/* Gesture min velocity at release before swipe (pixels)*/ +#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3 + +/*================== + * Feature usage + *==================*/ + +/*1: Enable the Animations */ +#define LV_USE_ANIMATION 1 +#if LV_USE_ANIMATION + +/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ +typedef void * lv_anim_user_data_t; + +#endif + +/* 1: Enable shadow drawing on rectangles*/ +#define LV_USE_SHADOW 1 +#if LV_USE_SHADOW +/* Allow buffering some shadow calculation + * LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, + * where shadow size is `shadow_width + radius` + * Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ +#define LV_SHADOW_CACHE_SIZE 0 +#endif + +/*1: enable outline drawing on rectangles*/ +#define LV_USE_OUTLINE 1 + +/*1: enable pattern drawing on rectangles*/ +#define LV_USE_PATTERN 1 + +/*1: enable value string drawing on rectangles*/ +#define LV_USE_VALUE_STR 1 + +/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/ +#define LV_USE_BLEND_MODES 1 + +/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/ +#define LV_USE_OPA_SCALE 1 + +/* 1: Use image zoom and rotation*/ +#define LV_USE_IMG_TRANSFORM 1 + +/* 1: Enable object groups (for keyboard/encoder navigation) */ +#define LV_USE_GROUP 1 +#if LV_USE_GROUP +typedef void * lv_group_user_data_t; +#endif /*LV_USE_GROUP*/ + +/* 1: Enable GPU interface*/ +#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */ +#define LV_USE_GPU_STM32_DMA2D 1 +/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor +e.g. "stm32f769xx.h" or "stm32f429xx.h" */ +#define LV_GPU_DMA2D_CMSIS_INCLUDE "stm32f746xx.h" + +/* 1: Enable file system (might be required for images */ +#define LV_USE_FILESYSTEM 0 +#if LV_USE_FILESYSTEM +/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/ +typedef void * lv_fs_drv_user_data_t; +#endif + +/*1: Add a `user_data` to drivers and objects*/ +#define LV_USE_USER_DATA 1 + +/*1: Show CPU usage and FPS count in the right bottom corner*/ +#define LV_USE_PERF_MONITOR 1 + +/*1: Use the functions and types from the older API if possible */ +#define LV_USE_API_EXTENSION_V6 1 +#define LV_USE_API_EXTENSION_V7 1 + +/*======================== + * Image decoder and cache + *========================*/ + +/* 1: Enable indexed (palette) images */ +#define LV_IMG_CF_INDEXED 1 + +/* 1: Enable alpha indexed images */ +#define LV_IMG_CF_ALPHA 1 + +/* Default image cache size. Image caching keeps the images opened. + * If only the built-in image formats are used there is no real advantage of caching. + * (I.e. no new image decoder is added) + * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. + * However the opened images might consume additional RAM. + * LV_IMG_CACHE_DEF_SIZE must be >= 1 */ +#define LV_IMG_CACHE_DEF_SIZE 1 + +/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/ +typedef void * lv_img_decoder_user_data_t; + +/*===================== + * Compiler settings + *====================*/ + +/* For big endian systems set to 1 */ +#define LV_BIG_ENDIAN_SYSTEM 0 + +/* Define a custom attribute to `lv_tick_inc` function */ +#define LV_ATTRIBUTE_TICK_INC + +/* Define a custom attribute to `lv_task_handler` function */ +#define LV_ATTRIBUTE_TASK_HANDLER + +/* Define a custom attribute to `lv_disp_flush_ready` function */ +#define LV_ATTRIBUTE_FLUSH_READY + +/* With size optimization (-Os) the compiler might not align data to + * 4 or 8 byte boundary. This alignment will be explicitly applied where needed. + * E.g. __attribute__((aligned(4))) */ +#define LV_ATTRIBUTE_MEM_ALIGN + +/* Attribute to mark large constant arrays for example + * font's bitmaps */ +#define LV_ATTRIBUTE_LARGE_CONST + +/* Prefix performance critical functions to place them into a faster memory (e.g RAM) + * Uses 15-20 kB extra memory */ +#define LV_ATTRIBUTE_FAST_MEM + +/* Export integer constant to binding. + * This macro is used with constants in the form of LV_<CONST> that + * should also appear on lvgl binding API such as Micropython + * + * The default value just prevents a GCC warning. + */ +#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning + +/* Prefix variables that are used in GPU accelerated operations, often these need to be + * placed in RAM sections that are DMA accessible */ +#define LV_ATTRIBUTE_DMA + +/*=================== + * HAL settings + *==================*/ + +/* 1: use a custom tick source. + * It removes the need to manually update the tick with `lv_tick_inc`) */ +#define LV_TICK_CUSTOM 0 +#if LV_TICK_CUSTOM == 1 +#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ +#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ +#endif /*LV_TICK_CUSTOM*/ + +typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/ +typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/ + +/*================ + * Log settings + *===============*/ + +/*1: Enable the log module*/ +#define LV_USE_LOG 1 +#if LV_USE_LOG +/* How important log should be added: + * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information + * LV_LOG_LEVEL_INFO Log important events + * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem + * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + * LV_LOG_LEVEL_NONE Do not log anything + */ +# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN + +/* 1: Print the log with 'printf'; + * 0: user need to register a callback with `lv_log_register_print_cb`*/ +# define LV_LOG_PRINTF 1 +#endif /*LV_USE_LOG*/ + +/*================= + * Debug settings + *================*/ + +/* If Debug is enabled LittelvGL validates the parameters of the functions. + * If an invalid parameter is found an error log message is printed and + * the MCU halts at the error. (`LV_USE_LOG` should be enabled) + * If you are debugging the MCU you can pause + * the debugger to see exactly where the issue is. + * + * The behavior of asserts can be overwritten by redefining them here. + * E.g. #define LV_ASSERT_MEM(p) <my_assert_code> + */ +#define LV_USE_DEBUG 0 +#if LV_USE_DEBUG + +/*Check if the parameter is NULL. (Quite fast) */ +#define LV_USE_ASSERT_NULL 1 + +/*Checks is the memory is successfully allocated or no. (Quite fast)*/ +#define LV_USE_ASSERT_MEM 1 + +/*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#define LV_USE_ASSERT_MEM_INTEGRITY 1 + +/* Check the strings. + * Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow) + * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ +#define LV_USE_ASSERT_STR 1 + +/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow) + * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ +#define LV_USE_ASSERT_OBJ 1 + +/*Check if the styles are properly initialized. (Fast)*/ +#define LV_USE_ASSERT_STYLE 1 + +#endif /*LV_USE_DEBUG*/ + +/*================== + * FONT USAGE + *===================*/ + +/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. + * The symbols are available via `LV_SYMBOL_...` defines + * More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html + * To create a new font go to: https://lvgl.com/ttf-font-to-c-array + */ + +/* Montserrat fonts with bpp = 4 + * https://fonts.google.com/specimen/Montserrat */ +#define LV_FONT_MONTSERRAT_8 0 +#define LV_FONT_MONTSERRAT_10 1 +#define LV_FONT_MONTSERRAT_12 1 +#define LV_FONT_MONTSERRAT_14 1 +#define LV_FONT_MONTSERRAT_16 1 +#define LV_FONT_MONTSERRAT_18 0 +#define LV_FONT_MONTSERRAT_20 0 +#define LV_FONT_MONTSERRAT_22 0 +#define LV_FONT_MONTSERRAT_24 0 +#define LV_FONT_MONTSERRAT_26 0 +#define LV_FONT_MONTSERRAT_28 0 +#define LV_FONT_MONTSERRAT_30 1 +#define LV_FONT_MONTSERRAT_32 0 +#define LV_FONT_MONTSERRAT_34 0 +#define LV_FONT_MONTSERRAT_36 0 +#define LV_FONT_MONTSERRAT_38 0 +#define LV_FONT_MONTSERRAT_40 1 +#define LV_FONT_MONTSERRAT_42 0 +#define LV_FONT_MONTSERRAT_44 0 +#define LV_FONT_MONTSERRAT_46 0 +#define LV_FONT_MONTSERRAT_48 0 + +/* Demonstrate special features */ +#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 +#define LV_FONT_SIMSUN_16_CJK 0 + +/*Pixel perfect monospace font + * http://pelulamu.net/unscii/ */ +#define LV_FONT_UNSCII_8 0 + +/* Optionally declare your custom fonts here. + * You can use these fonts as default font too + * and they will be available globally. E.g. + * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \ + * LV_FONT_DECLARE(my_font_2) + */ +#define LV_FONT_CUSTOM_DECLARE + +/* Enable it if you have fonts with a lot of characters. + * The limit depends on the font size, font face and bpp + * but with > 10,000 characters if you see issues probably you need to enable it.*/ +#define LV_FONT_FMT_TXT_LARGE 1 + +/* Enables/disables support for compressed fonts. If it's disabled, compressed + * glyphs cannot be processed by the library and won't be rendered. + */ +#define LV_USE_FONT_COMPRESSED 1 + +/* Enable subpixel rendering */ +#define LV_USE_FONT_SUBPX 1 +#if LV_USE_FONT_SUBPX +/* Set the pixel order of the display. + * Important only if "subpx fonts" are used. + * With "normal" font it doesn't matter. + */ +#define LV_FONT_SUBPX_BGR 0 +#endif + +/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ +typedef void * lv_font_user_data_t; + +/*================ + * THEME USAGE + *================*/ + +/*Always enable at least on theme*/ + +/* No theme, you can apply your styles as you need + * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ + #define LV_USE_THEME_EMPTY 1 + +/*Simple to the create your theme based on it + * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ + #define LV_USE_THEME_TEMPLATE 1 + +/* A fast and impressive theme. + * Flags: + * LV_THEME_MATERIAL_FLAG_LIGHT: light theme + * LV_THEME_MATERIAL_FLAG_DARK: dark theme + * LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations) + * LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state) + * */ + #define LV_USE_THEME_MATERIAL 1 + +/* Mono-color theme for monochrome displays. + * If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the + * texts and borders will be black and the background will be + * white. Else the colors are inverted. + * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ + #define LV_USE_THEME_MONO 1 + +#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/ +#define LV_THEME_DEFAULT_INIT lv_theme_material_init +#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1) +#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6) +#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT +#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14 +#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14 +#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14 +#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14 + +/*================= + * Text settings + *=================*/ + +/* Select a character encoding for strings. + * Your IDE or editor should have the same character encoding + * - LV_TXT_ENC_UTF8 + * - LV_TXT_ENC_ASCII + * */ +#define LV_TXT_ENC LV_TXT_ENC_UTF8 + + /*Can break (wrap) texts on these chars*/ +#define LV_TXT_BREAK_CHARS " ,.;:-_" + +/* If a word is at least this long, will break wherever "prettiest" + * To disable, set to a value <= 0 */ +#define LV_TXT_LINE_BREAK_LONG_LEN 0 + +/* Minimum number of characters in a long word to put on a line before a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ +#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 + +/* Minimum number of characters in a long word to put on a line after a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ +#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 + +/* The control character to use for signalling text recoloring. */ +#define LV_TXT_COLOR_CMD "#" + +/* Support bidirectional texts. + * Allows mixing Left-to-Right and Right-to-Left texts. + * The direction will be processed according to the Unicode Bidirectioanl Algorithm: + * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ +#define LV_USE_BIDI 1 +#if LV_USE_BIDI +/* Set the default direction. Supported values: + * `LV_BIDI_DIR_LTR` Left-to-Right + * `LV_BIDI_DIR_RTL` Right-to-Left + * `LV_BIDI_DIR_AUTO` detect texts base direction */ +#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO +#endif + +/* Enable Arabic/Persian processing + * In these languages characters should be replaced with + * an other form based on their position in the text */ +#define LV_USE_ARABIC_PERSIAN_CHARS 1 + +/*Change the built in (v)snprintf functions*/ +#define LV_SPRINTF_CUSTOM 0 +#if LV_SPRINTF_CUSTOM +# define LV_SPRINTF_INCLUDE <stdio.h> +# define lv_snprintf snprintf +# define lv_vsnprintf vsnprintf +#else /*!LV_SPRINTF_CUSTOM*/ +# define LV_SPRINTF_DISABLE_FLOAT 0 +#endif /*LV_SPRINTF_CUSTOM*/ + +/*=================== + * LV_OBJ SETTINGS + *==================*/ + +#if LV_USE_USER_DATA +/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ +typedef void * lv_obj_user_data_t; +/*Provide a function to free user data*/ +#define LV_USE_USER_DATA 1 +#if LV_USE_USER_DATA_FREE +# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/ +/* Function prototype : void user_data_free(lv_obj_t * obj); */ +# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/ +#endif +#endif + +/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/ +#define LV_USE_OBJ_REALIGN 1 + +/* Enable to make the object clickable on a larger area. + * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature + * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px) + * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) + */ +#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_FULL + +/*================== + * LV OBJ X USAGE + *================*/ +/* + * Documentation of the object types: https://docs.lvgl.com/#Object-types + */ + +/*Arc (dependencies: -)*/ +#define LV_USE_ARC 1 + +/*Bar (dependencies: -)*/ +#define LV_USE_BAR 1 + +/*Button (dependencies: lv_cont*/ +#define LV_USE_BTN 1 + +/*Button matrix (dependencies: -)*/ +#define LV_USE_BTNMATRIX 1 + +/*Calendar (dependencies: -)*/ +#define LV_USE_CALENDAR 1 +#if LV_USE_CALENDAR +# define LV_CALENDAR_WEEK_STARTS_MONDAY 0 +#endif + +/*Canvas (dependencies: lv_img)*/ +#define LV_USE_CANVAS 1 + +/*Check box (dependencies: lv_btn, lv_label)*/ +#define LV_USE_CHECKBOX 1 + +/*Chart (dependencies: -)*/ +#define LV_USE_CHART 1 +#if LV_USE_CHART +# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 256 +#endif + +/*Container (dependencies: -*/ +#define LV_USE_CONT 1 + +/*Color picker (dependencies: -*/ +#define LV_USE_CPICKER 1 + +/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/ +#define LV_USE_DROPDOWN 1 +#if LV_USE_DROPDOWN != 0 +/*Open and close default animation time [ms] (0: no animation)*/ +# define LV_DROPDOWN_DEF_ANIM_TIME 200 +#endif + +/*Gauge (dependencies:lv_bar, lv_linemeter)*/ +#define LV_USE_GAUGE 1 + +/*Image (dependencies: lv_label*/ +#define LV_USE_IMG 1 + +/*Image Button (dependencies: lv_btn*/ +#define LV_USE_IMGBTN 1 +#if LV_USE_IMGBTN +/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/ +# define LV_IMGBTN_TILED 0 +#endif + +/*Keyboard (dependencies: lv_btnm)*/ +#define LV_USE_KEYBOARD 1 + +/*Label (dependencies: -*/ +#define LV_USE_LABEL 1 +#if LV_USE_LABEL != 0 +/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/ +# define LV_LABEL_DEF_SCROLL_SPEED 25 + +/* Waiting period at beginning/end of animation cycle */ +# define LV_LABEL_WAIT_CHAR_COUNT 3 + +/*Enable selecting text of the label */ +# define LV_LABEL_TEXT_SEL 1 + +/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/ +# define LV_LABEL_LONG_TXT_HINT 0 +#endif + +/*LED (dependencies: -)*/ +#define LV_USE_LED 1 +#if LV_USE_LED +# define LV_LED_BRIGHT_MIN 120 /*Minimal brightness*/ +# define LV_LED_BRIGHT_MAX 255 /*Maximal brightness*/ +#endif + +/*Line (dependencies: -*/ +#define LV_USE_LINE 1 + +/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/ +#define LV_USE_LIST 1 +#if LV_USE_LIST != 0 +/*Default animation time of focusing to a list element [ms] (0: no animation) */ +# define LV_LIST_DEF_ANIM_TIME 100 +#endif + +/*Line meter (dependencies: *;)*/ +#define LV_USE_LINEMETER 1 +#if LV_USE_LINEMETER +/* Draw line more precisely at cost of performance. + * Useful if there are lot of lines any minor are visible + * 0: No extra precision + * 1: Some extra precision + * 2: Best precision + */ +# define LV_LINEMETER_PRECISE 0 +#endif + +/*Mask (dependencies: -)*/ +#define LV_USE_OBJMASK 1 + +/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/ +#define LV_USE_MSGBOX 1 + +/*Page (dependencies: lv_cont)*/ +#define LV_USE_PAGE 1 +#if LV_USE_PAGE != 0 +/*Focus default animation time [ms] (0: no animation)*/ +# define LV_PAGE_DEF_ANIM_TIME 400 +#endif + +/*Preload (dependencies: lv_arc, lv_anim)*/ +#define LV_USE_SPINNER 1 +#if LV_USE_SPINNER != 0 +# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/ +# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/ +# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC +#endif + +/*Roller (dependencies: lv_ddlist)*/ +#define LV_USE_ROLLER 1 +#if LV_USE_ROLLER != 0 +/*Focus animation time [ms] (0: no animation)*/ +# define LV_ROLLER_DEF_ANIM_TIME 200 + +/*Number of extra "pages" when the roller is infinite*/ +# define LV_ROLLER_INF_PAGES 7 +#endif + +/*Slider (dependencies: lv_bar)*/ +#define LV_USE_SLIDER 1 + +/*Spinbox (dependencies: lv_ta)*/ +#define LV_USE_SPINBOX 1 + +/*Switch (dependencies: lv_slider)*/ +#define LV_USE_SWITCH 1 + +/*Text area (dependencies: lv_label, lv_page)*/ +#define LV_USE_TEXTAREA 1 +#if LV_USE_TEXTAREA != 0 +# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/ +# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +#endif + +/*Table (dependencies: lv_label)*/ +#define LV_USE_TABLE 1 +#if LV_USE_TABLE +# define LV_TABLE_COL_MAX 12 +#endif + +/*Tab (dependencies: lv_page, lv_btnm)*/ +#define LV_USE_TABVIEW 1 +# if LV_USE_TABVIEW != 0 +/*Time of slide animation [ms] (0: no animation)*/ +# define LV_TABVIEW_DEF_ANIM_TIME 300 +#endif + +/*Tileview (dependencies: lv_page) */ +#define LV_USE_TILEVIEW 1 +#if LV_USE_TILEVIEW +/*Time of slide animation [ms] (0: no animation)*/ +# define LV_TILEVIEW_DEF_ANIM_TIME 300 +#endif + +/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/ +#define LV_USE_WIN 1 + + +/*File system interface*/ +#define LV_USE_FS_IF 1 +#if LV_USE_FS_IF +# define LV_FS_IF_FATFS '\0' +# define LV_FS_IF_PC 'P' +#endif /*LV_USE_FS_IF*/ + + +/*================== + * Non-user section + *==================*/ + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/ +# define _CRT_SECURE_NO_WARNINGS +#endif + +/*--END OF LV_CONF_H--*/ + +#endif /*LV_CONF_H*/ + +#endif /*End of "Content enable"*/
--- a/lv_ex_conf.h Tue Apr 07 08:06:45 2020 +0000 +++ b/lv_ex_conf.h Sat Apr 24 19:08:28 2021 +0000 @@ -1,60 +1,54 @@ -/** - * @file lv_ex_conf.h - * - */ -/* - * COPY THIS FILE AS lv_ex_conf.h - */ - -#if 1 /*Set it to "1" to enable the content*/ - -#ifndef LV_EX_CONF_H -#define LV_EX_CONF_H - -/******************* - * GENERAL SETTING - *******************/ -#define LV_EX_PRINTF 0 /*Enable printf-ing data*/ -#define LV_EX_KEYBOARD 0 /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/ -#define LV_EX_MOUSEWHEEL 0 /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/ - -/******************* - * TEST USAGE - *******************/ -#define LV_USE_TESTS 0 - -/******************* - * TUTORIAL USAGE - *******************/ -#define LV_USE_TUTORIALS 0 - - -/********************* - * APPLICATION USAGE - *********************/ - -/* Test the graphical performance of your MCU - * with different settings*/ -#define LV_USE_BENCHMARK 0 - -/*A demo application with Keyboard, Text area, List and Chart - * placed on Tab view */ -#define LV_USE_DEMO 1 -#if LV_USE_DEMO -#define LV_DEMO_WALLPAPER 0 /*Create a wallpaper too*/ -#define LV_DEMO_SLIDE_SHOW 0 /*Automatically switch between tabs*/ -#endif - -/*MCU and memory usage monitoring*/ -#define LV_USE_SYSMON 0 - -/*A terminal to display received characters*/ -#define LV_USE_TERMINAL 0 - -/*Touch pad calibration with 4 points*/ -#define LV_USE_TPCAL 0 - -#endif /*LV_EX_CONF_H*/ - -#endif /*End of "Content enable"*/ - +/** + * @file lv_ex_conf.h + * Configuration file for v7.11.0 + * + */ +/* + * COPY THIS FILE AS lv_ex_conf.h + */ + +#if 1 /*Set it to "1" to enable the content*/ + +#ifndef LV_EX_CONF_H +#define LV_EX_CONF_H + + +/******************* + * GENERAL SETTING + *******************/ +#define LV_EX_PRINTF 0 /*Enable printf-ing data in demoes and examples*/ +#define LV_EX_KEYBOARD 0 /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/ +#define LV_EX_MOUSEWHEEL 0 /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/ + +/********************* + * DEMO USAGE + *********************/ + +/*Show some widget*/ +#define LV_USE_DEMO_WIDGETS 1 +#if LV_USE_DEMO_WIDGETS +#define LV_DEMO_WIDGETS_SLIDESHOW 0 +#endif + +/*Printer demo, optimized for 800x480*/ +#define LV_USE_DEMO_PRINTER 0 + +/*Demonstrate the usage of encoder and keyboard*/ +#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 + +/*Benchmark your system*/ +#define LV_USE_DEMO_BENCHMARK 0 + +/*Stress test for LVGL*/ +#define LV_USE_DEMO_STRESS 0 + +/*Music player for LVGL*/ +#define LV_USE_DEMO_MUSIC 0 +#if LV_USE_DEMO_MUSIC +#define LV_DEMO_MUSIC_AUTO_PLAY 0 +#endif + +#endif /*LV_EX_CONF_H*/ + +#endif /*End of "Content enable"*/ +
--- a/lv_examples.lib Tue Apr 07 08:06:45 2020 +0000 +++ b/lv_examples.lib Sat Apr 24 19:08:28 2021 +0000 @@ -1,1 +1,1 @@ -https://github.com/littlevgl/lv_examples/#85a6d71fe34aff8588a19fa703061434d0edca09 +https://github.com/lvgl/lv_examples/#8bc0b03149bf482ef8087016cd4232262061fc39
--- a/lvgl.lib Tue Apr 07 08:06:45 2020 +0000 +++ b/lvgl.lib Sat Apr 24 19:08:28 2021 +0000 @@ -1,1 +1,1 @@ -https://github.com/littlevgl/lvgl/#9083adb936a51eed98eba9b164ff31e716157de5 +https://github.com/lvgl/lvgl/#524709472757405ac0eef8d6d002632526430df3
--- a/main.cpp Tue Apr 07 08:06:45 2020 +0000
+++ b/main.cpp Sat Apr 24 19:08:28 2021 +0000
@@ -1,103 +1,81 @@
//Notebook page https://os.mbed.com/users/JohnnyK/notebook/how-start-with-the-littlevgl/
#include "mbed.h"
#include "lvgl/lvgl.h"
-#include "lv_port_disp.h"
-#include "lv_port_indev.h"
-#include "demo.h" //Comment/uncomment will switch between LittlevGL demo and Hello word example
+#include "hal_stm_lvgl/tft/tft.h"
+#include "hal_stm_lvgl/touchpad/touchpad.h"
+#include "lv_examples.h" /*Comment/uncomment will switch between LVGL demo and Hello word example*/
-#define LVGL_TICK 5 //Time tick value for lvgl in ms (1-10msa)
-#define TICKER_TIME 0.001 * LVGL_TICK //modified to miliseconds
-#define WAIT_TIME 1000 * LVGL_TICK //modified to microseconds
+#define LVGL_TICK 10 //Time tick value for lvgl in ms (1-10msa)
+#define TICKER_TIME 10ms //modified to miliseconds
-Ticker ticker; //Ticker for lvgl
-
+Ticker ticker; //Ticker for lvgl
+
//Callback function for lvgl timing.
void lv_ticker_func(){
-
lv_tick_inc(LVGL_TICK);
//Call lv_tick_inc(x) every x milliseconds in a Timer or Task (x should be between 1 and 10).
//It is required for the internal timing of LittlevGL.
- lv_task_handler();
- //Call lv_task_handler() periodically every few milliseconds.
- //It will redraw the screen if required, handle input devices etc.
}
-#ifndef DEMO_H
-//lvgl buttons object event handler
-static void event_handler(lv_obj_t * obj, lv_event_t event){
- switch(event) {
- case LV_EVENT_PRESSED:
- printf("Pressed\n");
- break;
-
- case LV_EVENT_SHORT_CLICKED:
- printf("Short clicked\n");
- break;
-
- case LV_EVENT_CLICKED:
- printf("Clicked\n");
- break;
-
- case LV_EVENT_VALUE_CHANGED:
- printf("Toggled\n");
- break;
-
- case LV_EVENT_LONG_PRESSED:
- printf("Long press\n");
- break;
-
- case LV_EVENT_LONG_PRESSED_REPEAT:
- printf("Long press repeat\n");
- break;
-
- case LV_EVENT_RELEASED:
- printf("Released\n");
- break;
+#ifndef LV_EXAMPLES_H
+static void event_handler(lv_obj_t * obj, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ printf("Clicked\n");
+ }
+ else if(event == LV_EVENT_VALUE_CHANGED) {
+ printf("Toggled\n");
}
}
-#endif
-
+#endif
+// main() runs in its own thread in the OS
int main()
{
- printf("LittlevGL GUI-");
- lv_init(); //Initialize the LittlevGL
- lv_port_disp_init(); //Initialize diplay
- lv_port_indev_init(); //Initialize touchpad
- ticker.attach(callback(&lv_ticker_func),TICKER_TIME); //Attach callback to ticker
-
-#ifndef DEMO_H
- printf("Hello word\n");
- lv_obj_t * label_h = lv_label_create(lv_scr_act(), NULL);
- static lv_style_t st;
- lv_style_copy( &st, &lv_style_plain );
- st.text.font = &lv_font_roboto_28;
- lv_obj_set_style( label_h, &st );
- lv_obj_set_size(label_h, 50, 30);
- lv_label_set_recolor(label_h, true);
- lv_label_set_text(label_h, "#ff0000 Hello word#");
- lv_obj_align(label_h, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
+ printf("LVGL-");
+ lv_init(); //Initialize the LVGL
+ tft_init(); //Initialize diplay
+ touchpad_init(); //Initialize touchpad
+ ticker.attach(callback(&lv_ticker_func),TICKER_TIME); //Attach callback to ticker
+
+#ifdef LV_EXAMPLES_H
+ printf("Demo\n");
+ lv_demo_widgets();
+#else
+ printf("Hello world\n");
+ lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL);
+ lv_label_set_long_mode(label1, LV_LABEL_LONG_BREAK); /*Break the long lines*/
+ lv_label_set_recolor(label1, true); /*Enable re-coloring by commands in the text*/
+ lv_label_set_align(label1, LV_LABEL_ALIGN_CENTER); /*Center aligned lines*/
+ lv_label_set_text(label1, "#0000ff Hello# #ff00ff world# #ff0000 - the LVGL and MbedOS#");
+ lv_obj_set_width(label1, 150);
+ lv_obj_align(label1, NULL, LV_ALIGN_IN_TOP_MID, 0, 20);
+
+ lv_obj_t * label2 = lv_label_create(lv_scr_act(), NULL);
+ lv_label_set_long_mode(label2, LV_LABEL_LONG_SROLL_CIRC); /*Circular scroll*/
+ lv_obj_set_width(label2, 150);
+ lv_label_set_text(label2, "It is a circularly scrolling text. ");
+ lv_obj_align(label2, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_obj_t * label;
lv_obj_t * btn1 = lv_btn_create(lv_scr_act(), NULL);
lv_obj_set_event_cb(btn1, event_handler);
- lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, -40);
+ lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, -25);
label = lv_label_create(btn1, NULL);
lv_label_set_text(label, "Button");
- lv_obj_t *btn2 = lv_btn_create(lv_scr_act(), NULL);
+ lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), NULL);
lv_obj_set_event_cb(btn2, event_handler);
- lv_obj_align(btn2, NULL, LV_ALIGN_CENTER, 0, 40);
- lv_btn_set_toggle(btn2, true);
+ lv_obj_align(btn2, NULL, LV_ALIGN_CENTER, 0, 25);
+ lv_btn_set_checkable(btn2, true);
lv_btn_toggle(btn2);
lv_btn_set_fit2(btn2, LV_FIT_NONE, LV_FIT_TIGHT);
label = lv_label_create(btn2, NULL);
lv_label_set_text(label, "Toggled");
-#else
- printf("Demo\n");
- demo_create(); // Demo from lv_examples
-#endif
+#endif
- while(1) {
- //do something
- //thread_sleep_for(WAIT_TIME);
+ while (true){
+ lv_task_handler();
+ //Call lv_task_handler() periodically every few milliseconds.
+ //It will redraw the screen if required, handle input devices etc.
+ thread_sleep_for(LVGL_TICK);
}
-}
+}
\ No newline at end of file
--- a/mbed-os.lib Tue Apr 07 08:06:45 2020 +0000 +++ b/mbed-os.lib Sat Apr 24 19:08:28 2021 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#532654ebb31c7bf79601042a6fa976b85532ef47 +https://github.com/ARMmbed/mbed-os/#9738b27c7df897c29e9769911d6794ba3e5b3f19