diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-04-04 14:48:35 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-04-04 14:48:35 +1000 |
| commit | 1b245316fe282035f094a3656f717d419e8bd526 (patch) | |
| tree | 04522bf36f9257e638137c82f3f4e60348651589 /src/drivers/include | |
| parent | 9799ab458d8ad870aaec048abf5b1b1d93aa7aff (diff) | |
| download | tangara-fw-1b245316fe282035f094a3656f717d419e8bd526.tar.gz | |
fix up touchpad timeouts, make it less chatty
Diffstat (limited to 'src/drivers/include')
| -rw-r--r-- | src/drivers/include/touchwheel.hpp | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/drivers/include/touchwheel.hpp b/src/drivers/include/touchwheel.hpp index 14215acd..3dfa182b 100644 --- a/src/drivers/include/touchwheel.hpp +++ b/src/drivers/include/touchwheel.hpp @@ -1,8 +1,7 @@ #pragma once - -#include <functional> #include <stdint.h> +#include <functional> #include "esp_err.h" #include "result.hpp" @@ -18,14 +17,7 @@ struct TouchWheelData { class TouchWheel { public: - enum Error { - FAILED_TO_BOOT, - FAILED_TO_CONFIGURE, - }; - static auto create(GpioExpander* expander) - -> cpp::result<std::unique_ptr<TouchWheel>, Error>; - - TouchWheel(GpioExpander* gpio); + TouchWheel(); ~TouchWheel(); // Not copyable or movable. @@ -36,25 +28,22 @@ class TouchWheel { auto GetTouchWheelData() const -> TouchWheelData; private: - GpioExpander* gpio_; TouchWheelData data_; - + enum Register { FIRMWARE_VERSION = 0x1, DETECTION_STATUS = 0x2, - KEY_STATUS_A = 0x3, - KEY_STATUS_B = 0x4, - SLIDER_POSITION = 0x5, - CALIBRATE = 0x6, - RESET = 0x7, - LOW_POWER = 0x8, - SLIDER_OPTIONS = 0x14, + KEY_STATUS_A = 0x3, + KEY_STATUS_B = 0x4, + SLIDER_POSITION = 0x5, + CALIBRATE = 0x6, + RESET = 0x7, + LOW_POWER = 0x8, + SLIDER_OPTIONS = 0x14, }; - void WriteRegister(uint8_t reg, uint8_t val); - void ReadRegister(uint8_t reg, uint8_t* data, uint8_t count); - + uint8_t ReadRegister(uint8_t reg); }; } // namespace drivers |
