summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Lin <[email protected]>2021-12-20 11:40:05 +0800
committerBernard Xiong <[email protected]>2021-12-30 01:39:17 +0800
commitde7dc291ab8ba0fbc8d7800a6a4bb09398067817 (patch)
tree2f52e11b16b551ae8c1ad53bd8aca29be524c56a
parentb33967ecf45600b444cf28db1ba56946a09a8c90 (diff)
Updated about suggestions.
-rw-r--r--bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c7
-rw-r--r--bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_demo.c5
-rw-r--r--bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_disp.c9
-rw-r--r--bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_indev.c13
-rw-r--r--bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_demo.c10
-rw-r--r--bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_disp.c6
-rw-r--r--bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_indev.c12
7 files changed, 30 insertions, 32 deletions
diff --git a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c
index 20a29634fb..5896a9b962 100644
--- a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c
+++ b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c
@@ -216,10 +216,15 @@ static void adc_touch_entry(void *parameter)
|| touch_point.event == RT_TOUCH_EVENT_UP
|| touch_point.event == RT_TOUCH_EVENT_MOVE)
{
-#if defined(PKG_USING_LITTLEVGL2RTT) || defined(PKG_USING_LVGL)
+
+#if defined(PKG_USING_LVGL)
+ extern void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
+ nu_touch_inputevent_cb(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
+#elif defined(PKG_USING_LITTLEVGL2RTT)
extern void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
littlevgl2rtt_send_input_event(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
#endif
+
#if defined(PKG_USING_NUEMWIN)
extern void nuemwin_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
nuemwin_send_input_event(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
diff --git a/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_demo.c b/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_demo.c
index 0f9ca49a4c..7ac1eab9e5 100644
--- a/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_demo.c
+++ b/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_demo.c
@@ -9,17 +9,16 @@
*/
#include <rtthread.h>
#include <lvgl.h>
-#include <lv_port_indev.h>
#define DBG_TAG "LVGL"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#ifndef LV_THREAD_STACK_SIZE
- #define LV_THREAD_STACK_SIZE 10240
+ #define LV_THREAD_STACK_SIZE 4096
#endif
#ifndef LV_THREAD_PRIO
- #define LV_THREAD_PRIO 20
+ #define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
#endif
static void lvgl_thread(void *parameter)
diff --git a/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_disp.c b/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_disp.c
index 34cda04180..cc72d47337 100644
--- a/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_disp.c
+++ b/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_disp.c
@@ -5,7 +5,7 @@
*
* Change Logs:
* Date Author Notes
- * 2021-12-17 Wayne The first version
+ * 2021-12-17 Wayne The first version
*/
#include <lvgl.h>
@@ -51,6 +51,7 @@ void lv_port_disp_init(void)
{
rt_err_t result;
void *buf_1 = RT_NULL;
+ void *buf_2 = RT_NULL;
lcd_device = rt_device_find("lcd");
if (lcd_device == 0)
@@ -72,10 +73,11 @@ void lv_port_disp_init(void)
info.bits_per_pixel == 24 || info.bits_per_pixel == 32);
buf_1 = (void *)info.framebuffer;
- rt_kprintf("lv buf_1=%08x\n", buf_1);
+ buf_2 = (void *)((uint32_t)buf_1 + info.height * info.width * info.bits_per_pixel / 8);
+ rt_kprintf("LVGL: Use two buffers - buf_1@%08x, buf_2@%08x\n", buf_1, buf_2);
/*Initialize `disp_buf` with the buffer(s).*/
- lv_disp_draw_buf_init(&disp_buf, buf_1, NULL, info.width * info.height);
+ lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, info.width * info.height);
result = rt_device_open(lcd_device, 0);
if (result != RT_EOK)
@@ -89,7 +91,6 @@ void lv_port_disp_init(void)
/*Set the resolution of the display*/
disp_drv.hor_res = info.width;
disp_drv.ver_res = info.height;
- //disp_drv.full_refresh = 1;
/*Set a display buffer*/
disp_drv.draw_buf = &disp_buf;
diff --git a/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_indev.c b/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_indev.c
index edcc4bc7f3..4451ad4f84 100644
--- a/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_indev.c
+++ b/bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_indev.c
@@ -6,6 +6,7 @@
* Change Logs:
* Date Author Notes
* 2021-10-18 Meco Man The first version
+ * 2021-12-17 Wayne Add input event
*/
#include <lvgl.h>
#include <stdbool.h>
@@ -23,7 +24,7 @@ static void input_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
data->state = last_state;
}
-void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
+void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
{
switch (state)
{
@@ -42,17 +43,15 @@ void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state
}
}
-
-lv_indev_t *button_indev;
-
void lv_port_indev_init(void)
{
static lv_indev_drv_t indev_drv;
- lv_indev_drv_init(&indev_drv); /*Basic initialization*/
+ /* Basic initialization */
+ lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = input_read;
- /*Register the driver in LVGL and save the created input device object*/
- button_indev = lv_indev_drv_register(&indev_drv);
+ /* Register the driver in LVGL and save the created input device object */
+ lv_indev_drv_register(&indev_drv);
}
diff --git a/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_demo.c b/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_demo.c
index 8ed63b84ac..7ac1eab9e5 100644
--- a/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_demo.c
+++ b/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_demo.c
@@ -9,17 +9,16 @@
*/
#include <rtthread.h>
#include <lvgl.h>
-#include <lv_port_indev.h>
#define DBG_TAG "LVGL"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#ifndef LV_THREAD_STACK_SIZE
- #define LV_THREAD_STACK_SIZE 10240
+ #define LV_THREAD_STACK_SIZE 4096
#endif
#ifndef LV_THREAD_PRIO
- #define LV_THREAD_PRIO 20
+ #define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
#endif
static void lvgl_thread(void *parameter)
@@ -34,7 +33,7 @@ static void lvgl_thread(void *parameter)
}
}
-static int lvgl_demo(void)
+static int lvgl_demo_init(void)
{
rt_thread_t tid;
@@ -47,5 +46,4 @@ static int lvgl_demo(void)
return 0;
}
-INIT_APP_EXPORT(lvgl_demo);
-//MSH_CMD_EXPORT(lvgl_demo, start lvgl music demo);
+INIT_APP_EXPORT(lvgl_demo_init);
diff --git a/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_disp.c b/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_disp.c
index b7c08f2675..a781817e36 100644
--- a/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_disp.c
+++ b/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_disp.c
@@ -94,10 +94,8 @@ void lv_port_disp_init(void)
info.bits_per_pixel == 24 || info.bits_per_pixel == 32);
buf_1 = (void *)info.framebuffer;
- rt_kprintf("lv buf_1=%08x\n", buf_1);
-
- buf_2 = (void *)((uint32_t)info.framebuffer + info.height * info.width * info.bits_per_pixel / 8);
- rt_kprintf("lv buf_2=%08x\n", buf_2);
+ buf_2 = (void *)((uint32_t)buf_1 + info.height * info.width * info.bits_per_pixel / 8);
+ rt_kprintf("LVGL: Use two buffers - buf_1@%08x, buf_2@%08x\n", buf_1, buf_2);
/*Initialize `disp_buf` with the buffer(s).*/
lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, info.width * info.height);
diff --git a/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_indev.c b/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_indev.c
index b2f2e91e10..4451ad4f84 100644
--- a/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_indev.c
+++ b/bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_indev.c
@@ -24,7 +24,7 @@ static void input_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
data->state = last_state;
}
-void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
+void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
{
switch (state)
{
@@ -43,17 +43,15 @@ void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state
}
}
-
-lv_indev_t *button_indev;
-
void lv_port_indev_init(void)
{
static lv_indev_drv_t indev_drv;
- lv_indev_drv_init(&indev_drv); /*Basic initialization*/
+ /* Basic initialization */
+ lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = input_read;
- /*Register the driver in LVGL and save the created input device object*/
- button_indev = lv_indev_drv_register(&indev_drv);
+ /* Register the driver in LVGL and save the created input device object */
+ lv_indev_drv_register(&indev_drv);
}