diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-05-02 21:52:59 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-05-02 21:52:59 +1000 |
| commit | 26eb580043ad176bdc58d996f30d470e1073ef00 (patch) | |
| tree | e499b1115108effe91c961452c1ee101d07beeac /src/drivers/include/touchwheel.hpp | |
| parent | 7d7f7755d17e1e0a2348d75d797097f166b70471 (diff) | |
| download | tangara-fw-26eb580043ad176bdc58d996f30d470e1073ef00.tar.gz | |
move driver includes into a subdir as well
Diffstat (limited to 'src/drivers/include/touchwheel.hpp')
| -rw-r--r-- | src/drivers/include/touchwheel.hpp | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/drivers/include/touchwheel.hpp b/src/drivers/include/touchwheel.hpp deleted file mode 100644 index 18ace2b4..00000000 --- a/src/drivers/include/touchwheel.hpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2023 jacqueline <me@jacqueline.id.au> - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#pragma once - -#include <stdint.h> -#include <functional> - -#include "esp_err.h" -#include "result.hpp" - -#include "gpios.hpp" - -namespace drivers { - -struct TouchWheelData { - bool is_wheel_touched = false; - bool is_button_touched = false; - uint8_t wheel_position = -1; -}; - -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(); - - // Not copyable or movable. - TouchWheel(const TouchWheel&) = delete; - TouchWheel& operator=(const TouchWheel&) = delete; - - auto Update() -> void; - auto GetTouchWheelData() const -> TouchWheelData; - - auto PowerDown() -> void; - - private: - TouchWheelData data_; - - enum Register { - FIRMWARE_VERSION = 1, - DETECTION_STATUS = 2, - KEY_STATUS_A = 3, - KEY_STATUS_B = 4, - SLIDER_POSITION = 5, - CALIBRATE = 6, - RESET = 7, - LOW_POWER = 8, - RECALIBRATION_DELAY = 12, - SLIDER_OPTIONS = 14, - CHARGE_TIME = 15, - DETECT_THRESHOLD_BASE = 16, - KEY_CONTROL_BASE = 28, - PULSE_SCALE_BASE = 40, - }; - - void WriteRegister(uint8_t reg, uint8_t val); - uint8_t ReadRegister(uint8_t reg); -}; - -} // namespace drivers |
