From 9763cc955c4f3b2c2af54b61c2c5ad77afef9603 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Mon, 26 Jun 2023 12:55:46 +1000 Subject: Improve encoder driver It actually works and clicks now! Still a bit rough though. Need to dive into lvgl internals to work out what it's doing with enc_diff --- src/drivers/include/relative_wheel.hpp | 5 +++-- src/drivers/include/touchwheel.hpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/drivers/include') diff --git a/src/drivers/include/relative_wheel.hpp b/src/drivers/include/relative_wheel.hpp index da4f9e3d..8d74d551 100644 --- a/src/drivers/include/relative_wheel.hpp +++ b/src/drivers/include/relative_wheel.hpp @@ -32,12 +32,13 @@ class RelativeWheel { auto Update() -> void; - auto is_pressed() -> bool; + auto is_clicking() -> bool; auto ticks() -> std::int_fast16_t; private: TouchWheel* touch_; - bool is_pressed_; + bool is_clicking_; + bool was_clicking_; bool is_first_read_; std::int_fast16_t ticks_; uint8_t last_angle_; diff --git a/src/drivers/include/touchwheel.hpp b/src/drivers/include/touchwheel.hpp index 1468fc65..5c3442d2 100644 --- a/src/drivers/include/touchwheel.hpp +++ b/src/drivers/include/touchwheel.hpp @@ -17,7 +17,8 @@ namespace drivers { struct TouchWheelData { - bool is_touched = false; + bool is_wheel_touched = false; + bool is_button_touched = false; uint8_t wheel_position = -1; }; -- cgit v1.2.3