Handle error code when calling TwiMaster::Read().
This commit is contained in:
parent
2f710d06f3
commit
8a8c8aa863
|
@ -37,7 +37,9 @@ void Cst816S::Init() {
|
||||||
Cst816S::TouchInfos Cst816S::GetTouchInfo() {
|
Cst816S::TouchInfos Cst816S::GetTouchInfo() {
|
||||||
Cst816S::TouchInfos info;
|
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;
|
auto nbTouchPoints = touchData[2] & 0x0f;
|
||||||
|
|
||||||
// uint8_t i = 0;
|
// uint8_t i = 0;
|
||||||
|
|
|
@ -18,13 +18,13 @@ namespace Pinetime {
|
||||||
LongPress = 0x0C
|
LongPress = 0x0C
|
||||||
};
|
};
|
||||||
struct TouchInfos {
|
struct TouchInfos {
|
||||||
uint16_t x;
|
uint16_t x = 0;
|
||||||
uint16_t y;
|
uint16_t y = 0;
|
||||||
uint8_t action;
|
uint8_t action = 0;
|
||||||
uint8_t finger;
|
uint8_t finger = 0;
|
||||||
uint8_t pressure;
|
uint8_t pressure = 0;
|
||||||
uint8_t area;
|
uint8_t area = 0;
|
||||||
Gestures gesture;
|
Gestures gesture = Gestures::None;
|
||||||
bool isTouch = false;
|
bool isTouch = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue