Give the touchwheel a little more juice for debugging

custom
jacqueline 2 years ago
parent 09ad66136d
commit ee559cd722
  1. 1
      src/drivers/include/touchwheel.hpp
  2. 12
      src/drivers/touchwheel.cpp

@ -40,6 +40,7 @@ class TouchWheel {
RESET = 0x7, RESET = 0x7,
LOW_POWER = 0x8, LOW_POWER = 0x8,
SLIDER_OPTIONS = 0x14, SLIDER_OPTIONS = 0x14,
CHARGE_TIME = 0x15,
}; };
void WriteRegister(uint8_t reg, uint8_t val); void WriteRegister(uint8_t reg, uint8_t val);

@ -35,6 +35,10 @@ TouchWheel::TouchWheel() {
vTaskDelay(pdMS_TO_TICKS(1)); vTaskDelay(pdMS_TO_TICKS(1));
WriteRegister(Register::SLIDER_OPTIONS, 0b11000000); WriteRegister(Register::SLIDER_OPTIONS, 0b11000000);
WriteRegister(Register::CALIBRATE, 1); 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() {} TouchWheel::~TouchWheel() {}
@ -78,6 +82,10 @@ void TouchWheel::Update() {
// Still calibrating. // Still calibrating.
return; 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) { if (status & 0b10) {
// Slider detect. // Slider detect.
data_.wheel_position = ReadRegister(Register::SLIDER_POSITION); data_.wheel_position = ReadRegister(Register::SLIDER_POSITION);
@ -85,6 +93,10 @@ void TouchWheel::Update() {
if (status & 0b1) { if (status & 0b1) {
// Key detect. // Key detect.
// TODO(daniel): implement me // 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);
} }
} }

Loading…
Cancel
Save