diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-05-02 16:01:41 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-05-02 16:01:41 +1000 |
| commit | ee559cd72288053e263c473a7d60c279b6bc65a1 (patch) | |
| tree | c807e4578959bb33a998f0013895c1431a082106 | |
| parent | 09ad66136d11909c0e6e258a8dc953f2d2b46c41 (diff) | |
| download | tangara-fw-ee559cd72288053e263c473a7d60c279b6bc65a1.tar.gz | |
Give the touchwheel a little more juice for debugging
| -rw-r--r-- | src/drivers/include/touchwheel.hpp | 1 | ||||
| -rw-r--r-- | src/drivers/touchwheel.cpp | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/drivers/include/touchwheel.hpp b/src/drivers/include/touchwheel.hpp index 3dfa182b..fae4b237 100644 --- a/src/drivers/include/touchwheel.hpp +++ b/src/drivers/include/touchwheel.hpp @@ -40,6 +40,7 @@ class TouchWheel { RESET = 0x7, LOW_POWER = 0x8, SLIDER_OPTIONS = 0x14, + CHARGE_TIME = 0x15, }; void WriteRegister(uint8_t reg, uint8_t val); diff --git a/src/drivers/touchwheel.cpp b/src/drivers/touchwheel.cpp index 51a67187..d47b19a1 100644 --- a/src/drivers/touchwheel.cpp +++ b/src/drivers/touchwheel.cpp @@ -35,6 +35,10 @@ TouchWheel::TouchWheel() { vTaskDelay(pdMS_TO_TICKS(1)); WriteRegister(Register::SLIDER_OPTIONS, 0b11000000); WriteRegister(Register::CALIBRATE, 1); + // Confusingly-named; this sets to max-power max-response-time. + WriteRegister(Register::LOW_POWER, 1); + // TODO(jacqueline): Temp to debug touchwheel responsiveness. + WriteRegister(Register::CHARGE_TIME, 8); } TouchWheel::~TouchWheel() {} @@ -78,6 +82,10 @@ void TouchWheel::Update() { // Still calibrating. return; } + if (status & 0b01000000) { + // Probably okay, but we should keep an eye on this for development. + ESP_LOGW(kTag, "touchwheel acquisition >16ms"); + } if (status & 0b10) { // Slider detect. data_.wheel_position = ReadRegister(Register::SLIDER_POSITION); @@ -85,6 +93,10 @@ void TouchWheel::Update() { if (status & 0b1) { // Key detect. // TODO(daniel): implement me + // Ensure we read all status registers -- even if we're not using them -- to + // ensure that INT can float high again. + ReadRegister(Register::KEY_STATUS_A); + ReadRegister(Register::KEY_STATUS_B); } } |
