-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
101 lines (81 loc) · 1.91 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include "lvgl/lvgl.h"
#include "port/lv_port_disp.h"
#include "port/lv_port_indev.h"
#include "port/lv_port_tick.h"
#include "lvgl/demos/lv_demos.h"
#include "lvgl/examples/lv_examples.h"
/*******************
* DEFINE
********************/
static void app_init(void);
static void app_exit(void);
static lv_group_t *g;
static void intr_sig_handler(int signal)
{
app_exit();
}
static void app_init(void)
{
#ifdef CROSS_COMPILE
system("echo 0 > /sys/class/graphics/fbcon/cursor_blink");
#endif
signal(SIGINT, intr_sig_handler);
}
static void app_exit(void)
{
printf("app exiting ...");
#ifdef CROSS_COMPILE
system("echo 1 > /sys/class/graphics/fbcon/cursor_blink");
#endif
printf(" done\n");
exit(EXIT_SUCCESS);
}
static void hal_init(void)
{
lv_init();
lv_port_disp_init();
lv_port_indev_init();
lv_port_tick_init();
g = lv_group_get_default();
if (g == NULL) {
g = lv_group_create();
lv_group_set_default(g);
}
lv_indev_t *cur_drv = NULL;
for (;;) {
cur_drv = lv_indev_get_next(cur_drv);
if (!cur_drv) {
break;
}
if (cur_drv->driver->type == LV_INDEV_TYPE_KEYPAD) {
lv_indev_set_group(cur_drv, g);
}
if (cur_drv->driver->type == LV_INDEV_TYPE_ENCODER) {
lv_indev_set_group(cur_drv, g);
}
}
}
int main(int argc, char **argv)
{
app_init();
hal_init();
// ifconfig usb0 192.168.200.100
// ping 192.168.200.101
// mount -t nfs -o nolock,vers=3 192.168.200.101:/home/developer/nfs_share /mnt
// cd /mnt && ./demo
/* App here */
printf("Launching App ...\n");
lv_demo_widgets();
// lv_demo_benchmark();
// lv_demo_stress();
// lv_demo_music();
for(;;) {
lv_timer_handler();
usleep(5000);
}
return 0;
}