acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

TouchLibInterface.hpp (2585B)

      1 /**
      2  *
      3  * @license MIT License
      4  *
      5  * Copyright (c) 2022 micky
      6  *
      7  * Permission is hereby granted, free of charge, to any person obtaining a copy
      8  * of this software and associated documentation files (the "Software"), to deal
      9  * in the Software without restriction, including without limitation the rights
     10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     11  * copies of the Software, and to permit persons to whom the Software is
     12  * furnished to do so, subject to the following conditions:
     13  *
     14  * The above copyright notice and this permission notice shall be included in all
     15  * copies or substantial portions of the Software.
     16  *
     17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     23  * SOFTWARE.
     24  *
     25  * @file      TouchLibInterface.hpp
     26  * @author    Micky (513673326@qq.com)
     27  * @date      2022-10-24
     28  *
     29  */
     30 
     31 #pragma once
     32 
     33 #include "stdint.h"
     34 
     35 class TP_Point {
     36 public:
     37   TP_Point(void){};
     38   ~TP_Point(){};
     39   TP_Point(uint8_t id, uint16_t x, uint16_t y, uint16_t size, uint8_t pressure, uint8_t state)
     40       : id(id), x(x), y(y), size(size), pressure(pressure), state(state) {}
     41 
     42   bool operator==(TP_Point point) {
     43     return ((point.x == x) && (point.y == y) && (point.size == size) && (point.pressure == pressure) && (point.state == state));
     44   }
     45   bool operator!=(TP_Point point) {
     46     return ((point.x != x) || (point.y != y) || (point.size != size) || (point.pressure != pressure) || (point.state != state));
     47   }
     48 
     49   uint8_t id;
     50   uint16_t x;
     51   uint16_t y;
     52   uint8_t size;
     53   uint8_t pressure;
     54   uint8_t state;
     55 };
     56 
     57 class TouchLibInterface {
     58 public:
     59   TouchLibInterface() {}
     60   virtual ~TouchLibInterface() {}
     61 
     62   virtual bool init() = 0;
     63 
     64   virtual void deinit() = 0;
     65 
     66   virtual bool enableSleep() = 0;
     67 
     68   virtual bool read() = 0;
     69 
     70   virtual uint8_t getPointNum() = 0;
     71 
     72   virtual TP_Point getPoint(uint8_t n) = 0;
     73 
     74   // virtual void setRotation(uint8_t r) = 0;
     75 
     76   virtual uint8_t getRotation() = 0;
     77 };
     78 
     79 class TouchLibGesture {
     80 public:
     81   TouchLibGesture() {}
     82   virtual ~TouchLibGesture() {}
     83 
     84   virtual bool isEnableGesture() = 0;
     85 
     86   virtual bool enableGesture() = 0;
     87 
     88   virtual bool disableGesture() = 0;
     89 
     90   virtual uint8_t getGesture(void) = 0;
     91 };