Skip to content

Commit 90395ea

Browse files
ci(pre-commit): Apply automatic fixes
1 parent 13fa1d6 commit 90395ea

22 files changed

+1797
-1807
lines changed

Diff for: libraries/USB/src/USBHIDKeyboard.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ size_t USBHIDKeyboard::press(uint8_t k) {
155155
k &= ~SHIFT;
156156
}
157157
if ((k & ALT_GR) == ALT_GR) {
158-
_keyReport.modifiers |= 0x40; // AltGr = right Alt
159-
k &= ~ALT_GR;
160-
}
161-
if (k == ISO_REPLACEMENT) {
162-
k = ISO_KEY;
163-
}
158+
_keyReport.modifiers |= 0x40; // AltGr = right Alt
159+
k &= ~ALT_GR;
160+
}
161+
if (k == ISO_REPLACEMENT) {
162+
k = ISO_KEY;
163+
}
164164
}
165165
return pressRaw(k);
166166
}
@@ -186,15 +186,15 @@ size_t USBHIDKeyboard::release(uint8_t k) {
186186
} else {
187187
_keyReport.modifiers &= ~(0x02); // the left shift modifier
188188
k &= ~SHIFT;
189-
}
189+
}
190190
}
191191
if ((k & ALT_GR) == ALT_GR) {
192-
_keyReport.modifiers &= ~(0x40); // AltGr = right Alt
193-
k &= ~ALT_GR;
194-
}
195-
if (k == ISO_REPLACEMENT) {
196-
k = ISO_KEY;
197-
}
192+
_keyReport.modifiers &= ~(0x40); // AltGr = right Alt
193+
k &= ~ALT_GR;
194+
}
195+
if (k == ISO_REPLACEMENT) {
196+
k = ISO_KEY;
197+
}
198198
}
199199
return releaseRaw(k);
200200
}

Diff for: libraries/USB/src/USBHIDKeyboard.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ extern const uint8_t KeyboardLayout_pt_BR[];
6868
#define KEY_LEFT_GUI 0x83
6969
#define KEY_RIGHT_CTRL 0x84
7070
#define KEY_RIGHT_SHIFT 0x85
71-
#define KEY_RIGHT_ALT 0x86 // AltGr (Right Alt) Key
71+
#define KEY_RIGHT_ALT 0x86 // AltGr (Right Alt) Key
7272
#define KEY_RIGHT_GUI 0x87
7373

7474
#define KEY_UP_ARROW 0xDA
7575
#define KEY_DOWN_ARROW 0xD9
7676
#define KEY_LEFT_ARROW 0xD8
7777
#define KEY_RIGHT_ARROW 0xD7
78-
#define KEY_MENU 0xED // "Keyboard Application" in USB standard
78+
#define KEY_MENU 0xED // "Keyboard Application" in USB standard
7979
#define KEY_SPACE 0x20
8080
#define KEY_BACKSPACE 0xB2
8181
#define KEY_TAB 0xB3
@@ -124,22 +124,22 @@ extern const uint8_t KeyboardLayout_pt_BR[];
124124
#define LED_KANA 0x10
125125

