From 320fdeb9d8355d3c361d5c6d60de8afc64501af9 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 30 Aug 2023 16:48:10 +1000 Subject: Use a service locator instead of passing around subsets of drivers between FSMs --- src/ui/include/lvgl_task.hpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/ui/include/lvgl_task.hpp') diff --git a/src/ui/include/lvgl_task.hpp b/src/ui/include/lvgl_task.hpp index 7e60c4b4..6b7e446e 100644 --- a/src/ui/include/lvgl_task.hpp +++ b/src/ui/include/lvgl_task.hpp @@ -12,15 +12,38 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "freertos/timers.h" #include "display.hpp" #include "relative_wheel.hpp" +#include "screen.hpp" #include "themes.hpp" #include "touchwheel.hpp" +#include "wheel_encoder.hpp" namespace ui { -auto StartLvgl(std::weak_ptr touch_wheel, - std::weak_ptr display) -> void; +class UiTask { + public: + static auto Start() -> UiTask*; + + ~UiTask(); + + // FIXME: Once we have more input devices, this function should accept a more + // generic interface. + auto SetInputDevice(std::shared_ptr dev) -> void; + + private: + UiTask(); + + auto Main() -> void; + + std::shared_ptr input_device_; + std::shared_ptr current_screen_; + + std::atomic quit_; + SemaphoreHandle_t frame_semaphore_; + TimerHandle_t frame_timer_; +}; } // namespace ui -- cgit v1.2.3