Demo program for LvGL_F746NG.

Dependencies:   LvGL_F746NG

Files at this revision

API Documentation at this revision

Comitter:
elelthvd
Date:
Tue Sep 08 13:35:16 2020 +0800
Commit message:
Initial commit

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
.hgignore Show annotated file Show diff for this revision Revisions of this file
LvGL_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
lv_conf.h Show annotated file Show diff for this revision Revisions of this file
lv_helloworld/lv_helloworld.cpp Show annotated file Show diff for this revision Revisions of this file
lv_helloworld/lv_helloworld.h Show annotated file Show diff for this revision Revisions of this file
lvgl.lib Show annotated file Show diff for this revision Revisions of this file
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
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,7 @@
+.build
+.mbed
+projectfiles
+*.py*
+mbed-os
+BUILD
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,5 @@
+^BUILD$
+^.mbed$
+^lvgl$
+^mbed-os$
+^LvGL_F746NG$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LvGL_F746NG.lib	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/elelthvd/code/LvGL_F746NG/#cffa136e7f8fed2b5ef387b0501d3f8480ccaeb0
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lv_conf.h	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,1 @@
+#include "lv_conf_f746ng.h"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lv_helloworld/lv_helloworld.cpp	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,59 @@
+
+#include "mbed.h" // needed for anything mbed
+// #include "lvgl_stm32f7.h" // needed for lv_coord_t
+#include "lvgl.h"
+
+static lv_obj_t * tv;
+static lv_obj_t * t1;
+
+static void controls_create(lv_obj_t * parent);
+
+void lv_demo_widgets(void)
+{
+    tv = lv_tabview_create(lv_scr_act(), NULL);
+    t1 = lv_tabview_add_tab(tv, "Hello World");
+    controls_create(t1);
+
+}
+#define OPTLIGHT "Light"
+#define OPTDARK "Dark"
+static void mbox_handler(lv_obj_t * obj, lv_event_t event)
+{
+#if LV_USE_THEME_MATERIAL
+    if(event == LV_EVENT_VALUE_CHANGED) {
+        uint32_t flag ;
+        const char *btn_text = lv_msgbox_get_active_btn_text(obj);
+        if( 0 == strcmp(btn_text, OPTLIGHT) )
+            flag = LV_THEME_MATERIAL_FLAG_LIGHT;
+        if( 0 == strcmp(btn_text, OPTDARK) )
+            flag = LV_THEME_MATERIAL_FLAG_DARK;
+        if(LV_THEME_DEFAULT_INIT != lv_theme_material_init)
+            return;
+        LV_THEME_DEFAULT_INIT(lv_theme_get_color_primary(), lv_theme_get_color_secondary(),
+            flag,
+            lv_theme_get_font_small(), lv_theme_get_font_normal(), lv_theme_get_font_subtitle(), lv_theme_get_font_title());
+        lv_msgbox_start_auto_close(obj, 10);
+    }
+#endif
+}
+static void controls_create(lv_obj_t * parent)
+{
+    lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY_TOP);
+    static const char * btns[] = {OPTLIGHT, OPTDARK, ""};
+
+    lv_obj_t * mbox = lv_msgbox_create(lv_scr_act(), NULL);
+    lv_msgbox_set_text(mbox, "How are you today?");
+    lv_msgbox_add_btns(mbox, btns);
+    lv_obj_t * btnm = lv_msgbox_get_btnmatrix(mbox);
+    lv_btnmatrix_set_btn_ctrl(btnm, 1, LV_BTNMATRIX_CTRL_CHECK_STATE);
+    lv_obj_set_event_cb(mbox, mbox_handler);
+}
+
+
+/*
+    lv_helloworld()     Example minimal LV GUI
+ */
+void lv_helloworld(void)
+{
+    lv_demo_widgets();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lv_helloworld/lv_helloworld.h	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,4 @@
+/*
+    lv_helloworld()     Example minimal LV GUI
+ */
+void lv_helloworld(void);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lvgl.lib	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,1 @@
+https://github.com/lvgl/lvgl/#b87d16fc6ec92ed9f216b976c1e38fca3691959c
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,15 @@
+#include "mbed.h"
+#include "lvgl_f746ng.h"
+#include "lv_helloworld.h"
+
+
+int main()
+{
+    lvgl_f746ng_init(); // Boiler plate
+
+    lv_helloworld(); // Create custom GUI
+    
+    while(1) {
+        thread_sleep_for(100); // Keep alive main thread, ZZzz..
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os.git#a2ada74770f043aff3e61e29d164a8e78274fcd4
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Tue Sep 08 13:35:16 2020 +0800
@@ -0,0 +1,4 @@
+{
+    
+    "requires": ["bare-metal"]
+}