summaryrefslogtreecommitdiff
path: root/lib/lvgl/examples/libs/qrcode
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-06-01 15:41:47 +1000
committerjacqueline <me@jacqueline.id.au>2023-06-01 15:41:47 +1000
commitdd27c3530432ea0b09f01e604bf577f31d8ef841 (patch)
treebbf86cf81a78f0ff0b07f31f1c390db473f26fd3 /lib/lvgl/examples/libs/qrcode
parent6fd588e970470b15936187980829916d0dbe77bb (diff)
downloadtangara-fw-dd27c3530432ea0b09f01e604bf577f31d8ef841.tar.gz
convert lvgl from submodule to a plain old directory
Diffstat (limited to 'lib/lvgl/examples/libs/qrcode')
m---------lib/lvgl0
-rw-r--r--lib/lvgl/examples/libs/qrcode/index.rst6
-rw-r--r--lib/lvgl/examples/libs/qrcode/lv_example_qrcode.h38
-rw-r--r--lib/lvgl/examples/libs/qrcode/lv_example_qrcode_1.c32
-rwxr-xr-xlib/lvgl/examples/libs/qrcode/lv_example_qrcode_1.py15
5 files changed, 91 insertions, 0 deletions
diff --git a/lib/lvgl b/lib/lvgl
deleted file mode 160000
-Subproject 0732400e7b564dd0e7dc4a924619d8e19c5b23a
diff --git a/lib/lvgl/examples/libs/qrcode/index.rst b/lib/lvgl/examples/libs/qrcode/index.rst
new file mode 100644
index 00000000..8209afe8
--- /dev/null
+++ b/lib/lvgl/examples/libs/qrcode/index.rst
@@ -0,0 +1,6 @@
+Create a QR Code
+"""""""""""""""""""""""""""""""""""""""""""""""
+
+.. lv_example:: libs/qrcode/lv_example_qrcode_1
+ :language: c
+
diff --git a/lib/lvgl/examples/libs/qrcode/lv_example_qrcode.h b/lib/lvgl/examples/libs/qrcode/lv_example_qrcode.h
new file mode 100644
index 00000000..3d119032
--- /dev/null
+++ b/lib/lvgl/examples/libs/qrcode/lv_example_qrcode.h
@@ -0,0 +1,38 @@
+/**
+ * @file lv_example_qrcode.h
+ *
+ */
+
+#ifndef LV_EXAMPLE_QRCODE_H
+#define LV_EXAMPLE_QRCODE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*********************
+ * INCLUDES
+ *********************/
+
+/*********************
+ * DEFINES
+ *********************/
+
+/**********************
+ * TYPEDEFS
+ **********************/
+
+/**********************
+ * GLOBAL PROTOTYPES
+ **********************/
+void lv_example_qrcode_1(void);
+
+/**********************
+ * MACROS
+ **********************/
+
+#ifdef __cplusplus
+} /*extern "C"*/
+#endif
+
+#endif /*LV_EXAMPLE_QRCODE_H*/
diff --git a/lib/lvgl/examples/libs/qrcode/lv_example_qrcode_1.c b/lib/lvgl/examples/libs/qrcode/lv_example_qrcode_1.c
new file mode 100644
index 00000000..7e50fec8
--- /dev/null
+++ b/lib/lvgl/examples/libs/qrcode/lv_example_qrcode_1.c
@@ -0,0 +1,32 @@
+#include "../../lv_examples.h"
+#if LV_USE_QRCODE && LV_BUILD_EXAMPLES
+
+/**
+ * Create a QR Code
+ */
+void lv_example_qrcode_1(void)
+{
+ lv_color_t bg_color = lv_palette_lighten(LV_PALETTE_LIGHT_BLUE, 5);
+ lv_color_t fg_color = lv_palette_darken(LV_PALETTE_BLUE, 4);
+
+ lv_obj_t * qr = lv_qrcode_create(lv_scr_act(), 150, fg_color, bg_color);
+
+ /*Set data*/
+ const char * data = "https://lvgl.io";
+ lv_qrcode_update(qr, data, strlen(data));
+ lv_obj_center(qr);
+
+ /*Add a border with bg_color*/
+ lv_obj_set_style_border_color(qr, bg_color, 0);
+ lv_obj_set_style_border_width(qr, 5, 0);
+}
+
+#endif
+
+
+
+
+
+
+
+
diff --git a/lib/lvgl/examples/libs/qrcode/lv_example_qrcode_1.py b/lib/lvgl/examples/libs/qrcode/lv_example_qrcode_1.py
new file mode 100755
index 00000000..3c6e1ee4
--- /dev/null
+++ b/lib/lvgl/examples/libs/qrcode/lv_example_qrcode_1.py
@@ -0,0 +1,15 @@
+#!/opt/bin/lv_micropython -i
+import lvgl as lv
+import display_driver
+
+bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
+fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
+
+qr = lv.qrcode(lv.scr_act(), 150, fg_color, bg_color)
+# Set data
+data = "https://lvgl.io"
+qr.update(data,len(data))
+qr.center()
+# Add a border with bg_color
+qr.set_style_border_color(bg_color, 0)
+qr.set_style_border_width(5, 0)