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: TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG millis
Revision 0:29539ecd9709, committed 2020-01-15
- Comitter:
- becanromain
- Date:
- Wed Jan 15 19:30:05 2020 +0000
- Commit message:
- test
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F746NG.lib Wed Jan 15 19:30:05 2020 +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/LCD_DISCO_F746NG.lib Wed Jan 15 19:30:05 2020 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ST/code/LCD_DISCO_F746NG/#d44525b1de98
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TS_DISCO_F746NG.lib Wed Jan 15 19:30:05 2020 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ST/code/TS_DISCO_F746NG/#fe0cf5e2960f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lv_conf.h Wed Jan 15 19:30:05 2020 +0000 @@ -0,0 +1,495 @@ +/** + * @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.*/ +#define LV_HOR_RES_MAX 480 +#define LV_VER_RES_MAX 272 + +/* 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_cb`*/ +# define LV_LOG_PRINTF 0 +#endif /*LV_USE_LOG*/ + +/*================ + * THEME USAGE + *================*/ +#define LV_THEME_LIVE_UPDATE 1 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/ + +#define LV_USE_THEME_TEMPL 1 /*Just for test*/ +#define LV_USE_THEME_DEFAULT 1 /*Built mainly from the built-in styles. Consumes very few RAM*/ +#define LV_USE_THEME_ALIEN 1 /*Dark futuristic theme*/ +#define LV_USE_THEME_NIGHT 1 /*Dark elegant theme*/ +#define LV_USE_THEME_MONO 1 /*Mono color theme for monochrome displays*/ +#define LV_USE_THEME_MATERIAL 1 /*Flat theme with bold colors and light shadows*/ +#define LV_USE_THEME_ZEN 1 /*Peaceful, mainly light theme */ +#define LV_USE_THEME_NEMO 1 /*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 1 +#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 1 +#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/lvgl.lib Wed Jan 15 19:30:05 2020 +0000 @@ -0,0 +1,1 @@ +https://github.com/littlevgl/lvgl.git/#51928059d2dda465ab76ee66cf37b9d2edb9f64e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jan 15 19:30:05 2020 +0000
@@ -0,0 +1,1199 @@
+#include "mbed.h"
+#include "TS_DISCO_F746NG.h"
+#include "LCD_DISCO_F746NG.h"
+#include "lvgl/lvgl.h"
+#include "lv_conf.h"
+#include "millis.h"
+
+
+#define TICK_DEF 10
+#define TICKER_TIME 0.001 * TICK_DEF
+
+Ticker ticker; //Initialize your system tick
+LCD_DISCO_F746NG lcd; //Initialize your display driver
+TS_DISCO_F746NG ts; //Initialize your touchpad driver
+TS_StateTypeDef TS_State; //Initialize your touch state sctruct
+
+int X;
+int Y;
+char text[30];
+
+void initialisation();
+
+/*********************
+ * STATIC PROTOTYPES
+ *********************/
+static void entete_create(void);
+static void sb_create(void);
+static void content_create(void);
+static void theme_select_event_handler(lv_obj_t * roller, lv_event_t event);
+static void hue_select_event_cb(lv_obj_t * roller, lv_event_t event);
+static void init_all_themes(uint16_t hue);
+static void bar_set_value(lv_obj_t * bar, int16_t value);
+/*********************
+ * STATIC VARIABLES
+ *********************/
+static lv_obj_t * enteteOBJ;
+static lv_obj_t * entete;
+static lv_obj_t * sb;
+static lv_obj_t * content;
+static lv_theme_t * th_act;
+static lv_obj_t * BPMESURE;
+static lv_obj_t * BPPARA;
+static lv_obj_t * BPMENU3;
+static lv_obj_t * BPMENU4;
+static lv_obj_t * BPMENU5;
+static lv_obj_t * BPMENU6;
+static lv_obj_t * AffMillis;
+static lv_obj_t * label;
+static lv_obj_t * label1;
+
+
+
+LV_FONT_DECLARE(arial_20) //Declare a font
+
+void lv_ticker_func();
+void my_disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p);
+bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
+static void event_handler(lv_obj_t * obj, lv_event_t event);
+//void btn_event_cb(lv_obj_t * btn, lv_event_t event);
+
+
+static void BPMESURE_ACT(lv_obj_t * btn, lv_event_t event);
+static void BPPARA_ACT(lv_obj_t * btn, lv_event_t event);
+static void BPMENU3_ACT(lv_obj_t * btn, lv_event_t event);
+static void BPMENU4_ACT(lv_obj_t * btn, lv_event_t event);
+static void BPMENU5_ACT(lv_obj_t * btn, lv_event_t event);
+static void BPMENU6_ACT(lv_obj_t * btn, lv_event_t event);
+static void ddlist_event_cb(lv_obj_t * ddlist, lv_event_t event);
+static lv_obj_t * slider;
+
+int PosX_MenuDepart = 0;
+int PosX_MenuCible = 0;
+bool DdeAlignMenu = 0;
+
+static void Reglage_R_RGB(lv_obj_t * obj, lv_event_t event);
+static void Reglage_G_RGB(lv_obj_t * obj, lv_event_t event);
+static void Reglage_B_RGB(lv_obj_t * obj, lv_event_t event);
+
+static void AFF_PAGE_REGL_COLOR(void);
+
+
+int TestAff = 0;
+
+static void Affect_Couleur(void);
+static lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina,Style_page,Style_texte;
+static lv_style_t * Style_EC;
+
+static lv_obj_t * btn_relache;
+static lv_obj_t * btn_presse;
+static lv_obj_t * btn_tgl_presse;
+static lv_obj_t * btn_inactif;
+
+
+
+static void PAGE1_FCT(void);
+static lv_obj_t * PAGE_REGL_COLOR;
+static void PAGE_REGL_COLOR_FCT();
+static lv_obj_t * Val_R;
+static lv_obj_t * Val_G;
+static lv_obj_t * Val_B;
+static lv_obj_t * R;
+static lv_obj_t * G;
+static lv_obj_t * B;
+static lv_obj_t * btn_close;
+
+
+
+uint8_t Reglage_R;
+uint8_t Reglage_G;
+uint8_t Reglage_B;
+uint32_t Reglage_RGB;
+
+static lv_obj_t * Reglage1;
+static lv_obj_t * Reglage2;
+static lv_obj_t * Reglage3;
+static lv_obj_t * Reglage4;
+static lv_obj_t * Reglage5;
+static lv_obj_t * Reglage6;
+static lv_obj_t * Reglage7;
+static lv_obj_t * Reglage8;
+static lv_obj_t * Reglage9;
+static lv_obj_t * Reglage10;
+static lv_obj_t * Reglage11;
+static lv_obj_t * Reglage12;
+static lv_obj_t * Reglage13;
+static lv_obj_t * Reglage14;
+static lv_obj_t * Reglage15;
+static lv_obj_t * Reglage16;
+static lv_obj_t * Reglage17;
+static lv_obj_t * Reglage18;
+static lv_obj_t * Reglage19;
+static void Reglage1_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage2_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage3_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage4_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage5_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage6_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage7_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage8_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage9_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage10_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage11_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage12_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage13_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage14_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage15_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage16_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage17_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage18_ACT(lv_obj_t * CB, lv_event_t event);
+static void Reglage19_ACT(lv_obj_t * CB, lv_event_t event);
+
+uint8_t R1=210,G1=255,B1=255,
+ R2=0 ,G2=0 ,B2=0,
+ R3=114 ,G3=179 ,B3=244,
+ R4=255,G4=255,B4=240,
+ R5=0,G5=145,B5=145,
+ R6=0,G6=0,B6=0,
+ R7=255,G7=255,B7=240,
+ R8=114 ,G8=179 ,B8=244,
+ R9=0,G9=145,B9=145,
+ R10=155,G10=238,B10=131,
+ R11=145,G11=145,B11=145,
+ R12=51,G12=37,B12=22,
+ R13=255,G13=255,B13=255,
+ R14=153,G14=158,B14=117,
+ R15=107,G15=154,B15=199,
+ R16=107,G16=154,B16=199,
+ R17=107,G17=154,B17=199,
+ R18=107,G18=154,B18=199,
+ R19=107,G19=154,B19=199;
+
+
+int NumCouleur=0;
+
+static void ClosePage(lv_obj_t * btn, lv_event_t event);
+lv_obj_t * th_roller ;
+
+
+
+static const char * th_options = {
+#if LV_USE_THEME_DEFAULT
+ "Default"
+#endif
+
+#if LV_USE_THEME_NIGHT
+ "\nNight"
+#endif
+
+#if LV_USE_THEME_MATERIAL
+ "\nMaterial"
+#endif
+
+#if LV_USE_THEME_ALIEN
+ "\nAlien"
+#endif
+
+#if LV_USE_THEME_ZEN
+ "\nZen"
+#endif
+
+#if LV_USE_THEME_NEMO
+ "\nNemo"
+#endif
+
+#if LV_USE_THEME_MONO
+ "\nMono"
+#endif
+
+
+ ""
+};
+
+static lv_theme_t * themes[8];
+
+
+
+int main()
+{
+ printf("Example of MbedOS5 with LittlevGL on Disco F746NI \n");
+ //lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"LittlevGL DEMO", CENTER_MODE);
+ ticker.attach(&lv_ticker_func,TICKER_TIME);
+ wait(0.5);
+ lv_init(); //Initialize the LittlevGL
+
+ static lv_disp_buf_t disp_buf;
+ static lv_color_t buf[LV_HOR_RES_MAX * 10]; //Declare a buffer for 10 lines
+ lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); //Initialize the display buffer
+
+ //Implement and register a function which can copy a pixel array to an area of your display
+ lv_disp_drv_t disp_drv; //Descriptor of a display driver
+ lv_disp_drv_init(&disp_drv); //Basic initialization
+ disp_drv.flush_cb = my_disp_flush; //Set your driver function
+ disp_drv.buffer = &disp_buf; //Assign the buffer to the display
+ lv_disp_drv_register(&disp_drv); //Finally register the driver
+
+ //Implement and register a function which can read an input device. E.g. for a touch pad
+ ts.Init(lcd.GetXSize(), lcd.GetYSize()); //ST touch initialization
+ lv_indev_drv_t indev_drv; //Descriptor of a input device driver
+ lv_indev_drv_init(&indev_drv); //Basic initialization
+ indev_drv.type = LV_INDEV_TYPE_POINTER; //Touch pad is a pointer-like device
+ indev_drv.read_cb = my_touchpad_read; //Set your driver function
+ lv_indev_drv_register(&indev_drv); //Finally register the driver
+
+
+
+
+ initialisation();
+ entete_create();
+ // sb_create();
+ content_create();
+ // PAGE1_FCT();
+ PAGE_REGL_COLOR_FCT();
+
+
+ lv_roller_set_selected(th_roller,0,0);
+ th_act = themes[0];
+ lv_theme_set_current(th_act);
+ th_act = themes[0];
+ lv_theme_set_current(th_act);
+
+
+
+// lv_style_copy(&btn_rel, &lv_style_plain);
+// lv_style_copy(&btn_pr, &lv_style_plain);
+// lv_style_copy(&btn_tgl_rel, &lv_style_plain);
+// lv_style_copy(&btn_tgl_pr, &lv_style_plain);
+// lv_style_copy(&btn_ina, &lv_style_plain);
+
+ while(1) {
+ lv_task_handler(); //Call lv_task_handler() periodically every few milliseconds. It will redraw the screen if required, handle input devices etc.
+
+ // TestAff=millis();
+ // sprintf(text, " %d ", millis());
+ // sprintf(text, " %d ", TestAff);
+
+ // lv_label_set_text(AffMillis, text);
+ // lv_label_set_text(AffMillis, "123");
+
+
+
+ if (DdeAlignMenu) {
+ if (PosX_MenuDepart>PosX_MenuCible) {
+ PosX_MenuDepart=PosX_MenuDepart-1;
+ lv_obj_set_pos(entete, PosX_MenuDepart, 0);
+ }
+ if (PosX_MenuDepart<PosX_MenuCible) {
+ PosX_MenuDepart=PosX_MenuDepart+1;
+ lv_obj_set_pos(entete, PosX_MenuDepart, 0);
+ }
+ if (PosX_MenuDepart==PosX_MenuCible) {
+ DdeAlignMenu=0;
+ }
+
+ }
+
+ // lv_label_set_text(label11, text); //Set the text
+ wait_ms(1);
+ }
+}
+
+
+
+
+
+
+void initialisation(void)
+{
+ // By doing this, we hide the first (empty) option.
+ if(th_options[0] == '\n') {
+ th_options++;
+ }
+
+ init_all_themes(0);
+ th_act = themes[0];
+ lv_theme_set_current(th_act);
+
+ lv_obj_t * scr = lv_obj_create(NULL, NULL);
+ lv_disp_load_scr(scr);
+}
+
+
+
+static void entete_create(void)
+{
+ entete = lv_cont_create(lv_disp_get_scr_act(NULL), NULL);
+
+ lv_obj_set_size(entete,900,40);
+
+ lv_cont_set_fit2(entete,LV_FIT_TIGHT, LV_FIT_NONE);
+ lv_obj_set_pos(entete, 50, 0);
+ lv_obj_set_drag_dir(entete, LV_DRAG_DIR_HOR);
+
+ lv_obj_t * sym = lv_label_create(entete, NULL);
+ lv_label_set_text(sym, LV_SYMBOL_GPS LV_SYMBOL_WIFI LV_SYMBOL_BLUETOOTH LV_SYMBOL_VOLUME_MAX);
+ lv_obj_align(sym, NULL, LV_ALIGN_IN_RIGHT_MID, -LV_DPI/10, 0);
+
+ //BP MESURE
+ BPMESURE = lv_btn_create(entete, NULL);
+ lv_btn_set_ink_in_time(BPMESURE, 200);
+ lv_btn_set_ink_wait_time(BPMESURE, 100);
+ lv_btn_set_ink_out_time(BPMESURE, 500);
+ lv_obj_t * label = lv_label_create(BPMESURE, NULL);
+ lv_label_set_text(label, "Mesures");
+ lv_obj_set_size(BPMESURE,100,40);
+ lv_obj_set_drag_parent(BPMESURE, true);
+ lv_obj_set_event_cb(BPMESURE, BPMESURE_ACT);
+
+ //BP PARAMETRES
+ BPPARA = lv_btn_create(entete, NULL);
+ lv_btn_set_ink_in_time(BPPARA, 200);
+ lv_btn_set_ink_wait_time(BPPARA, 100);
+ lv_btn_set_ink_out_time(BPPARA, 500);
+ label = lv_label_create(BPPARA, NULL);
+ lv_label_set_text(label, "Parametres");
+ lv_obj_set_size(BPPARA,100,40);
+ lv_btn_set_toggle(BPPARA, true);
+ lv_btn_toggle(BPPARA);
+
+ // lv_obj_set_drag(BPPARA, true);
+ lv_obj_align(BPPARA, BPMESURE, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
+ lv_obj_set_drag_parent(BPPARA, true);
+ lv_obj_set_event_cb(BPPARA, BPPARA_ACT);
+
+ //BP MENU3
+ BPMENU3 = lv_btn_create(entete, NULL);
+ label = lv_label_create(BPMENU3, NULL);
+ lv_label_set_text(label, "BPMENU3");
+ lv_obj_set_size(BPMENU3,100,40);
+ lv_obj_align(BPMENU3, BPPARA, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
+ lv_obj_set_drag_parent(BPMENU3, true);
+ lv_obj_set_event_cb(BPMENU3, BPMENU3_ACT);
+
+ //BP BPMENU4
+ BPMENU4 = lv_btn_create(entete, NULL);
+ label = lv_label_create(BPMENU4, NULL);
+ lv_label_set_text(label, "BPMENU4");
+ lv_obj_set_size(BPMENU4,100,40);
+ lv_obj_align(BPMENU4, BPMENU3, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
+ lv_obj_set_drag_parent(BPMENU4, true);
+ lv_obj_set_event_cb(BPMENU4, BPMENU4_ACT);
+
+ //BP BPMENU5
+ BPMENU5 = lv_btn_create(entete, NULL);
+ label = lv_label_create(BPMENU5, NULL);
+ lv_label_set_text(label, "BPMENU5");
+ lv_obj_set_size(BPMENU5,100,40);
+ lv_obj_align(BPMENU5, BPMENU4, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
+ lv_obj_set_drag_parent(BPMENU5, true);
+ lv_obj_set_event_cb(BPMENU5, BPMENU5_ACT);
+
+ //BP BPMENU6
+ BPMENU6 = lv_btn_create(entete, NULL);
+ label = lv_label_create(BPMENU6, NULL);
+ lv_label_set_text(label, "BPMENU6");
+ lv_obj_set_size(BPMENU6,100,40);
+ lv_obj_align(BPMENU6, BPMENU5, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
+ lv_obj_set_drag_parent(BPMENU6, true);
+ lv_obj_set_event_cb(BPMENU6, BPMENU6_ACT);
+
+}
+
+ static void Reglage1_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(Style_page.body.main_color);
+ NumCouleur=1;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage2_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(Style_page.text.color);
+ NumCouleur=2;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage3_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_rel.body.main_color);
+ NumCouleur=3;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage4_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_rel.body.grad_color);
+ NumCouleur=4;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+
+static void Reglage5_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_rel.body.border.color);
+ NumCouleur=5;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage6_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_rel.text.color);
+ NumCouleur=6;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage7_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_pr.body.main_color);
+ NumCouleur=7;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage8_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_pr.body.grad_color);
+ NumCouleur=8;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage9_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_pr.body.border.color);
+ NumCouleur=9;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage10_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_pr.text.color );
+ NumCouleur=10;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage11_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_ina.body.main_color);
+ NumCouleur=11;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+
+static void Reglage12_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_ina.body.grad_color);
+ NumCouleur=12;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage13_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_ina.body.border.color);
+ NumCouleur=13;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage14_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32( btn_ina.text.color);
+ NumCouleur=14;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage15_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_rel.body.border.color);
+ NumCouleur=15;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage16_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_rel.body.border.color);
+ NumCouleur=16;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage17_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_rel.body.border.color);
+ NumCouleur=17;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage18_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_rel.body.border.color);
+ NumCouleur=18;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Reglage19_ACT(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ Reglage_RGB=lv_color_to32(btn_rel.body.border.color);
+ NumCouleur=19;
+ AFF_PAGE_REGL_COLOR();
+ }
+}
+static void Affect_Couleur(void)
+{
+ // btn_rel.body.main_color = lv_color_hsv_to_rgb(Reglage_R, Reglage_G, Reglage_B);
+ // lv_obj_refresh_style(btn_relache);
+ // lv_obj_report_style_mod(&btn_rel);
+ // lv_obj_set_style(btn_relache, &btn_rel);
+
+ sprintf(text, "fond 1: R=%d G=%d B=%d",R1,G1,B1); lv_cb_set_text(Reglage1,text);
+ sprintf(text, "texte 2: R=%d G=%d B=%d",R2,G2,B2); lv_cb_set_text(Reglage2,text);
+ sprintf(text, "couleur 3: R=%d G=%d B=%d",R3,G3,B3); lv_cb_set_text(Reglage3,text);
+ sprintf(text, "degrade 4: R=%d G=%d B=%d",R4,G4,B4); lv_cb_set_text(Reglage4,text);
+ sprintf(text, "bord 5: R=%d G=%d B=%d",R5,G5,B5); lv_cb_set_text(Reglage5,text);
+ sprintf(text, "texte 6: R=%d G=%d B=%d",R6,G6,B6); lv_cb_set_text(Reglage6,text);
+ sprintf(text, "couleur 7: R=%d G=%d B=%d",R7,G7,B7); lv_cb_set_text(Reglage7,text);
+ sprintf(text, "degrade 8: R=%d G=%d B=%d",R8,G8,B8); lv_cb_set_text(Reglage8,text);
+ sprintf(text, "bord 9: R=%d G=%d B=%d",R9,G9,B9); lv_cb_set_text(Reglage9,text);
+ sprintf(text, "texte 10: R=%d G=%d B=%d",R10,G10,B10); lv_cb_set_text(Reglage10,text);
+ sprintf(text, "couleur 11: R=%d G=%d B=%d",R11,G11,B11); lv_cb_set_text(Reglage11,text);
+ sprintf(text, "degrade 12: R=%d G=%d B=%d",R12,G12,B12); lv_cb_set_text(Reglage12,text);
+ sprintf(text, "bord 13: R=%d G=%d B=%d",R13,G13,B13); lv_cb_set_text(Reglage13,text);
+ sprintf(text, "texte 14: R=%d G=%d B=%d",R14,G14,B14); lv_cb_set_text(Reglage14,text);
+
+ if (NumCouleur==1){ R1=Reglage_R;G1=Reglage_G;B1=Reglage_B;}
+ if (NumCouleur==2){ R2=Reglage_R;G2=Reglage_G;B2=Reglage_B;}
+ if (NumCouleur==3){ R3=Reglage_R;G3=Reglage_G;B3=Reglage_B;}
+ if (NumCouleur==4){ R4=Reglage_R;G4=Reglage_G;B4=Reglage_B;}
+ if (NumCouleur==5){ R5=Reglage_R;G5=Reglage_G;B5=Reglage_B;}
+ if (NumCouleur==6){ R6=Reglage_R;G6=Reglage_G;B6=Reglage_B;}
+ if (NumCouleur==7){ R7=Reglage_R;G7=Reglage_G;B7=Reglage_B;}
+ if (NumCouleur==8){ R8=Reglage_R;G8=Reglage_G;B8=Reglage_B;}
+ if (NumCouleur==9){ R9=Reglage_R;G9=Reglage_G;B9=Reglage_B;}
+ if (NumCouleur==10){ R10=Reglage_R;G10=Reglage_G;B10=Reglage_B;}
+ if (NumCouleur==11){ R11=Reglage_R;G11=Reglage_G;B11=Reglage_B;}
+ if (NumCouleur==12){ R12=Reglage_R;G12=Reglage_G;B12=Reglage_B;}
+ if (NumCouleur==13){ R13=Reglage_R;G13=Reglage_G;B13=Reglage_B;}
+ if (NumCouleur==14){ R14=Reglage_R;G14=Reglage_G;B14=Reglage_B;}
+ if (NumCouleur==15){ R15=Reglage_R;G15=Reglage_G;B15=Reglage_B;}
+ if (NumCouleur==16){ R16=Reglage_R;G16=Reglage_G;B16=Reglage_B;}
+ if (NumCouleur==17){ R17=Reglage_R;G17=Reglage_G;B17=Reglage_B;}
+ if (NumCouleur==18){ R18=Reglage_R;G18=Reglage_G;B18=Reglage_B;}
+ if (NumCouleur==19){ R19=Reglage_R;G19=Reglage_G;B19=Reglage_B;}
+
+
+ lv_style_copy(&Style_page, &lv_style_btn_rel);
+
+ Style_page.body.main_color = LV_COLOR_MAKE(R1, G1, B1);
+ Style_page.body.grad_color = LV_COLOR_MAKE(R1, G1, B1);
+ Style_page.body.border.color = LV_COLOR_MAKE(R1, G1, B1);
+ Style_page.text.color = LV_COLOR_MAKE(R2, G2, B2);
+ Style_page.body.opa = 200;
+
+ lv_page_set_style(content, LV_PAGE_STYLE_BG, &Style_page);
+
+ // label1.body.main_color = LV_COLOR_MAKE(R1, G1, B1);
+ lv_obj_set_style(label1, &Style_page);
+
+
+ lv_style_copy(&btn_rel, &lv_style_btn_rel);
+ // btn_rel.line.width = R7;
+ // btn_rel.line.rounded = G7;
+ // btn_rel.body.shadow.width = B7;
+ // btn_rel.body.shadow.color = LV_COLOR_MAKE(R8, G8, B8);
+ // btn_rel.body.padding.left = R9;
+ // btn_rel.body.padding.right = G9;
+ // btn_rel.body.padding.top = B9;
+ // lv_style_btn_rel.body.padding.bottom = R10;
+ // lv_style_btn_rel.body.padding.inner = G10;
+ btn_rel.body.main_color = LV_COLOR_MAKE(R3, G3, B3);
+ btn_rel.body.grad_color = LV_COLOR_MAKE(R4, G4, B4);
+ btn_rel.body.border.color = LV_COLOR_MAKE(R5, G5, B5);
+ btn_rel.text.color = LV_COLOR_MAKE(R6, G6, B6);
+
+
+ lv_style_copy(&btn_pr, &lv_style_btn_pr);
+ btn_pr.body.main_color = LV_COLOR_MAKE(R7, G7, B7);
+ btn_pr.body.grad_color = LV_COLOR_MAKE(R8, G8, B8);
+ btn_pr.body.border.color = LV_COLOR_MAKE(R9, G9, B9);
+ btn_pr.text.color = LV_COLOR_MAKE(R10, G10, B10);
+
+ lv_style_copy(&btn_tgl_rel, &btn_rel);
+
+ lv_style_copy(&btn_tgl_pr, &btn_pr);
+
+ lv_style_copy(&btn_ina, &lv_style_btn_ina);
+ btn_ina.body.main_color = LV_COLOR_MAKE(R11, G11, B11);
+ btn_ina.body.grad_color = LV_COLOR_MAKE(R12, G12, B12);
+ btn_ina.body.border.color = LV_COLOR_MAKE(R13, G13, B13);
+ btn_ina.text.color = LV_COLOR_MAKE(R14, G14, B14);
+
+
+ lv_obj_set_style(btn_relache, &btn_rel);
+ lv_obj_set_style(btn_presse, &btn_pr);
+ lv_obj_set_style(btn_tgl_presse, &btn_tgl_rel);
+ lv_obj_set_style(btn_inactif, &btn_ina);
+
+
+ lv_style_copy(&Style_texte, &lv_style_transp);
+ Style_texte.text.color = LV_COLOR_MAKE(R2, G2, B2);
+ lv_obj_set_style(Reglage1, &Style_texte);
+
+}
+
+static void PAGE_REGL_COLOR_FCT(void)
+{
+
+ // lv_obj_del(PAGE_REGL_COLOR);
+ PAGE_REGL_COLOR = lv_cont_create(lv_disp_get_scr_act(NULL), NULL);
+ lv_obj_set_size(PAGE_REGL_COLOR, 170, 240);
+ lv_obj_set_pos(PAGE_REGL_COLOR, 200, 50);
+ lv_obj_set_drag(PAGE_REGL_COLOR, true);
+ // lv_obj_set_drag_parent(PAGE_REGL_COLOR, true);
+
+
+ /*Create styles*/
+ static lv_style_t style_bg,style_knob;
+ static lv_style_t style_indic_R,style_indic_G,style_indic_B;
+
+
+ lv_style_copy(&style_bg, &lv_style_pretty);
+ style_bg.body.main_color = LV_COLOR_BLACK;
+ style_bg.body.grad_color = LV_COLOR_BLACK;
+ style_bg.body.radius = LV_RADIUS_CIRCLE;
+ style_bg.body.border.color = LV_COLOR_SILVER;
+
+ lv_style_copy(&style_indic_R, &lv_style_pretty_color);
+ style_indic_R.body.main_color = LV_COLOR_RED;
+ style_indic_R.body.grad_color = LV_COLOR_RED;
+ style_indic_R.body.radius = LV_RADIUS_CIRCLE;
+ style_indic_R.body.shadow.width = 4;
+ style_indic_R.body.shadow.color = LV_COLOR_RED;
+ style_indic_R.body.padding.left = 3;
+ style_indic_R.body.padding.right = 3;
+ style_indic_R.body.padding.top = 3;
+ style_indic_R.body.padding.bottom = 3;
+
+ lv_style_copy(&style_indic_G, &style_indic_R);
+ style_indic_G.body.main_color = LV_COLOR_GREEN;
+ style_indic_G.body.grad_color = LV_COLOR_GREEN;
+ style_indic_G.body.shadow.color = LV_COLOR_GREEN;
+
+ lv_style_copy(&style_indic_B, &style_indic_R);
+ style_indic_B.body.main_color = LV_COLOR_BLUE;
+ style_indic_B.body.grad_color = LV_COLOR_BLUE;
+ style_indic_B.body.shadow.color = LV_COLOR_BLUE;
+
+ lv_style_copy(&style_knob, &lv_style_pretty);
+ style_knob.body.radius = LV_RADIUS_CIRCLE;
+ style_knob.body.opa = LV_OPA_70;
+ style_knob.body.padding.top = 10 ;
+ style_knob.body.padding.bottom = 10 ;
+
+
+ /*Create a slider ROUGE*/
+ R = lv_slider_create(PAGE_REGL_COLOR, NULL);
+ lv_obj_set_pos(R, 10, 40);
+ lv_obj_set_width(R, 30);
+ lv_obj_set_height(R, 180);
+ lv_slider_set_range(R, 0, 255);
+ lv_slider_set_value(R, Reglage_R, false);
+ style_indic_R.body.main_color = LV_COLOR_RED;
+ style_indic_R.body.grad_color = LV_COLOR_RED;
+ style_indic_R.body.shadow.color = LV_COLOR_RED;
+ lv_slider_set_style(R, LV_SLIDER_STYLE_BG, &style_bg);
+ lv_slider_set_style(R, LV_SLIDER_STYLE_INDIC,&style_indic_R);
+ lv_slider_set_style(R, LV_SLIDER_STYLE_KNOB, &style_knob);
+ lv_obj_set_event_cb(R, Reglage_R_RGB);
+ Val_R = lv_label_create(PAGE_REGL_COLOR, NULL);
+ lv_obj_align(Val_R, R, LV_ALIGN_OUT_TOP_MID, 0, -5);
+ sprintf(text, " %d ", lv_slider_get_value(R));
+ lv_label_set_text(Val_R, text);
+
+
+ /*Create a slider VERT*/
+ G = lv_slider_create(PAGE_REGL_COLOR, NULL);
+ lv_obj_set_pos(G, 60, 40);
+ lv_obj_set_width(G, 30);
+ lv_obj_set_height(G, 180);
+ lv_slider_set_range(G, 0, 255);
+ lv_slider_set_value(G, Reglage_G, false);
+ lv_slider_set_style(G, LV_SLIDER_STYLE_BG, &style_bg);
+ lv_slider_set_style(G, LV_SLIDER_STYLE_INDIC,&style_indic_G);
+ lv_slider_set_style(G, LV_SLIDER_STYLE_KNOB, &style_knob);
+ lv_obj_set_event_cb(G, Reglage_G_RGB);
+ Val_G = lv_label_create(PAGE_REGL_COLOR, NULL);
+ lv_obj_align(Val_G, G, LV_ALIGN_OUT_TOP_MID, 0, -5);
+ sprintf(text, " %d ", lv_slider_get_value(G));
+ lv_label_set_text(Val_G, text);
+
+ /*Create a slider BLEU*/
+ B = lv_slider_create(PAGE_REGL_COLOR, NULL);
+ lv_obj_set_pos(B, 110, 40);
+ lv_obj_set_width(B, 30);
+ lv_obj_set_height(B, 180);
+ lv_slider_set_range(B, 0, 255);
+ lv_slider_set_value(B, Reglage_B, false);
+ lv_slider_set_style(B, LV_SLIDER_STYLE_BG, &style_bg);
+ lv_slider_set_style(B, LV_SLIDER_STYLE_INDIC,&style_indic_B);
+ lv_slider_set_style(B, LV_SLIDER_STYLE_KNOB, &style_knob);
+ lv_obj_set_event_cb(B, Reglage_B_RGB);
+ Val_B = lv_label_create(PAGE_REGL_COLOR, NULL);
+ lv_obj_align(Val_B, B, LV_ALIGN_OUT_TOP_MID, 0, -5);
+ sprintf(text, " %d ", lv_slider_get_value(B));
+ lv_label_set_text(Val_B, text);
+
+ //BP
+ btn_close = lv_btn_create(PAGE_REGL_COLOR, NULL);
+ lv_obj_t * label = lv_label_create(btn_close, NULL);
+ lv_obj_set_pos(btn_close, 150, 10);
+ lv_label_set_text(label, "X");
+ lv_obj_set_size(btn_close,20,20);
+ lv_obj_set_event_cb(btn_close, ClosePage);
+
+ lv_obj_set_style(btn_close, &lv_style_pretty_color);
+
+ lv_obj_set_hidden(PAGE_REGL_COLOR, 1);
+}
+
+static void ClosePage(lv_obj_t * CB, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ lv_obj_set_hidden(PAGE_REGL_COLOR, 1);
+ lv_cb_set_checked(Reglage1, 0);
+ lv_cb_set_checked(Reglage2, 0);
+ lv_cb_set_checked(Reglage3, 0);
+ lv_cb_set_checked(Reglage4, 0);
+ lv_cb_set_checked(Reglage5, 0);
+ lv_cb_set_checked(Reglage6, 0);
+ lv_cb_set_checked(Reglage7, 0);
+ lv_cb_set_checked(Reglage8, 0);
+ lv_cb_set_checked(Reglage9, 0);
+ lv_cb_set_checked(Reglage10, 0);
+ lv_cb_set_checked(Reglage11, 0);
+ lv_cb_set_checked(Reglage12, 0);
+ lv_cb_set_checked(Reglage13, 0);
+ lv_cb_set_checked(Reglage14, 0);
+ // lv_cb_set_checked(Reglage15, 0);
+ // lv_cb_set_checked(Reglage16, 0);
+ // lv_cb_set_checked(Reglage17, 0);
+ // lv_cb_set_checked(Reglage18, 0);
+ // lv_cb_set_checked(Reglage19, 0);
+ }
+}
+
+static void AFF_PAGE_REGL_COLOR(void)
+{
+ Reglage_R=(Reglage_RGB >> 16) & 0xFF ;
+ Reglage_G=(Reglage_RGB >> 8) & 0xFF ;
+ Reglage_B=(Reglage_RGB) & 0xFF ;
+ sprintf(text, " %d ",Reglage_R );lv_label_set_text(Val_R, text);
+ sprintf(text, " %d ",Reglage_G );lv_label_set_text(Val_G, text);
+ sprintf(text, " %d ",Reglage_B );lv_label_set_text(Val_B, text);
+ lv_slider_set_value(R, Reglage_R, false);
+ lv_slider_set_value(G, Reglage_G, false);
+ lv_slider_set_value(B, Reglage_B, false);
+ lv_obj_set_hidden(PAGE_REGL_COLOR, 0);
+}
+
+static void Reglage_R_RGB(lv_obj_t * obj, lv_event_t event)
+{
+ if(event == LV_EVENT_PRESSING) {
+ Reglage_R= lv_slider_get_value(obj);
+ sprintf(text, " %d ",Reglage_R );
+ lv_label_set_text(Val_R, text);
+ Affect_Couleur();
+ }
+}
+static void Reglage_G_RGB(lv_obj_t * obj, lv_event_t event)
+{
+ if(event == LV_EVENT_PRESSING) {
+ Reglage_G= lv_slider_get_value(obj);
+ sprintf(text, " %d ",Reglage_G );;
+ lv_label_set_text(Val_G, text);
+ Affect_Couleur();
+ }
+}
+static void Reglage_B_RGB(lv_obj_t * obj, lv_event_t event)
+{
+ if(event == LV_EVENT_PRESSING) {
+ Reglage_B= lv_slider_get_value(obj);
+ sprintf(text, " %d ",Reglage_B );
+ lv_label_set_text(Val_B, text);
+ Affect_Couleur();
+ }
+}
+
+
+
+static void content_create(void)
+{
+ lv_coord_t hres = lv_disp_get_hor_res(NULL);
+ lv_coord_t vres = lv_disp_get_ver_res(NULL);
+
+ content = lv_page_create(lv_disp_get_scr_act(NULL), NULL);
+ lv_obj_set_size(content, hres, vres);
+ lv_obj_set_pos(content, 0, 40);
+
+ lv_page_set_scrl_layout(content, LV_LAYOUT_OFF);
+ lv_page_set_scrl_fit2(content, LV_FIT_FLOOD, LV_FIT_TIGHT);
+
+ lv_coord_t max_w = lv_page_get_fit_width(content);
+
+
+ th_roller = lv_roller_create(content, NULL);
+ lv_roller_set_options(th_roller, th_options, true);
+ lv_obj_set_pos(th_roller, 20, 0);
+ lv_obj_set_event_cb(th_roller, theme_select_event_handler);
+
+
+ AffMillis = lv_label_create(content, NULL);
+ lv_label_set_text(AffMillis, "123");
+ lv_obj_set_pos(AffMillis, 150, 0);
+
+ //BP
+ btn_relache = lv_btn_create(content, NULL);
+ lv_obj_set_pos(btn_relache, 20, 100);
+ lv_btn_set_ink_in_time(btn_relache, 200);
+ lv_btn_set_ink_wait_time(btn_relache, 100);
+ lv_btn_set_ink_out_time(btn_relache, 500);
+ label = lv_label_create(btn_relache, NULL);
+ lv_label_set_text(label, "BP RELACHE");
+ lv_obj_set_size(btn_relache,100,40);
+ lv_btn_set_toggle(btn_relache, true);
+ lv_btn_toggle(btn_relache);
+ lv_page_glue_obj(btn_relache, true);
+
+
+ //BP
+ btn_presse = lv_btn_create(content, NULL);
+ lv_obj_set_pos(btn_presse, 20, 200);
+ lv_btn_set_ink_in_time(btn_presse, 200);
+ lv_btn_set_ink_wait_time(btn_presse, 100);
+ lv_btn_set_ink_out_time(btn_presse, 500);
+ label = lv_label_create(btn_presse, NULL);
+ lv_label_set_text(label, "BP PRESSE");
+ lv_obj_set_size(btn_presse,100,40);
+ lv_btn_set_toggle(btn_presse, true);
+ lv_btn_toggle(btn_presse);
+ lv_page_glue_obj(btn_presse, true);
+
+
+ //BP
+ btn_inactif = lv_btn_create(content, NULL);
+ lv_obj_set_pos(btn_inactif, 20, 300);
+ lv_btn_set_ink_in_time(btn_inactif, 200);
+ lv_btn_set_ink_wait_time(btn_inactif, 100);
+ lv_btn_set_ink_out_time(btn_inactif, 500);
+ label = lv_label_create(btn_inactif, NULL);
+ lv_label_set_text(label, "BP INACTIF");
+ lv_obj_set_size(btn_inactif,100,40);
+ lv_page_glue_obj(btn_inactif, true);
+
+ //BP
+ btn_tgl_presse = lv_btn_create(content, NULL);
+ lv_obj_set_pos(btn_tgl_presse, 20, 400);
+ lv_btn_set_ink_in_time(btn_tgl_presse, 200);
+ lv_btn_set_ink_wait_time(btn_tgl_presse, 100);
+ lv_btn_set_ink_out_time(btn_tgl_presse, 500);
+ label = lv_label_create(btn_tgl_presse, NULL);
+ lv_label_set_text(label, "BP BASCULE");
+ lv_obj_set_size(btn_tgl_presse,100,40);
+ lv_btn_set_toggle(btn_tgl_presse, true);
+ lv_btn_toggle(btn_tgl_presse);
+ lv_page_glue_obj(btn_tgl_presse, true);
+
+
+
+ //Check box
+ Reglage1 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage1, 150, 20);
+ lv_obj_set_event_cb(Reglage1, Reglage1_ACT);
+ lv_page_glue_obj(Reglage1, true);
+
+ Reglage2 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage2, 150, 40);
+ lv_obj_set_event_cb(Reglage2, Reglage2_ACT);
+ lv_page_glue_obj(Reglage2, true);
+
+ Reglage3 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage3, 150, 80);
+ lv_obj_set_event_cb(Reglage3, Reglage3_ACT);
+ lv_page_glue_obj(Reglage3, true);
+
+ Reglage4 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage4, 150, 100);
+ lv_obj_set_event_cb(Reglage4, Reglage4_ACT);
+ lv_page_glue_obj(Reglage4, true);
+
+ Reglage5 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage5, 150, 120);
+ lv_obj_set_event_cb(Reglage5, Reglage5_ACT);
+ lv_page_glue_obj(Reglage5, true);
+
+ Reglage6 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage6, 150, 140);
+ lv_obj_set_event_cb(Reglage6, Reglage6_ACT);
+ lv_page_glue_obj(Reglage6, true);
+
+ Reglage7 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage7, 150, 180);
+ lv_obj_set_event_cb(Reglage7, Reglage7_ACT);
+ lv_page_glue_obj(Reglage7, true);
+
+ Reglage8 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage8, 150, 200);
+ lv_obj_set_event_cb(Reglage8, Reglage8_ACT);
+ lv_page_glue_obj(Reglage8, true);
+
+ Reglage9 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage9, 150, 220);
+ lv_obj_set_event_cb(Reglage9, Reglage9_ACT);
+ lv_page_glue_obj(Reglage9, true);
+
+ Reglage10 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage10, 150, 240);
+ lv_obj_set_event_cb(Reglage10, Reglage10_ACT);
+ lv_page_glue_obj(Reglage10, true);
+
+ Reglage11 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage11, 150, 280);
+ lv_obj_set_event_cb(Reglage11, Reglage11_ACT);
+ lv_page_glue_obj(Reglage11, true);
+
+ Reglage12 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage12, 150, 300);
+ lv_obj_set_event_cb(Reglage12, Reglage12_ACT);
+ lv_page_glue_obj(Reglage12, true);
+
+ Reglage13 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage13, 150, 320);
+ lv_obj_set_event_cb(Reglage13, Reglage13_ACT);
+ lv_page_glue_obj(Reglage13, true);
+
+ Reglage14 = lv_cb_create(content, NULL);
+ lv_obj_set_pos(Reglage14, 150, 340);
+ lv_obj_set_event_cb(Reglage14, Reglage14_ACT);
+ lv_page_glue_obj(Reglage14, true);
+
+ label1 = lv_label_create(content, NULL);
+ lv_label_set_text(label1, "FIN");
+ lv_obj_set_pos(label1, 20, 450);
+
+
+ Affect_Couleur();
+
+
+}
+
+static void theme_select_event_handler(lv_obj_t * roller, lv_event_t event)
+{
+ if(event == LV_EVENT_VALUE_CHANGED) {
+
+ uint16_t opt = lv_roller_get_selected(roller);
+ th_act = themes[opt];
+ lv_theme_set_current(th_act);
+
+ /*
+ const lv_style_t * Style_Get;
+
+// Style_Get=lv_btn_get_style(btn_relache, LV_BTN_STYLE_REL);
+ // Style_EC=lv_btn_get_style(btn_relache, LV_BTN_STYLE_REL);
+ Style_Get =lv_obj_get_style(btn_relache);
+ uint32_t couleur=btn_ina.body.main_color.ch.red;
+ uint32_t couleur2=Style_Get.body.main_color.ch.red;
+ // couleur=Style_Get.body.grad_color ;
+ lv_color32_t c32;
+c32.full = lv_color_to32(btn_ina.body.main_color);
+
+
+
+
+
+
+ sprintf(text, " %d ", couleur);
+ lv_label_set_text(AffMillis, text);*/
+
+ // theme.style.btn.rel = &lv_style_btn_rel;
+ // theme.style.btn.pr = &lv_style_btn_pr;
+ // theme.style.btn.tgl_rel = &lv_style_btn_tgl_rel;
+ // theme.style.btn.tgl_pr = &lv_style_btn_tgl_pr;
+ // theme.style.btn.ina = &lv_style_btn_ina;
+ }
+}
+
+
+static void init_all_themes(uint16_t hue)
+{
+ // NOTE: This must be adjusted if more themes are added.
+ int i = 0;
+#if LV_USE_THEME_DEFAULT
+ themes[i++] = lv_theme_default_init(hue, NULL);
+#endif
+
+#if LV_USE_THEME_NIGHT
+ themes[i++] = lv_theme_night_init(hue, NULL);
+#endif
+
+#if LV_USE_THEME_MATERIAL
+ themes[i++] = lv_theme_material_init(hue, NULL);
+#endif
+
+#if LV_USE_THEME_ALIEN
+ themes[i++] = lv_theme_alien_init(hue, NULL);
+#endif
+
+#if LV_USE_THEME_ZEN
+ themes[i++] = lv_theme_zen_init(hue, NULL);
+#endif
+
+#if LV_USE_THEME_NEMO
+ themes[i++] = lv_theme_nemo_init(hue, NULL);
+#endif
+
+#if LV_USE_THEME_MONO
+ themes[i++] = lv_theme_mono_init(hue, NULL);
+#endif
+
+
+}
+
+
+static void BPMESURE_ACT(lv_obj_t * btn, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ PosX_MenuDepart = lv_obj_get_x(entete);
+ PosX_MenuCible = -lv_obj_get_x(BPMESURE);
+ DdeAlignMenu=1;
+ }
+}
+static void BPPARA_ACT(lv_obj_t * btn, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ PosX_MenuDepart = lv_obj_get_x(entete);
+ PosX_MenuCible = -lv_obj_get_x(BPPARA);
+ DdeAlignMenu=1;
+ }
+}
+static void BPMENU3_ACT(lv_obj_t * btn, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ PosX_MenuDepart = lv_obj_get_x(entete);
+ PosX_MenuCible = -lv_obj_get_x(BPMENU3);
+ DdeAlignMenu=1;
+ }
+}
+static void BPMENU4_ACT(lv_obj_t * btn, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ PosX_MenuDepart = lv_obj_get_x(entete);
+ PosX_MenuCible = -lv_obj_get_x(BPMENU4);
+ DdeAlignMenu=1;
+ }
+}
+static void BPMENU5_ACT(lv_obj_t * btn, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ PosX_MenuDepart = lv_obj_get_x(entete);
+ PosX_MenuCible = -lv_obj_get_x(BPMENU5);
+ DdeAlignMenu=1;
+ }
+}
+static void BPMENU6_ACT(lv_obj_t * btn, lv_event_t event)
+{
+ if(event == LV_EVENT_CLICKED) {
+ PosX_MenuDepart = lv_obj_get_x(entete);
+ PosX_MenuCible = -lv_obj_get_x(BPMENU6);
+ DdeAlignMenu=1;
+ }
+}
+
+static void ddlist_event_cb(lv_obj_t * ddlist, lv_event_t event)
+{
+ if(event == LV_EVENT_VALUE_CHANGED) {
+ uint16_t opt = lv_ddlist_get_selected(ddlist); //Get the id of selected option
+
+ lv_slider_set_value(slider, (opt * 100) / 4, true); //Modify the slider value according to the selection
+ }
+
+}
+
+
+
+void lv_ticker_func()
+{
+ lv_tick_inc(TICK_DEF); //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.
+}
+
+void my_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++) {
+
+ 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);
+}
+
+bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
+{
+ static lv_coord_t last_x = 0;
+ static lv_coord_t last_y = 0;
+
+ //Save the state and save the pressed coordinate
+ ts.GetState(&TS_State);
+
+ if(TS_State.touchDetected == 1) {
+ data->state = LV_INDEV_STATE_PR;
+ } else {
+ data->state = LV_INDEV_STATE_REL;
+ }
+
+ //data->state = tttt ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
+ // if(data->state == LV_INDEV_STATE_PR){
+ if(data->state == LV_INDEV_STATE_PR) {
+ //touchpad_get_xy(&last_x, &last_y);
+ last_x = TS_State.touchX[0];
+ last_y = TS_State.touchY[0];
+ }
+
+ //Set the coordinates (if released use the last pressed coordinates)
+ data->point.x = last_x;
+ data->point.y = last_y;
+
+ X = TS_State.touchDetected ;
+
+
+
+ return false; //Return `false` because we are not buffering and no more data to read
+}
+
+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");
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jan 15 19:30:05 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/millis.lib Wed Jan 15 19:30:05 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/hudakz/code/millis/#ac7586424119