diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2024-04-11 07:02:53 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2024-04-11 07:02:53 +0000 |
| commit | dd1ea595a7753706d4fa5f19b66f3dc1cbd56a02 (patch) | |
| tree | 60bfa4569af0f9506ccffe85f19e89bbe2a83332 /src/drivers/include | |
| parent | f580928cbab797e4e8a3eae5ae1c0b18b8066066 (diff) | |
| parent | 33919e9e3f419e13318fa6b8217d8c8dcd86c1eb (diff) | |
| download | tangara-fw-dd1ea595a7753706d4fa5f19b66f3dc1cbd56a02.tar.gz | |
Merge pull request 'jqln/input-devices' (#62) from jqln/input-devices into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/62
Reviewed-by: ailurux <ailurux@noreply.codeberg.org>
Diffstat (limited to 'src/drivers/include')
| -rw-r--r-- | src/drivers/include/relative_wheel.hpp | 52 | ||||
| -rw-r--r-- | src/drivers/include/touchwheel.hpp | 4 |
2 files changed, 4 insertions, 52 deletions
diff --git a/src/drivers/include/relative_wheel.hpp b/src/drivers/include/relative_wheel.hpp deleted file mode 100644 index e1106143..00000000 --- a/src/drivers/include/relative_wheel.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2023 jacqueline <me@jacqueline.id.au> - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#pragma once - -#include <stdint.h> -#include <cstdint> -#include <functional> - -#include "esp_err.h" -#include "result.hpp" - -#include "gpios.hpp" -#include "touchwheel.hpp" - -namespace drivers { - -class RelativeWheel { - public: - explicit RelativeWheel(TouchWheel& touch); - - auto Update() -> void; - auto SetEnabled(bool) -> void; - - auto SetSensitivity(uint8_t) -> void; - auto GetSensitivity() -> uint8_t; - - auto is_clicking() const -> bool; - auto ticks() const -> std::int_fast16_t; - - // Not copyable or movable. - RelativeWheel(const RelativeWheel&) = delete; - RelativeWheel& operator=(const RelativeWheel&) = delete; - - private: - TouchWheel& touch_; - - bool is_enabled_; - uint8_t sensitivity_; - uint8_t threshold_; - - bool is_clicking_; - bool was_clicking_; - bool is_first_read_; - std::int_fast16_t ticks_; - uint8_t last_angle_; -}; - -} // namespace drivers diff --git a/src/drivers/include/touchwheel.hpp b/src/drivers/include/touchwheel.hpp index 9d002156..18ace2b4 100644 --- a/src/drivers/include/touchwheel.hpp +++ b/src/drivers/include/touchwheel.hpp @@ -24,6 +24,10 @@ struct TouchWheelData { class TouchWheel { public: + static auto isAngleWithin(int16_t wheel_angle, + int16_t target_angle, + int threshold) -> bool; + static auto Create() -> TouchWheel* { return new TouchWheel(); } TouchWheel(); ~TouchWheel(); |
