InfiniTime.git

ref: e5b73212f6addcfdb5e306df63d7135e543c4f8d

src/touchhandler/TouchHandler.h


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "drivers/Cst816s.h"
#include "displayapp/TouchEvents.h"

namespace Pinetime {
  namespace Controllers {
    class TouchHandler {
    public:
      struct TouchPoint {
        int x;
        int y;
        bool touching;
      };

      bool ProcessTouchInfo(Drivers::Cst816S::TouchInfos info);

      bool IsTouching() const {
        return currentTouchPoint.touching;
      }

      uint8_t GetX() const {
        return currentTouchPoint.x;
      }

      uint8_t GetY() const {
        return currentTouchPoint.y;
      }

      Pinetime::Applications::TouchEvents GestureGet();

    private:
      Pinetime::Applications::TouchEvents gesture;
      TouchPoint currentTouchPoint = {};
      bool gestureReleased = true;
    };
  }
}