lvgl demo

This commit is contained in:
2026-07-19 16:07:11 -05:00
parent 76f1c90afe
commit 98b5b96171
3 changed files with 51 additions and 1 deletions
+41
View File
@@ -16,6 +16,8 @@
#include "blk_box_drivers/char_lcd.hpp"
#include "blk_box_drivers/ssegs.hpp"
#include "blk_box_drivers/helpers.hpp"
#include "blk_box_drivers/tft.hpp"
#include <lvgl.h>
#include "esp_log.h"
@@ -126,6 +128,45 @@ extern "C" void app_main(void) {
LCDController::set_backlight(true);
lcd_do_splash();
lvgl_lock(portMAX_DELAY);
// Get the default screen
lv_obj_t * scr = lv_scr_act();
// Create a title label
lv_obj_t * title = lv_label_create(scr);
lv_label_set_text(title, "Display Test");
lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 10);
lv_obj_set_style_text_font(title, &lv_font_montserrat_24, 0);
// Create a status label
lv_obj_t * status = lv_label_create(scr);
lv_label_set_text(status, "Testing display...");
lv_obj_align(status, LV_ALIGN_CENTER, 0, -20);
// Create a progress bar
lv_obj_t * bar = lv_bar_create(scr);
lv_obj_set_size(bar, 200, 20);
lv_obj_align(bar, LV_ALIGN_CENTER, 0, 30);
lv_bar_set_value(bar, 50, LV_ANIM_OFF);
// Create a button with callback
lv_obj_t * btn = lv_btn_create(scr);
lv_obj_set_size(btn, 100, 40);
lv_obj_align(btn, LV_ALIGN_BOTTOM_MID, 0, -20);
lv_obj_t * btn_label = lv_label_create(btn);
lv_label_set_text(btn_label, "Test");
lv_obj_center(btn_label);
// Create a color test area
lv_obj_t * color_test = lv_obj_create(scr);
lv_obj_set_size(color_test, 80, 60);
lv_obj_align(color_test, LV_ALIGN_BOTTOM_LEFT, 10, -20);
lv_obj_set_style_bg_color(color_test, lv_color_hex(0xFF0000), 0); // Red
lvgl_unlock();
LCDController::set_resting_cursor_mode(CursorMode::Show);
LCDController::set_resting_cursor_pos(0, 0);