@@ -35,32 +35,32 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
35
35
0xa1 , 0x01 , // COLLECTION (Application)
36
36
0x85 , 0x02 , // REPORT_ID (2)
37
37
0x05 , 0x07 , // USAGE_PAGE (Keyboard)
38
-
38
+
39
39
0x19 , 0xe0 , // USAGE_MINIMUM (Keyboard LeftControl)
40
40
0x29 , 0xe7 , // USAGE_MAXIMUM (Keyboard Right GUI)
41
41
0x15 , 0x00 , // LOGICAL_MINIMUM (0)
42
42
0x25 , 0x01 , // LOGICAL_MAXIMUM (1)
43
43
0x75 , 0x01 , // REPORT_SIZE (1)
44
-
44
+
45
45
0x95 , 0x08 , // REPORT_COUNT (8)
46
46
0x81 , 0x02 , // INPUT (Data,Var,Abs)
47
47
0x95 , 0x01 , // REPORT_COUNT (1)
48
48
0x75 , 0x08 , // REPORT_SIZE (8)
49
49
0x81 , 0x03 , // INPUT (Cnst,Var,Abs)
50
-
50
+
51
51
0x95 , 0x06 , // REPORT_COUNT (6)
52
52
0x75 , 0x08 , // REPORT_SIZE (8)
53
53
0x15 , 0x00 , // LOGICAL_MINIMUM (0)
54
54
0x25 , 0x73 , // LOGICAL_MAXIMUM (115)
55
55
0x05 , 0x07 , // USAGE_PAGE (Keyboard)
56
-
56
+
57
57
0x19 , 0x00 , // USAGE_MINIMUM (Reserved (no event indicated))
58
58
0x29 , 0x73 , // USAGE_MAXIMUM (Keyboard Application)
59
59
0x81 , 0x00 , // INPUT (Data,Ary,Abs)
60
60
0xc0 , // END_COLLECTION
61
61
};
62
62
63
- Keyboard_::Keyboard_ (void )
63
+ Keyboard_::Keyboard_ (void )
64
64
{
65
65
static HIDSubDescriptor node (_hidReportDescriptor, sizeof (_hidReportDescriptor));
66
66
HID ().AppendDescriptor (&node);
@@ -91,16 +91,16 @@ const uint8_t _asciimap[128] =
91
91
0x00 , // ETX
92
92
0x00 , // EOT
93
93
0x00 , // ENQ
94
- 0x00 , // ACK
94
+ 0x00 , // ACK
95
95
0x00 , // BEL
96
96
0x2a , // BS Backspace
97
97
0x2b , // TAB Tab
98
98
0x28 , // LF Enter
99
- 0x00 , // VT
100
- 0x00 , // FF
101
- 0x00 , // CR
102
- 0x00 , // SO
103
- 0x00 , // SI
99
+ 0x00 , // VT
100
+ 0x00 , // FF
101
+ 0x00 , // CR
102
+ 0x00 , // SO
103
+ 0x00 , // SI
104
104
0x00 , // DEL
105
105
0x00 , // DC1
106
106
0x00 , // DC2
@@ -110,13 +110,13 @@ const uint8_t _asciimap[128] =
110
110
0x00 , // SYN
111
111
0x00 , // ETB
112
112
0x00 , // CAN
113
- 0x00 , // EM
113
+ 0x00 , // EM
114
114
0x00 , // SUB
115
115
0x00 , // ESC
116
- 0x00 , // FS
117
- 0x00 , // GS
118
- 0x00 , // RS
119
- 0x00 , // US
116
+ 0x00 , // FS
117
+ 0x00 , // GS
118
+ 0x00 , // RS
119
+ 0x00 , // US
120
120
121
121
0x2c , // ' '
122
122
0x1e |SHIFT, // !
@@ -220,10 +220,10 @@ const uint8_t _asciimap[128] =
220
220
uint8_t USBPutChar (uint8_t c);
221
221
222
222
// press() adds the specified key (printing, non-printing, or modifier)
223
- // to the persistent key report and sends the report. Because of the way
224
- // USB HID works, the host acts like the key remains pressed until we
223
+ // to the persistent key report and sends the report. Because of the way
224
+ // USB HID works, the host acts like the key remains pressed until we
225
225
// call release(), releaseAll(), or otherwise clear the report and resend.
226
- size_t Keyboard_::press (uint8_t k)
226
+ size_t Keyboard_::press (uint8_t k)
227
227
{
228
228
uint8_t i;
229
229
if (k >= 136 ) { // it's a non-printing key (not a modifier)
@@ -245,10 +245,10 @@ size_t Keyboard_::press(uint8_t k)
245
245
246
246
// Add k to the key report only if it's not already present
247
247
// and if there is an empty slot.
248
- if (_keyReport.keys [0 ] != k && _keyReport.keys [1 ] != k &&
248
+ if (_keyReport.keys [0 ] != k && _keyReport.keys [1 ] != k &&
249
249
_keyReport.keys [2 ] != k && _keyReport.keys [3 ] != k &&
250
250
_keyReport.keys [4 ] != k && _keyReport.keys [5 ] != k) {
251
-
251
+
252
252
for (i=0 ; i<6 ; i++) {
253
253
if (_keyReport.keys [i] == 0x00 ) {
254
254
_keyReport.keys [i] = k;
@@ -258,7 +258,7 @@ size_t Keyboard_::press(uint8_t k)
258
258
if (i == 6 ) {
259
259
setWriteError ();
260
260
return 0 ;
261
- }
261
+ }
262
262
}
263
263
sendReport (&_keyReport);
264
264
return 1 ;
@@ -267,7 +267,7 @@ size_t Keyboard_::press(uint8_t k)
267
267
// release() takes the specified key out of the persistent key report and
268
268
// sends the report. This tells the OS the key is no longer pressed and that
269
269
// it shouldn't be repeated any more.
270
- size_t Keyboard_::release (uint8_t k)
270
+ size_t Keyboard_::release (uint8_t k)
271
271
{
272
272
uint8_t i;
273
273
if (k >= 136 ) { // it's a non-printing key (not a modifier)
@@ -301,11 +301,11 @@ size_t Keyboard_::release(uint8_t k)
301
301
void Keyboard_::releaseAll (void )
302
302
{
303
303
_keyReport.keys [0 ] = 0 ;
304
- _keyReport.keys [1 ] = 0 ;
304
+ _keyReport.keys [1 ] = 0 ;
305
305
_keyReport.keys [2 ] = 0 ;
306
- _keyReport.keys [3 ] = 0 ;
306
+ _keyReport.keys [3 ] = 0 ;
307
307
_keyReport.keys [4 ] = 0 ;
308
- _keyReport.keys [5 ] = 0 ;
308
+ _keyReport.keys [5 ] = 0 ;
309
309
_keyReport.modifiers = 0 ;
310
310
sendReport (&_keyReport);
311
311
}
0 commit comments