-
Notifications
You must be signed in to change notification settings - Fork 76
/
Digitizer.cpp
51 lines (41 loc) · 822 Bytes
/
Digitizer.cpp
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "USBComposite.h"
//================================================================================
//================================================================================
// Mouse
void HIDDigitizer::begin(void){
}
void HIDDigitizer::end(void){
}
void HIDDigitizer::move(uint16 x, uint16 y)
{
report.x = x;
report.y = y;
sendReport();
}
void HIDDigitizer::buttons(uint8_t b)
{
if (b != report.buttons)
{
report.buttons = b;
sendReport();
}
}
void HIDDigitizer::click(uint8_t b)
{
press(b);
release(b);
}
void HIDDigitizer::press(uint8_t b)
{
buttons(report.buttons | b);
}
void HIDDigitizer::release(uint8_t b)
{
buttons(report.buttons & ~b);
}
bool HIDDigitizer::isPressed(uint8_t b)
{
if ((b & report.buttons) == b)
return true;
return false;
}