Add thread to handle lvgl events

This commit is contained in:
Hendrik Sauer 2021-06-14 15:44:07 +02:00 committed by Patrick Rathje
parent 6b58493305
commit 62f31a3282
3 changed files with 17 additions and 1 deletions

View File

@ -27,6 +27,15 @@ lv_style_t yellow_button_style;
lv_style_t red_button_style;
#endif
void display_thread(void* arg1, void* arg2, void* arg3) {
#ifdef DISPLAY
while (1) {
lv_task_handler();
k_msleep(10);
}
#endif
}
int get_battery_percentage() {
return 74;
}

View File

@ -5,6 +5,8 @@ int init_display();
int update_display();
void display_thread(void*, void*, void*);
int display_set_message(char* msg);
int display_set_time(int time);

View File

@ -19,6 +19,8 @@
#include "io.h"
#include "display.h"
K_THREAD_STACK_DEFINE(display_stack_area, 500);
void main(void) {
int err = 0;
printk("Starting Covid Contact Tracer\n");
@ -73,7 +75,10 @@ void main(void) {
if (err) {
printk("init display failed (err %d)\n", err);
}
struct k_thread display_thread_data;
k_tid_t display_tid = k_thread_create(&display_thread_data, display_stack_area, K_THREAD_STACK_SIZEOF(display_stack_area), display_thread, NULL, NULL, NULL, 0, 0, K_NO_WAIT);
do{
do_covid();
do_gatt();