summaryrefslogtreecommitdiff
path: root/src/drivers/Cst816s.h
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-11-06 18:01:19 (GMT)
committerJean-François Milants <jf@codingfield.com>2021-11-06 18:01:19 (GMT)
commite9c7ab4cfc82172a07c19a0c4877b4afd11412f8 (patch)
treeb6ca84e7a1c92457c2c9768299004fe8127344f9 /src/drivers/Cst816s.h
parent4a5b5f954f12de1574af8e3efec094bb4bdbb542 (diff)
Add data validity check and retries in CST816S driver. See https://github.com/InfiniTimeOrg/InfiniTime/issues/763#issuecomment-962436976.
Diffstat (limited to 'src/drivers/Cst816s.h')
-rw-r--r--src/drivers/Cst816s.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/drivers/Cst816s.h b/src/drivers/Cst816s.h
index 0fec841..507dd4f 100644
--- a/src/drivers/Cst816s.h
+++ b/src/drivers/Cst816s.h
@@ -21,7 +21,7 @@ namespace Pinetime {
uint16_t y = 0;
Gestures gesture = Gestures::None;
bool touching = false;
- bool isValid = true;
+ bool isValid = false;
};
Cst816S(TwiMaster& twiMaster, uint8_t twiAddress);
@@ -45,6 +45,8 @@ namespace Pinetime {
return fwVersion;
}
private:
+ bool CheckDeviceIds();
+
// Unused/Unavailable commented out
static constexpr uint8_t gestureIndex = 1;
static constexpr uint8_t touchPointNumIndex = 2;
@@ -58,6 +60,9 @@ namespace Pinetime {
//static constexpr uint8_t touchXYIndex = 7;
//static constexpr uint8_t touchMiscIndex = 8;
+ static constexpr uint8_t maxX = 240;
+ static constexpr uint8_t maxY = 240;
+
TwiMaster& twiMaster;
uint8_t twiAddress;