-
Notifications
You must be signed in to change notification settings - Fork 0
/
TouchHIDSub.h
32 lines (27 loc) · 909 Bytes
/
TouchHIDSub.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
#pragma once
#define MOUSE_LEFT 1
#define MOUSE_RIGHT 2
#define MOUSE_MIDDLE 4
#define MOUSE_BACK 8
#define MOUSE_FORWARD 16
#define MOUSE_ALL (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE) # For compatibility with the Mouse library
class TouchHIDSub : public BleHIDSubBase
{
public:
TouchHIDSub() {isPressed=false; LastReportSent=0;LastState=0;};
void send(int state, int16_t x, int16_t y);
void click(int16_t x, int16_t y);
void release();
void loop();
// Return the HID descriptor for the device
virtual const uint8_t* GetHIDDecsriptor(int* NumBytes);
// Return the input and output characteristics of the device.
// Called multiple times, until the function returns 0. Index is the count.
virtual int GetInputReportIndex(int Index);
private:
bool isPressed;
int16_t LastX;
int16_t LastY;
int LastState=0;
unsigned long LastReportSent;
};