From 1b245316fe282035f094a3656f717d419e8bd526 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 4 Apr 2023 14:48:35 +1000 Subject: fix up touchpad timeouts, make it less chatty --- src/drivers/include/touchwheel.hpp | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'src/drivers/include') 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 #include +#include #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, 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 -- cgit v1.2.3