summaryrefslogtreecommitdiff
path: root/src/touchhandler
diff options
context:
space:
mode:
Diffstat (limited to 'src/touchhandler')
-rw-r--r--src/touchhandler/TouchHandler.cpp9
-rw-r--r--src/touchhandler/TouchHandler.h11
2 files changed, 12 insertions, 8 deletions
diff --git a/src/touchhandler/TouchHandler.cpp b/src/touchhandler/TouchHandler.cpp
index 160b5e14..0d0b8273 100644
--- a/src/touchhandler/TouchHandler.cpp
+++ b/src/touchhandler/TouchHandler.cpp
@@ -6,8 +6,10 @@ TouchHandler::TouchHandler(Drivers::Cst816S& touchPanel, Components::LittleVgl&
}
void TouchHandler::CancelTap() {
- isCancelled = true;
- lvgl.SetNewTouchPoint(-1, -1, true);
+ if (info.touching) {
+ isCancelled = true;
+ lvgl.SetNewTouchPoint(-1, -1, true);
+ }
}
Pinetime::Drivers::Cst816S::Gestures TouchHandler::GestureGet() {
@@ -28,7 +30,6 @@ void TouchHandler::Process(void* instance) {
}
void TouchHandler::Work() {
- Pinetime::Drivers::Cst816S::TouchInfos info;
Pinetime::Drivers::Cst816S::Gestures prevGesture = Pinetime::Drivers::Cst816S::Gestures::None;
while (true) {
vTaskSuspend(taskHandle);
@@ -48,8 +49,6 @@ void TouchHandler::Work() {
if (systemTask->IsSleeping()) {
systemTask->PushMessage(System::Messages::TouchWakeUp);
} else {
- x = info.x;
- y = info.y;
if (info.touching) {
if (!isCancelled) {
lvgl.SetNewTouchPoint(info.x, info.y, true);
diff --git a/src/touchhandler/TouchHandler.h b/src/touchhandler/TouchHandler.h
index 37ef5af2..6b8189f5 100644
--- a/src/touchhandler/TouchHandler.h
+++ b/src/touchhandler/TouchHandler.h
@@ -22,23 +22,28 @@ namespace Pinetime {
void Register(Pinetime::System::SystemTask* systemTask);
void Start();
void WakeUp();
+
+ bool IsTouching() const {
+ return info.touching;
+ }
uint8_t GetX() const {
- return x;
+ return info.x;
}
uint8_t GetY() const {
- return y;
+ return info.y;
}
Drivers::Cst816S::Gestures GestureGet();
private:
static void Process(void* instance);
void Work();
+
+ Pinetime::Drivers::Cst816S::TouchInfos info;
Pinetime::System::SystemTask* systemTask = nullptr;
TaskHandle_t taskHandle;
Pinetime::Drivers::Cst816S& touchPanel;
Pinetime::Components::LittleVgl& lvgl;
Pinetime::Drivers::Cst816S::Gestures gesture;
bool isCancelled = false;
- uint8_t x, y;
};
}
}