Skip to content

Commit de7dc29

Browse files
ttnwosayBernardXiong
authored andcommitted
Updated about suggestions.
1 parent b33967e commit de7dc29

File tree

7 files changed

+30
-32
lines changed

7 files changed

+30
-32
lines changed

bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,15 @@ static void adc_touch_entry(void *parameter)
216216
|| touch_point.event == RT_TOUCH_EVENT_UP
217217
|| touch_point.event == RT_TOUCH_EVENT_MOVE)
218218
{
219-
#if defined(PKG_USING_LITTLEVGL2RTT) || defined(PKG_USING_LVGL)
219+
220+
#if defined(PKG_USING_LVGL)
221+
extern void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
222+
nu_touch_inputevent_cb(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
223+
#elif defined(PKG_USING_LITTLEVGL2RTT)
220224
extern void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
221225
littlevgl2rtt_send_input_event(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
222226
#endif
227+
223228
#if defined(PKG_USING_NUEMWIN)
224229
extern void nuemwin_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
225230
nuemwin_send_input_event(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);

bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_demo.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@
99
*/
1010
#include <rtthread.h>
1111
#include <lvgl.h>
12-
#include <lv_port_indev.h>
1312
#define DBG_TAG "LVGL"
1413
#define DBG_LVL DBG_INFO
1514
#include <rtdbg.h>
1615

1716
#ifndef LV_THREAD_STACK_SIZE
18-
#define LV_THREAD_STACK_SIZE 10240
17+
#define LV_THREAD_STACK_SIZE 4096
1918
#endif
2019

2120
#ifndef LV_THREAD_PRIO
22-
#define LV_THREAD_PRIO 20
21+
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
2322
#endif
2423

2524
static void lvgl_thread(void *parameter)

bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_disp.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Change Logs:
77
* Date Author Notes
8-
* 2021-12-17 Wayne The first version
8+
* 2021-12-17 Wayne The first version
99
*/
1010
#include <lvgl.h>
1111

@@ -51,6 +51,7 @@ void lv_port_disp_init(void)
5151
{
5252
rt_err_t result;
5353
void *buf_1 = RT_NULL;
54+
void *buf_2 = RT_NULL;
5455

5556
lcd_device = rt_device_find("lcd");
5657
if (lcd_device == 0)
@@ -72,10 +73,11 @@ void lv_port_disp_init(void)
7273
info.bits_per_pixel == 24 || info.bits_per_pixel == 32);
7374

7475
buf_1 = (void *)info.framebuffer;
75-
rt_kprintf("lv buf_1=%08x\n", buf_1);
76+
buf_2 = (void *)((uint32_t)buf_1 + info.height * info.width * info.bits_per_pixel / 8);
77+
rt_kprintf("LVGL: Use two buffers - buf_1@%08x, buf_2@%08x\n", buf_1, buf_2);
7678

7779
/*Initialize `disp_buf` with the buffer(s).*/
78-
lv_disp_draw_buf_init(&disp_buf, buf_1, NULL, info.width * info.height);
80+
lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, info.width * info.height);
7981

8082
result = rt_device_open(lcd_device, 0);
8183
if (result != RT_EOK)
@@ -89,7 +91,6 @@ void lv_port_disp_init(void)
8991
/*Set the resolution of the display*/
9092
disp_drv.hor_res = info.width;
9193
disp_drv.ver_res = info.height;
92-
//disp_drv.full_refresh = 1;
9394

9495
/*Set a display buffer*/
9596
disp_drv.draw_buf = &disp_buf;

bsp/nuvoton/nk-980iot/applications/lvgl/port/lv_port_indev.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2021-10-18 Meco Man The first version
9+
* 2021-12-17 Wayne Add input event
910
*/
1011
#include <lvgl.h>
1112
#include <stdbool.h>
@@ -23,7 +24,7 @@ static void input_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
2324
data->state = last_state;
2425
}
2526

26-
void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
27+
void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
2728
{
2829
switch (state)
2930
{
@@ -42,17 +43,15 @@ void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state
4243
}
4344
}
4445

45-
46-
lv_indev_t *button_indev;
47-
4846
void lv_port_indev_init(void)
4947
{
5048
static lv_indev_drv_t indev_drv;
5149

52-
lv_indev_drv_init(&indev_drv); /*Basic initialization*/
50+
/* Basic initialization */
51+
lv_indev_drv_init(&indev_drv);
5352
indev_drv.type = LV_INDEV_TYPE_POINTER;
5453
indev_drv.read_cb = input_read;
5554

56-
/*Register the driver in LVGL and save the created input device object*/
57-
button_indev = lv_indev_drv_register(&indev_drv);
55+
/* Register the driver in LVGL and save the created input device object */
56+
lv_indev_drv_register(&indev_drv);
5857
}

bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_demo.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@
99
*/
1010
#include <rtthread.h>
1111
#include <lvgl.h>
12-
#include <lv_port_indev.h>
1312
#define DBG_TAG "LVGL"
1413
#define DBG_LVL DBG_INFO
1514
#include <rtdbg.h>
1615

1716
#ifndef LV_THREAD_STACK_SIZE
18-
#define LV_THREAD_STACK_SIZE 10240
17+
#define LV_THREAD_STACK_SIZE 4096
1918
#endif
2019

2120
#ifndef LV_THREAD_PRIO
22-
#define LV_THREAD_PRIO 20
21+
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
2322
#endif
2423

2524
static void lvgl_thread(void *parameter)
@@ -34,7 +33,7 @@ static void lvgl_thread(void *parameter)
3433
}
3534
}
3635

