From e9c7ab4cfc82172a07c19a0c4877b4afd11412f8 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sat, 6 Nov 2021 19:01:19 +0100 Subject: Add data validity check and retries in CST816S driver. See https://github.com/InfiniTimeOrg/InfiniTime/issues/763#issuecomment-962436976. --- src/drivers/Cst816s.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/drivers/Cst816s.h') diff --git a/src/drivers/Cst816s.h b/src/drivers/Cst816s.h index 0fec8419..507dd4f5 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; -- cgit v1.2.3-70-g09d2