Example of using the LVGL (8.3.4) with the MbedOS (6.16 - bare metal) on the Disco-F746NG board

Dependencies:   BSP_DISCO_F746NG

Revision:
1:627f26953c53
Parent:
0:10c4b83c458d
Child:
2:afc050526249
--- a/main.cpp	Mon Dec 02 19:28:26 2019 +0000
+++ b/main.cpp	Tue Apr 07 08:03:55 2020 +0000
@@ -3,7 +3,7 @@
 #include "lvgl/lvgl.h"
 #include "lv_port_disp.h"
 #include "lv_port_indev.h"
-#include "demo.h" //Comment/uncomment will switch between LittlevGL demo and Hello word example
+//#include "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
@@ -22,15 +22,40 @@
     //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");
+#ifndef DEMO_H
+//lvgl buttons object event handler
+static void event_handler(lv_obj_t * obj, lv_event_t event){
+    switch(event) {
+        case LV_EVENT_PRESSED:
+            printf("Pressed\n");
+            break;
+
+        case LV_EVENT_SHORT_CLICKED:
+            printf("Short clicked\n");
+            break;
+
+        case LV_EVENT_CLICKED:
+            printf("Clicked\n");
+            break;
+        
+        case LV_EVENT_VALUE_CHANGED:
+            printf("Toggled\n");
+            break;
+
+        case LV_EVENT_LONG_PRESSED:
+            printf("Long press\n");
+            break;
+
+        case LV_EVENT_LONG_PRESSED_REPEAT:
+            printf("Long press repeat\n");
+            break;
+
+        case LV_EVENT_RELEASED:
+            printf("Released\n");
+            break;
     }
-    else if(event == LV_EVENT_VALUE_CHANGED) {
-        printf("Toggled\n");
-    }
-} 
+}
+#endif   
 
 int main()
 {
@@ -72,7 +97,7 @@
 #endif   
 
     while(1) {
-        //something   
-        //wait_us(WAIT_TIME);
+        //do something   
+        //thread_sleep_for(WAIT_TIME);
     }
 }