-
Notifications
You must be signed in to change notification settings - Fork 0
/
f_handleRightFoot.ino
40 lines (34 loc) · 1008 Bytes
/
f_handleRightFoot.ino
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
//implements open context menu and select / drag and drop
void handleRightFoot(){
//select / drag and drop
if(rightState == LOW && lastRightState == LOW && selectOn){
Mouse.press();
Mouse.move(-gyroX/widthSensitivity, gyroY/heightSensitivity);
}else{
Mouse.release();
//feet were down, are up now
if(rightState == HIGH && lastRightState== LOW){
startTime = millis();
}
//feet were up, are down now
else if(rightState == LOW && lastRightState == HIGH){
unsigned long endTime = millis();
unsigned long duration = endTime - startTime;
if(duration < longClick){
//open context menu
Mouse.click(MOUSE_RIGHT);
}
else{
//activate/deactivate select mode
if(!selectOn){
selectOn = true;
}
else{
selectOn = false;
}
}
}
}
//update lastRightState
lastRightState = rightState;
}