35 lines
775 B
C
35 lines
775 B
C
|
|
#include <stdbool.h>
|
||
|
|
|
||
|
|
#include <lvgl.h>
|
||
|
|
|
||
|
|
#include "ui_main.h"
|
||
|
|
|
||
|
|
static bool ui_initialized;
|
||
|
|
|
||
|
|
void ui_main_init(void)
|
||
|
|
{
|
||
|
|
lv_obj_t *screen;
|
||
|
|
lv_obj_t *title;
|
||
|
|
lv_obj_t *subtitle;
|
||
|
|
|
||
|
|
if (ui_initialized) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
screen = lv_screen_active();
|
||
|
|
lv_obj_set_style_bg_color(screen, lv_color_hex(0x101418), 0);
|
||
|
|
lv_obj_set_style_text_color(screen, lv_color_hex(0xF5F7FA), 0);
|
||
|
|
|
||
|
|
title = lv_label_create(screen);
|
||
|
|
lv_label_set_text(title, "Hello World");
|
||
|
|
lv_obj_set_style_text_font(title, &lv_font_montserrat_14, 0);
|
||
|
|
lv_obj_align(title, LV_ALIGN_CENTER, 0, -10);
|
||
|
|
|
||
|
|
subtitle = lv_label_create(screen);
|
||
|
|
lv_label_set_text(subtitle, "WH Mini Keyboard");
|
||
|
|
lv_obj_set_style_text_opa(subtitle, LV_OPA_70, 0);
|
||
|
|
lv_obj_align(subtitle, LV_ALIGN_CENTER, 0, 14);
|
||
|
|
|
||
|
|
ui_initialized = true;
|
||
|
|
}
|