#ifndef UI_CMD_H #define UI_CMD_H #include #include "lvgl.h" #include "freertos/FreeRTOS.h" #include "freertos/queue.h" #ifdef __cplusplus extern "C" { #endif typedef enum { UI_CMD_NONE = 0, UI_CMD_SET_LABEL_TEXT, UI_CMD_SET_IMAGE_SRC, UI_CMD_WEATHER_FORECAST_TIME_REFRESH, } ui_cmd_type_t; typedef struct { ui_cmd_type_t type; lv_obj_t *obj; union { char text[128]; const void *img_src; } u; } ui_cmd_t; void ui_cmd_init(void); BaseType_t ui_cmd_set_label_text(lv_obj_t *obj, const char *text); BaseType_t ui_cmd_set_image_src(lv_obj_t *obj, const void *src); BaseType_t ui_cmd_weather_forecast_time_refresh(void); /** * Drain and execute all pending UI commands. * Must be called from the LVGL task context while it is safe to call LVGL. */ void ui_cmd_drain(void); #ifdef __cplusplus } #endif #endif // UI_CMD_H