Skip to content

Commit d6eaa08

Browse files
authored
Merge pull request #73 from henrygab/patch-1
Use only unsigned value for array access
2 parents 1ea58a1 + 6bfdc2c commit d6eaa08

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Adafruit_USBD_HID.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ bool Adafruit_USBD_HID::keyboardReport(uint8_t report_id, uint8_t modifier,
177177
bool Adafruit_USBD_HID::keyboardPress(uint8_t report_id, char ch) {
178178
uint8_t keycode[6] = {0};
179179
uint8_t modifier = 0;
180+
uint8_t uch = (uint8_t)ch;
180181

181-
if (_ascii2keycode[ch][0])
182+
if (_ascii2keycode[uch][0])
182183
modifier = KEYBOARD_MODIFIER_LEFTSHIFT;
183-
keycode[0] = _ascii2keycode[ch][1];
184+
keycode[0] = _ascii2keycode[uch][1];
184185

185186
return tud_hid_keyboard_report(report_id, modifier, keycode);
186187
}

0 commit comments

Comments
 (0)