USB Device for NUCLEO-F103RB, STM32F103C8T6 and Maple Mini boards
Dependents: MapleMini_USBSerial STM32F103C8T6_USBKeyboard firstDelta STM32F103C8T6_USBSerial ... more
Fork of L152RE_USBDevice by
Diff: USBHID/USBKeyboard.cpp
- Revision:
- 70:a6dcac43ceaf
- Parent:
- 47:a0cd9646ecd1
--- a/USBHID/USBKeyboard.cpp Wed Feb 20 12:41:13 2019 +0000 +++ b/USBHID/USBKeyboard.cpp Mon Mar 16 15:03:30 2020 +0000 @@ -442,7 +442,7 @@ return keyCode(c, keymap[c].modifier); } -bool USBKeyboard::keyCode(uint8_t key, uint8_t modifier) { +bool USBKeyboard::keyCode(uint8_t key, uint8_t modifier /* = 0 */, bool release /* = true */) { // Send a simulated keyboard keypress. Returns true if successful. HID_REPORT report; @@ -462,18 +462,18 @@ return false; } - report.data[1] = 0; - report.data[3] = 0; + if (release) { + report.data[1] = 0; + report.data[3] = 0; - if (!send(&report)) { - return false; + if (!send(&report)) { + return false; + } } return true; - } - bool USBKeyboard::mediaControl(MEDIA_KEY key) { HID_REPORT report;