-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.c
114 lines (92 loc) · 4.04 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
102
103
104
105
106
107
108
109
110
111
112
113
114
/****************************************************************************
* Copyright 2021 Gorgon Meducer (Email:[email protected]) *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
****************************************************************************/
/*============================ INCLUDES ======================================*/
#include "app_cfg.h"
#include "platform.h"
#include "cmsis_compiler.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include "lvgl.h"
#include "demos/lv_demos.h"
#include "ui.h"
#include "lv_port_disp_template.h"
#include "lv_port_indev_template.h"
#if defined(RTE_Script_PikaScript)
# include "pikascript.h"
#endif
#if defined(__clang__)
# pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
#endif
/*============================ MACROS ========================================*/
/*============================ MACROFIED FUNCTIONS ===========================*/
/*============================ TYPES =========================================*/
/*============================ GLOBAL VARIABLES ==============================*/
/*============================ LOCAL VARIABLES ===============================*/
/*============================ PROTOTYPES ====================================*/
/*============================ IMPLEMENTATION ================================*/
static void test(void)
{
lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button to the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 100, 50); /*Set its size*/
//lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/
lv_label_set_text(label, "Button"); /*Set the labels text*/
lv_obj_center(label); /*Align the label to the center*/
}
#if LV_USE_DEMO_BENCHMARK && LVGL_VERSION_MAJOR == 8
static void on_benchmark_finished(void)
{
disp_enable_update();
lv_demo_benchmark_close();
}
#endif
int main(void)
{
printf("Hello LVGL!!\r\n");
__cycleof__("Draw strings on LCD") {
__LL_LCD_PRINT_BANNER("Hello LVGL!!");
}
lv_init();
lv_port_disp_init();
lv_port_indev_init();
#if LV_USE_DEMO_BENCHMARK
__LL_LCD_PRINT(24, 0, "Running LVGL Benchmark...");
__LL_LCD_PRINT(25, 0, "Please stand by...");
__LL_LCD_PRINT(28, 0, "NOTE: You will NOT see anything until the end.");
//disp_disable_update();
lv_demo_benchmark_set_finished_cb(on_benchmark_finished);
lv_demo_benchmark_set_max_speed(true);
lv_demo_benchmark();
//lv_demo_benchmark_run_scene(31);
#elif LV_USE_DEMO_WIDGETS
lv_demo_widgets();
#elif LV_USE_DEMO_MUSIC
lv_demo_music();
#elif defined (RTE_Script_PikaScript)
pikaScriptInit();
#else
//test();
ui_init();
#endif
while(1) {
lv_timer_handler();
}
}