37-
static int lvgl_demo(void)
36+
static int lvgl_demo_init(void)
3837
{
3938
rt_thread_t tid;
4039

@@ -47,5 +46,4 @@ static int lvgl_demo(void)
4746

4847
return 0;
4948
}
50-
INIT_APP_EXPORT(lvgl_demo);
51-
//MSH_CMD_EXPORT(lvgl_demo, start lvgl music demo);
49+
INIT_APP_EXPORT(lvgl_demo_init);

bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_disp.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,8 @@ void lv_port_disp_init(void)
9494
info.bits_per_pixel == 24 || info.bits_per_pixel == 32);
9595

9696
buf_1 = (void *)info.framebuffer;
97-
rt_kprintf("lv buf_1=%08x\n", buf_1);
98-
99-
buf_2 = (void *)((uint32_t)info.framebuffer + info.height * info.width * info.bits_per_pixel / 8);
100-
rt_kprintf("lv buf_2=%08x\n", buf_2);
97+
buf_2 = (void *)((uint32_t)buf_1 + info.height * info.width * info.bits_per_pixel / 8);
98+
rt_kprintf("LVGL: Use two buffers - buf_1@%08x, buf_2@%08x\n", buf_1, buf_2);
10199

102100
/*Initialize `disp_buf` with the buffer(s).*/
103101
lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, info.width * info.height);

bsp/nuvoton/nk-n9h30/applications/lvgl/port/lv_port_indev.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static void input_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
2424
data->state = last_state;
2525
}
2626

27-
void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
27+
void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
2828
{
2929
switch (state)
3030
{
@@ -43,17 +43,15 @@ void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state
4343
}
4444
}
4545

46-
47-
lv_indev_t *button_indev;
48-
4946
void lv_port_indev_init(void)
5047
{
5148
static lv_indev_drv_t indev_drv;
5249

53-
lv_indev_drv_init(&indev_drv); /*Basic initialization*/
50+
/* Basic initialization */
51+
lv_indev_drv_init(&indev_drv);
5452
indev_drv.type = LV_INDEV_TYPE_POINTER;
5553
indev_drv.read_cb = input_read;
5654

57-
/*Register the driver in LVGL and save the created input device object*/
58-
button_indev = lv_indev_drv_register(&indev_drv);
55+
/* Register the driver in LVGL and save the created input device object */
56+
lv_indev_drv_register(&indev_drv);
5957
}

0 commit comments

Comments
 (0)