summaryrefslogtreecommitdiff
path: root/src/drivers/Cst816s.cpp
diff options
context:
space:
mode:
authorJF002 <JF002@users.noreply.github.com>2020-10-27 19:48:39 +0100
committerGitHub <noreply@github.com>2020-10-27 19:48:39 +0100
commit45e65b66b11b6b8533b225067ce4c2a4b5eac653 (patch)
treedbf1b486ad1493f11d5a5485c231a85309db02fc /src/drivers/Cst816s.cpp
parente888b92b1f2e239223a31e21f0f6bfdc9f2e6a9b (diff)
parent8a8c8aa86312840a84533318bff92fdb6c42b8de (diff)
Merge pull request #111 from JF002/fix-twi-hang
Workaround for TWI driver freeze
Diffstat (limited to 'src/drivers/Cst816s.cpp')
-rw-r--r--src/drivers/Cst816s.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/drivers/Cst816s.cpp b/src/drivers/Cst816s.cpp
index f6816545..94db3b34 100644
--- a/src/drivers/Cst816s.cpp
+++ b/src/drivers/Cst816s.cpp
@@ -37,7 +37,9 @@ void Cst816S::Init() {
Cst816S::TouchInfos Cst816S::GetTouchInfo() {
Cst816S::TouchInfos info;
- twiMaster.Read(twiAddress, 0, touchData, 63);
+ auto ret = twiMaster.Read(twiAddress, 0, touchData, 63);
+ if(ret != TwiMaster::ErrorCodes::NoError) return {};
+
auto nbTouchPoints = touchData[2] & 0x0f;
// uint8_t i = 0;