#include #include #include "ui/ui_settings_controller.h" #include "ui_settings_pages.h" static uint8_t root_get_count(struct ui_settings_page *page) { ARG_UNUSED(page); return 2U; } static void root_get_item(struct ui_settings_page *page, uint8_t index, struct ui_settings_item *item) { ARG_UNUSED(page); if (index == 0U) { item->icon = LV_SYMBOL_BLUETOOTH; item->title = "Bluetooth"; item->value = ui_settings_ble_current_label(); return; } item->icon = LV_SYMBOL_TINT; item->title = "Theme"; item->value = ui_settings_theme_current_name(); } static void root_on_enter(struct ui_settings_page *page) { page->selected = 0U; } static void root_on_select(struct ui_settings_page *page, uint8_t index) { ui_settings_controller_switch_to( (index == 0U) ? &ui_settings_ble_page : &ui_settings_theme_page, &page->base); } static void root_on_back(struct ui_settings_page *page) { ARG_UNUSED(page); ui_settings_controller_close(); } static const struct ui_settings_page_ops root_ops = { .get_count = root_get_count, .get_item = root_get_item, .on_enter = root_on_enter, .on_select = root_on_select, .on_back = root_on_back, }; struct ui_settings_page ui_settings_root_page = { .base = { .ops = &root_ops.base, }, .ops = &root_ops, .title = LV_SYMBOL_SETTINGS " Settings", .hint = "Rotate select Tap OK Hold exit", };