126126
// Numeric keypad
127-
#define KEY_KP_SLASH 0xDC
128-
#define KEY_KP_ASTERISK 0xDD
129-
#define KEY_KP_MINUS 0xDE
130-
#define KEY_KP_PLUS 0xDF
131-
#define KEY_KP_ENTER 0xE0
132-
#define KEY_KP_1 0xE1
133-
#define KEY_KP_2 0xE2
134-
#define KEY_KP_3 0xE3
135-
#define KEY_KP_4 0xE4
136-
#define KEY_KP_5 0xE5
137-
#define KEY_KP_6 0xE6
138-
#define KEY_KP_7 0xE7
139-
#define KEY_KP_8 0xE8
140-
#define KEY_KP_9 0xE9
141-
#define KEY_KP_0 0xEA
142-
#define KEY_KP_DOT 0xEB
127+
#define KEY_KP_SLASH 0xDC
128+
#define KEY_KP_ASTERISK 0xDD
129+
#define KEY_KP_MINUS 0xDE
130+
#define KEY_KP_PLUS 0xDF
131+
#define KEY_KP_ENTER 0xE0
132+
#define KEY_KP_1 0xE1
133+
#define KEY_KP_2 0xE2
134+
#define KEY_KP_3 0xE3
135+
#define KEY_KP_4 0xE4
136+
#define KEY_KP_5 0xE5
137+
#define KEY_KP_6 0xE6
138+
#define KEY_KP_7 0xE7
139+
#define KEY_KP_8 0xE8
140+
#define KEY_KP_9 0xE9
141+
#define KEY_KP_0 0xEA
142+
#define KEY_KP_DOT 0xEB
143143

