diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-30 16:48:10 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-30 16:48:10 +1000 |
| commit | 320fdeb9d8355d3c361d5c6d60de8afc64501af9 (patch) | |
| tree | f0d5a2ab82199c78ad6768c6b18ba1239a0b7ee4 /src/ui/include/lvgl_task.hpp | |
| parent | 4247c9fe7d25c921fbfc73fc50e849c8780e7ad6 (diff) | |
| download | tangara-fw-320fdeb9d8355d3c361d5c6d60de8afc64501af9.tar.gz | |
Use a service locator instead of passing around subsets of drivers between FSMs
Diffstat (limited to 'src/ui/include/lvgl_task.hpp')
| -rw-r--r-- | src/ui/include/lvgl_task.hpp | 27 |
1 files changed, 25 insertions, 2 deletions
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<drivers::RelativeWheel> touch_wheel, - std::weak_ptr<drivers::Display> 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<TouchWheelEncoder> dev) -> void; + + private: + UiTask(); + + auto Main() -> void; + + std::shared_ptr<TouchWheelEncoder> input_device_; + std::shared_ptr<Screen> current_screen_; + + std::atomic<bool> quit_; + SemaphoreHandle_t frame_semaphore_; + TimerHandle_t frame_timer_; +}; } // namespace ui |
