/* * Copyright 2023 jacqueline * * SPDX-License-Identifier: GPL-3.0-only */ #include "ui_fsm.hpp" #include "display.hpp" #include "lvgl_task.hpp" #include "relative_wheel.hpp" #include "screen.hpp" #include "screen_menu.hpp" #include "screen_splash.hpp" #include "system_events.hpp" #include "touchwheel.hpp" namespace ui { drivers::GpioExpander* UiState::sGpioExpander; std::weak_ptr UiState::sTouchWheel; std::weak_ptr UiState::sDisplay; std::shared_ptr UiState::sCurrentScreen; auto UiState::Init(drivers::GpioExpander* gpio_expander, const std::weak_ptr& touchwheel, const std::weak_ptr& display) -> void { assert(!touchwheel.expired()); assert(!display.expired()); sGpioExpander = gpio_expander; sTouchWheel = touchwheel; sDisplay = display; sCurrentScreen.reset(new screens::Splash()); StartLvgl(sTouchWheel, sDisplay); } namespace states { void PreBoot::react(const system_fsm::DisplayReady& ev) { transit(); } void Splash::entry() {} void Splash::react(const system_fsm::BootComplete& ev) { transit(); } void Interactive::entry() { sCurrentScreen.reset(new screens::Menu()); } } // namespace states } // namespace ui FSM_INITIAL_STATE(ui::UiState, ui::states::PreBoot)