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: LCD_DISCO_F746NG GRecorder BSP_DISCO_F746NG
Revision 0:10c4b83c458d, committed 2019-12-02
- Comitter:
- JohnnyK
- Date:
- Mon Dec 02 19:28:26 2019 +0000
- Child:
- 1:627f26953c53
- Commit message:
- First
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Drivers/BSP_DISCO_F746NG.lib Mon Dec 02 19:28:26 2019 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#85dbcff443aa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Drivers/lv_LCD/lv_port_disp.c Mon Dec 02 19:28:26 2019 +0000
@@ -0,0 +1,270 @@
+/**
+ * @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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Drivers/lv_LCD/lv_port_disp.h Mon Dec 02 19:28:26 2019 +0000
@@ -0,0 +1,45 @@
+/**
+ * @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*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Drivers/lv_TS/lv_port_indev.c Mon Dec 02 19:28:26 2019 +0000
@@ -0,0 +1,480 @@
+/**
+ * @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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Drivers/lv_TS/lv_port_indev.h Mon Dec 02 19:28:26 2019 +0000
@@ -0,0 +1,46 @@
+
+/**
+ * @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/lv_conf.h Mon Dec 02 19:28:26 2019 +0000 @@ -0,0 +1,502 @@ +/** + * @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"*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lv_ex_conf.h Mon Dec 02 19:28:26 2019 +0000 @@ -0,0 +1,60 @@ +/** + * @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"*/ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lv_examples.lib Mon Dec 02 19:28:26 2019 +0000 @@ -0,0 +1,1 @@ +https://github.com/littlevgl/lv_examples/#85a6d71fe34aff8588a19fa703061434d0edca09
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lvgl.lib Mon Dec 02 19:28:26 2019 +0000 @@ -0,0 +1,1 @@ +https://github.com/littlevgl/lvgl/#9083adb936a51eed98eba9b164ff31e716157de5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Dec 02 19:28:26 2019 +0000
@@ -0,0 +1,78 @@
+//#pragma -O0
+#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
+
+#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
+
+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.
+}
+
+//lvgl button object event handler
+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");
+ }
+}
+
+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);
+
+ 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);
+ 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_set_event_cb(btn2, event_handler);
+ lv_obj_align(btn2, NULL, LV_ALIGN_CENTER, 0, 40);
+ lv_btn_set_toggle(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
+
+ while(1) {
+ //something
+ //wait_us(WAIT_TIME);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Mon Dec 02 19:28:26 2019 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#3a57ec7401a77b8b98f6356a1498cb154229483f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json Mon Dec 02 19:28:26 2019 +0000
@@ -0,0 +1,3 @@
+{
+ "requires": ["bare-metal"]
+}