summaryrefslogtreecommitdiff
path: root/lib/lvgl/examples/others/monkey
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/others/monkey
parent6fd588e970470b15936187980829916d0dbe77bb (diff)
downloadtangara-fw-dd27c3530432ea0b09f01e604bf577f31d8ef841.tar.gz
convert lvgl from submodule to a plain old directory
Diffstat (limited to 'lib/lvgl/examples/others/monkey')
m---------lib/lvgl0
-rw-r--r--lib/lvgl/examples/others/monkey/index.rst18
-rw-r--r--lib/lvgl/examples/others/monkey/lv_example_monkey.h40
-rw-r--r--lib/lvgl/examples/others/monkey/lv_example_monkey_1.c18
-rw-r--r--lib/lvgl/examples/others/monkey/lv_example_monkey_2.c25
-rw-r--r--lib/lvgl/examples/others/monkey/lv_example_monkey_3.c33
6 files changed, 134 insertions, 0 deletions
diff --git a/lib/lvgl b/lib/lvgl
deleted file mode 160000
-Subproject 0732400e7b564dd0e7dc4a924619d8e19c5b23a
diff --git a/lib/lvgl/examples/others/monkey/index.rst b/lib/lvgl/examples/others/monkey/index.rst
new file mode 100644
index 00000000..e6fdfb7e
--- /dev/null
+++ b/lib/lvgl/examples/others/monkey/index.rst
@@ -0,0 +1,18 @@
+
+Touchpad monkey example
+"""""""""""""""""""
+
+.. lv_example:: others/monkey/lv_example_monkey_1
+ :language: c
+
+Encoder monkey example
+"""""""""""""""""""
+
+.. lv_example:: others/monkey/lv_example_monkey_2
+ :language: c
+
+Button monkey example
+"""""""""""""""""""
+
+.. lv_example:: others/monkey/lv_example_monkey_3
+ :language: c
diff --git a/lib/lvgl/examples/others/monkey/lv_example_monkey.h b/lib/lvgl/examples/others/monkey/lv_example_monkey.h
new file mode 100644
index 00000000..8475f2ed
--- /dev/null
+++ b/lib/lvgl/examples/others/monkey/lv_example_monkey.h
@@ -0,0 +1,40 @@
+/**
+ * @file lv_example_monkey.h
+ *
+ */
+
+#ifndef LV_EXAMPLE_MONKEY_H
+#define LV_EXAMPLE_MONKEY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*********************
+ * INCLUDES
+ *********************/
+
+/*********************
+ * DEFINES
+ *********************/
+
+/**********************
+ * TYPEDEFS
+ **********************/
+
+/**********************
+ * GLOBAL PROTOTYPES
+ **********************/
+void lv_example_monkey_1(void);
+void lv_example_monkey_2(void);
+void lv_example_monkey_3(void);
+
+/**********************
+ * MACROS
+ **********************/
+
+#ifdef __cplusplus
+} /*extern "C"*/
+#endif
+
+#endif /*LV_EXAMPLE_MONKEY_H*/
diff --git a/lib/lvgl/examples/others/monkey/lv_example_monkey_1.c b/lib/lvgl/examples/others/monkey/lv_example_monkey_1.c
new file mode 100644
index 00000000..a38c6b4f
--- /dev/null
+++ b/lib/lvgl/examples/others/monkey/lv_example_monkey_1.c
@@ -0,0 +1,18 @@
+#include "../../lv_examples.h"
+#if LV_USE_MONKEY && LV_BUILD_EXAMPLES
+
+void lv_example_monkey_1(void)
+{
+ /*Create pointer monkey test*/
+ lv_monkey_config_t config;
+ lv_monkey_config_init(&config);
+ config.type = LV_INDEV_TYPE_POINTER;
+ config.period_range.min = 10;
+ config.period_range.max = 100;
+ lv_monkey_t * monkey = lv_monkey_create(&config);
+
+ /*Start monkey test*/
+ lv_monkey_set_enable(monkey, true);
+}
+
+#endif
diff --git a/lib/lvgl/examples/others/monkey/lv_example_monkey_2.c b/lib/lvgl/examples/others/monkey/lv_example_monkey_2.c
new file mode 100644
index 00000000..c8641141
--- /dev/null
+++ b/lib/lvgl/examples/others/monkey/lv_example_monkey_2.c
@@ -0,0 +1,25 @@
+#include "../../lv_examples.h"
+#if LV_USE_MONKEY && LV_BUILD_EXAMPLES
+
+void lv_example_monkey_2(void)
+{
+ /*Create encoder monkey test*/
+ lv_monkey_config_t config;
+ lv_monkey_config_init(&config);
+ config.type = LV_INDEV_TYPE_ENCODER;
+ config.period_range.min = 50;
+ config.period_range.max = 500;
+ config.input_range.min = -5;
+ config.input_range.max = 5;
+ lv_monkey_t * monkey = lv_monkey_create(&config);
+
+ /*Set the default group*/
+ lv_group_t * group = lv_group_create();
+ lv_indev_set_group(lv_monkey_get_indev(monkey), group);
+ lv_group_set_default(group);
+
+ /*Start monkey test*/
+ lv_monkey_set_enable(monkey, true);
+}
+
+#endif
diff --git a/lib/lvgl/examples/others/monkey/lv_example_monkey_3.c b/lib/lvgl/examples/others/monkey/lv_example_monkey_3.c
new file mode 100644
index 00000000..c5298cc8
--- /dev/null
+++ b/lib/lvgl/examples/others/monkey/lv_example_monkey_3.c
@@ -0,0 +1,33 @@
+#include "../../lv_examples.h"
+#if LV_USE_MONKEY && LV_BUILD_EXAMPLES
+
+void lv_example_monkey_3(void)
+{
+ static lv_point_t btn_points[3];
+ lv_coord_t hor_res = LV_HOR_RES;
+
+ /*Create button monkey test*/
+ lv_monkey_config_t config;
+ lv_monkey_config_init(&config);
+ config.type = LV_INDEV_TYPE_BUTTON;
+ config.period_range.min = 50;
+ config.period_range.max = 500;
+ config.input_range.min = 0;
+ config.input_range.max = sizeof(btn_points) / sizeof(lv_point_t) - 1;
+ lv_monkey_t * monkey = lv_monkey_create(&config);
+
+ /*Set the coordinates bound to the button*/
+ btn_points[0].x = hor_res / 4;
+ btn_points[0].y = 10;
+ btn_points[1].x = hor_res / 2;
+ btn_points[1].y = 10;
+ btn_points[2].x = hor_res * 3 / 4;
+ btn_points[2].y = 10;
+
+ lv_indev_set_button_points(lv_monkey_get_indev(monkey), btn_points);
+
+ /*Start monkey test*/
+ lv_monkey_set_enable(monkey, true);
+}
+
+#endif