valconomy/firmware/main/ui.c

32 lines
865 B
C

#include "lvgl.h"
static const lv_font_t *font_normal = &lv_font_montserrat_14;
static void b_cfg_cb(lv_event_t *e) {
lv_obj_t *box = lv_msgbox_create(NULL);
lv_msgbox_add_title(box, "Hello");
lv_msgbox_add_text(box, "test message");
lv_msgbox_add_close_button(box);
}
static void ui_home() {
lv_obj_t *b_cfg = lv_button_create(lv_screen_active());
lv_obj_align(b_cfg, LV_ALIGN_BOTTOM_RIGHT, -10, -10);
lv_obj_add_event_cb(b_cfg, b_cfg_cb, LV_EVENT_CLICKED, NULL);
lv_obj_t *l_cfg = lv_label_create(b_cfg);
lv_label_set_text(l_cfg, LV_SYMBOL_SETTINGS);
lv_obj_center(l_cfg);
}
void val_lvgl_ui(lv_display_t *disp) {
// init default theme
lv_theme_default_init(
disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
true, // dark theme
font_normal);
// lv_sysmon_hide_performance(disp);
ui_home();
}