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 1:627f26953c53, committed 2020-04-07
- Comitter:
- JohnnyK
- Date:
- Tue Apr 07 08:03:55 2020 +0000
- Parent:
- 0:10c4b83c458d
- Child:
- 2:afc050526249
- Commit message:
- Test on the latest MbedOS (5.15.1) and also a change of event_handler (according to the LvGL doc) for better demonstration what can be read from button event.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed-os.lib | Show annotated file Show diff for this revision Revisions of this file |
--- 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);
}
}
--- a/mbed-os.lib Mon Dec 02 19:28:26 2019 +0000 +++ b/mbed-os.lib Tue Apr 07 08:03:55 2020 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#3a57ec7401a77b8b98f6356a1498cb154229483f +https://github.com/ARMmbed/mbed-os/#532654ebb31c7bf79601042a6fa976b85532ef47