diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-08-07 12:09:23 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-08-07 12:09:23 +1000 |
| commit | 1ff28233bd6a64fab97c56861477e122e4c3eac6 (patch) | |
| tree | b5265a93a0e55043f16cefedbb8f9e43e9d18ff7 /src/drivers | |
| parent | 649cb74f036c392264264d35f98bef1fa4a5a8aa (diff) | |
| download | tangara-fw-1ff28233bd6a64fab97c56861477e122e4c3eac6.tar.gz | |
Recalibrate the touchwheel after unlocking
Also power it down whilst we're locked. This saves about half a
milliamp.
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/include/drivers/touchwheel.hpp | 3 | ||||
| -rw-r--r-- | src/drivers/touchwheel.cpp | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/drivers/include/drivers/touchwheel.hpp b/src/drivers/include/drivers/touchwheel.hpp index 60902087..9cd925a6 100644 --- a/src/drivers/include/drivers/touchwheel.hpp +++ b/src/drivers/include/drivers/touchwheel.hpp @@ -39,7 +39,8 @@ class TouchWheel { auto Update() -> void; auto GetTouchWheelData() const -> TouchWheelData; - auto PowerDown() -> void; + auto Recalibrate() -> void; + auto LowPowerMode(bool en) -> void; private: TouchWheelData data_; diff --git a/src/drivers/touchwheel.cpp b/src/drivers/touchwheel.cpp index 5d55c6f2..402b839d 100644 --- a/src/drivers/touchwheel.cpp +++ b/src/drivers/touchwheel.cpp @@ -137,8 +137,12 @@ TouchWheelData TouchWheel::GetTouchWheelData() const { return data_; } -auto TouchWheel::PowerDown() -> void { - WriteRegister(LOW_POWER, 0); +auto TouchWheel::Recalibrate() -> void { + WriteRegister(CALIBRATE, 1); +} + +auto TouchWheel::LowPowerMode(bool en) -> void { + WriteRegister(LOW_POWER, en ? 0 : 1); } } // namespace drivers |
