/
KeyboardFunctions.ino
80 lines (80 loc) · 1.83 KB
/
KeyboardFunctions.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*keyboardFunctions
//would need to be a serial equivilent of this file to debug
//on uno and other non-atmega32u4
//!!some of the controlMacro functions need to be moved here
//to encompass all keyboard functions over the scope of JesterType
//################################################################
*/
//modifiers are assign as variables to pass to functions
//prog_char supeRight= KEY_RIGHT_GUI;
//prog_char lctrl = KEY_LEFT_CTRL;
//prog_char rctrl = KEY_RIGHT_CTRL;
//prog_char lshift = KEY_LEFT_SHIFT;
//prog_char rshift = KEY_RIGHT_SHIFT;
//prog_char lalt = KEY_LEFT_ALT;
//prog_char ralt = KEY_RIGHT_ALT;
//prog_char up = KEY_UP_ARROW;
//prog_char down = KEY_DOWN_ARROW;
//prog_char right = KEY_RIGHT_ARROW;
//prog_char left = KEY_LEFT_ARROW;
//prog_char HOME = KEY_HOME;
//prog_char END = KEY_END;
//prog_char f2 = KEY_F2;
//prog_char f4 = KEY_F4;
//prog_char f5 = KEY_F5;
//prog_char f10 = KEY_F10;
//prog_char f12 = KEY_F12;
//prog_char tab = KEY_TAB;
//prog_char RTN = KEY_RETURN;
#define BACK 178
//-----------------------------
///*
void outputUp()
{
Keyboard.begin();
}
//Cross serial compatible
void pressKeys(int presses, char key)
{
for(int i=0;i<presses;i++)
{
Keyboard.write(key);
}
}
void pressKey(char key)
{
Keyboard.write(key);
}
//HID only / serial creative (new lining reproduction)
void backSpace()
{
Keyboard.write(BACK);
}
void backSpaces(int increment)
{
for(int i=0;i<increment;i++)
{
Keyboard.write(BACK);
}
}
void enter()
{
Keyboard.write(KEY_RETURN);
}
void movement(int increment, boolean bearing)
{
char going;
if(bearing)//if true aka 1
{
going=KEY_LEFT_ARROW;//LEFT=1 defined golobally
}
else//if false aka 0
{
going=KEY_RIGHT_ARROW;//RIGHT=0 defined golobally
}
for (int i=0;i<increment;i++)
{//go that direction as many times as asked
Keyboard.write(going);
}
}
//*/