144144
// Low level key report: up to 6 keys and shift, ctrl etc at once
145145
typedef struct {

Diff for: libraries/USB/src/keyboardLayout/KeyboardLayout.h

+68-68
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
1-
/*
2-
KeyboardLayout.h
3-
4-
This file is not part of the public API. It is meant to be included
5-
only in Keyboard.cpp and the keyboard layout files. Layout files map
6-
ASCII character codes to keyboard scan codes (technically, to USB HID
7-
Usage codes), possibly altered by the SHIFT or ALT_GR modifiers.
8-
Non-ACSII characters (anything outside the 7-bit range NUL..DEL) are
9-
not supported.
10-
11-
== Creating your own layout ==
12-
13-
In order to create your own layout file, copy an existing layout that
14-
is similar to yours, then modify it to use the correct keys. The
15-
layout is an array in ASCII order. Each entry contains a scan code,
16-
possibly modified by "|SHIFT" or "|ALT_GR", as in this excerpt from
17-
the Italian layout:
18-
19-
0x35, // bslash
20-
0x30|ALT_GR, // ]
21-
0x2e|SHIFT, // ^
22-
23-
Do not change the control characters (those before scan code 0x2c,
24-
corresponding to space). Do not attempt to grow the table past DEL. Do
25-
not use both SHIFT and ALT_GR on the same character: this is not
26-
supported. Unsupported characters should have 0x00 as scan code.
27-
28-
For a keyboard with an ISO physical layout, use the scan codes below:
29-
30-
+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+
31-
|35 |1e |1f |20 |21 |22 |23 |24 |25 |26 |27 |2d |2e |BackSp |
32-
+---+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-----+
33-
| Tab |14 |1a |08 |15 |17 |1c |18 |0c |12 |13 |2f |30 | Ret |
34-
+-----++--++--++--++--++--++--++--++--++--++--++--++--++ |
35-
|CapsL |04 |16 |07 |09 |0a |0b |0d |0e |0f |33 |34 |31 | |
36-
+----+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+---+----+
37-
|Shi.|32 |1d |1b |06 |19 |05 |11 |10 |36 |37 |38 | Shift |
38-
+----+---++--+-+-+---+---+---+---+---+--++---+---++----+----+
39-
|Ctrl|Win |Alt | |AlGr|Win |Menu|Ctrl|
40-
+----+----+----+------------------------+----+----+----+----+
41-
42-
The ANSI layout is identical except that key 0x31 is above (rather
43-
than next to) Return, and there is not key 0x32.
44-
45-
Give a unique name to the layout array, then declare it in Keyboard.h
46-
with a line of the form:
47-
48-
extern const uint8_t KeyboardLayout_xx_YY[];
49-
50-
== Encoding details ==
51-
52-
All scan codes are less than 0x80, which makes bit 7 available to
53-
signal that a modifier (Shift or AltGr) is needed to generate the
54-
character. With only one exception, keys that are used with modifiers
55-
have scan codes that are less than 0x40. This makes bit 6 available
56-
to signal whether the modifier is Shift or AltGr. The exception is
57-
0x64, the key next next to Left Shift on the ISO layout (and absent
58-
from the ANSI layout). We handle it by replacing its value by 0x32 in
59-
the layout arrays.
60-
*/
61-
62-
#include <Arduino.h>
63-
64-
// Modifier keys for _asciimap[] table (not to be used directly)
65-
#define SHIFT 0x80
66-
#define ALT_GR 0x40
67-
#define ISO_KEY 0x64
68-
#define ISO_REPLACEMENT 0x32
1+
/*
2+
KeyboardLayout.h
3+
4+
This file is not part of the public API. It is meant to be included
5+
only in Keyboard.cpp and the keyboard layout files. Layout files map
6+
ASCII character codes to keyboard scan codes (technically, to USB HID
7+
Usage codes), possibly altered by the SHIFT or ALT_GR modifiers.
8+
Non-ACSII characters (anything outside the 7-bit range NUL..DEL) are
9+
not supported.
10+
11+
== Creating your own layout ==
12+
13+
In order to create your own layout file, copy an existing layout that
14+
is similar to yours, then modify it to use the correct keys. The
15+
layout is an array in ASCII order. Each entry contains a scan code,
16+
possibly modified by "|SHIFT" or "|ALT_GR", as in this excerpt from
17+
the Italian layout:
18+
19+
0x35, // bslash
20+
0x30|ALT_GR, // ]
21+
0x2e|SHIFT, // ^
22+
23+
Do not change the control characters (those before scan code 0x2c,
24+
corresponding to space). Do not attempt to grow the table past DEL. Do
25+
not use both SHIFT and ALT_GR on the same character: this is not
26+
supported. Unsupported characters should have 0x00 as scan code.
27+
28+
For a keyboard with an ISO physical layout, use the scan codes below:
29+
30+
+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+
31+
|35 |1e |1f |20 |21 |22 |23 |24 |25 |26 |27 |2d |2e |BackSp |
32+
+---+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-----+
33+
| Tab |14 |1a |08 |15 |17 |1c |18 |0c |12 |13 |2f |30 | Ret |
34+
+-----++--++--++--++--++--++--++--++--++--++--++--++--++ |
35+
|CapsL |04 |16 |07 |09 |0a |0b |0d |0e |0f |33 |34 |31 | |
36+
+----+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+---+----+
37+
|Shi.|32 |1d |1b |06 |19 |05 |11 |10 |36 |37 |38 | Shift |
38+
+----+---++--+-+-+---+---+---+---+---+--++---+---++----+----+
39+
|Ctrl|Win |Alt | |AlGr|Win |Menu|Ctrl|
40+
+----+----+----+------------------------+----+----+----+----+
41+
42+
The ANSI layout is identical except that key 0x31 is above (rather
43+
than next to) Return, and there is not key 0x32.
44+
45+
Give a unique name to the layout array, then declare it in Keyboard.h
46+
with a line of the form:
47+
48+
extern const uint8_t KeyboardLayout_xx_YY[];
49+
50+
== Encoding details ==
51+
52+
All scan codes are less than 0x80, which makes bit 7 available to
53+
signal that a modifier (Shift or AltGr) is needed to generate the
54+
character. With only one exception, keys that are used with modifiers
55+
have scan codes that are less than 0x40. This makes bit 6 available
56+
to signal whether the modifier is Shift or AltGr. The exception is
57+
0x64, the key next next to Left Shift on the ISO layout (and absent
58+
from the ANSI layout). We handle it by replacing its value by 0x32 in
59+
the layout arrays.
60+
*/
61+
62+
#include <Arduino.h>
63+
64+
// Modifier keys for _asciimap[] table (not to be used directly)
65+
#define SHIFT 0x80
66+
#define ALT_GR 0x40
67+
#define ISO_KEY 0x64
68+
#define ISO_REPLACEMENT 0x32

0 commit comments

Comments
 (0)