summaryrefslogtreecommitdiff
path: root/src/ui/lvgl_task.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-10-03 10:37:29 +1100
committerjacqueline <me@jacqueline.id.au>2023-10-03 10:37:29 +1100
commit7d5536e2abca61f503ed68521603bd30700a7e5e (patch)
treefc8b191a5d248a86de08a00d814359f335423e95 /src/ui/lvgl_task.cpp
parentf2bad894cdac88b94a358cebdb062f426b191d1b (diff)
downloadtangara-fw-7d5536e2abca61f503ed68521603bd30700a7e5e.tar.gz
Generalise the lvgl input driver in preparation for more input methods
Diffstat (limited to 'src/ui/lvgl_task.cpp')
-rw-r--r--src/ui/lvgl_task.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/ui/lvgl_task.cpp b/src/ui/lvgl_task.cpp
index 74f68cf5..ff85a055 100644
--- a/src/ui/lvgl_task.cpp
+++ b/src/ui/lvgl_task.cpp
@@ -40,7 +40,6 @@
#include "tasks.hpp"
#include "touchwheel.hpp"
#include "ui_fsm.hpp"
-#include "wheel_encoder.hpp"
#include "widgets/lv_label.h"
#include "display.hpp"
@@ -67,15 +66,15 @@ auto UiTask::Main() -> void {
std::shared_ptr<Screen> screen = UiState::current_screen();
if (screen != current_screen_ && screen != nullptr) {
lv_scr_load(screen->root());
- if (input_device_) {
- lv_indev_set_group(input_device_->registration(), screen->group());
+ if (input_) {
+ lv_indev_set_group(input_->registration(), screen->group());
}
current_screen_ = screen;
}
- if (input_device_ && current_screen_->group() != current_group) {
+ if (input_ && current_screen_->group() != current_group) {
current_group = current_screen_->group();
- lv_indev_set_group(input_device_->registration(), current_group);
+ lv_indev_set_group(input_->registration(), current_group);
}
if (current_screen_) {
@@ -87,11 +86,10 @@ auto UiTask::Main() -> void {
}
}
-auto UiTask::SetInputDevice(std::shared_ptr<TouchWheelEncoder> dev) -> void {
- input_device_ = std::move(dev);
- if (current_screen_ && input_device_) {
- lv_indev_set_group(input_device_->registration(), current_screen_->group());
- }
+auto UiTask::input(std::shared_ptr<EncoderInput> input) -> void {
+ assert(current_screen_);
+ input_ = input;
+ lv_indev_set_group(input_->registration(), current_screen_->group());
}
auto UiTask::Start() -> UiTask* {