first commit
This commit is contained in:
32
components/ui/ui.c
Normal file
32
components/ui/ui.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "ui.h"
|
||||
#include "screens.h"
|
||||
#include "images.h"
|
||||
#include "actions.h"
|
||||
#include "vars.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static int16_t currentScreen = -1;
|
||||
|
||||
static lv_obj_t *getLvglObjectFromIndex(int32_t index) {
|
||||
if (index == -1) {
|
||||
return 0;
|
||||
}
|
||||
return ((lv_obj_t **)&objects)[index];
|
||||
}
|
||||
|
||||
void loadScreen(enum ScreensEnum screenId) {
|
||||
currentScreen = screenId - 1;
|
||||
lv_obj_t *screen = getLvglObjectFromIndex(currentScreen);
|
||||
lv_scr_load_anim(screen, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
|
||||
}
|
||||
|
||||
void ui_init() {
|
||||
create_screens();
|
||||
loadScreen(SCREEN_ID_TEMPERATURE);
|
||||
|
||||
}
|
||||
|
||||
void ui_tick() {
|
||||
tick_screen(currentScreen);
|
||||
}
|
||||
Reference in New Issue
Block a user