-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlvgl_demo_benchmark.c
More file actions
123 lines (98 loc) · 2.25 KB
/
lvgl_demo_benchmark.c
File metadata and controls
123 lines (98 loc) · 2.25 KB
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
115
116
117
118
119
120
121
122
123
/*
* Copyright 2020, 2024 NXP
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "FreeRTOS.h"
#include "task.h"
#include "fsl_debug_console.h"
#include "lvgl_support.h"
#include "board.h"
#include "app.h"
#include "lvgl.h"
#include "demos/lv_demos.h"
#include "lvgl_demo_utils.h"
/*******************************************************************************
* Definitions
******************************************************************************/
static volatile bool s_lvgl_initialized = false;
/*******************************************************************************
* Prototypes
******************************************************************************/
void print_cb(lv_log_level_t level, const char * buf);
#if LV_USE_LOG
void print_cb(lv_log_level_t level, const char * buf)
{
LV_UNUSED(level);
PRINTF("\r%s\n", buf);
}
#endif
static void AppTask(void *param)
{
lv_init();
lv_port_disp_init();
lv_port_indev_init();
#if LV_USE_LOG
lv_log_register_print_cb(print_cb);
#endif
LV_LOG("lvgl benchmark demo started\r\n");
s_lvgl_initialized = true;
lv_demo_benchmark();
for (;;)
{
vTaskDelay(lv_timer_handler());
}
}
/*******************************************************************************
* Code
******************************************************************************/
/*!
* @brief Main function
*/
int main(void)
{
BaseType_t stat;
/* Init board hardware. */
BOARD_InitHardware();
DEMO_InitUsTimer();
stat = xTaskCreate(AppTask, "lvgl", 0x800, NULL, tskIDLE_PRIORITY + 2, NULL);
if (pdPASS != stat)
{
PRINTF("Failed to create lvgl task");
while (1)
;
}
vTaskStartScheduler();
for (;;)
{
} /* should never get here */
}
/*!
* @brief Malloc failed hook.
*/
void vApplicationMallocFailedHook(void)
{
PRINTF("Malloc failed. Increase the heap size.");
for (;;)
;
}
/*!
* @brief FreeRTOS tick hook.
*/
void vApplicationTickHook(void)
{
if (s_lvgl_initialized)
{
lv_tick_inc(1);
}
}
/*!
* @brief Stack overflow hook.
*/
void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName)
{
(void)pcTaskName;
(void)xTask;
for (;;)
;
}