From 58c36f76d51d1fe4859140acf5c9c056b4204da5 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Mon, 26 Mar 2012 17:28:02 -0400 Subject: added methods to Keyboard to handle multiple simultaneous key presses or releases (up to six each) --- cores/arduino/HID.cpp | 92 ++++++++++++++++++++++++++++++++++++++++++++------ cores/arduino/USBAPI.h | 15 ++++++++ 2 files changed, 96 insertions(+), 11 deletions(-) (limited to 'cores/arduino') diff --git a/cores/arduino/HID.cpp b/cores/arduino/HID.cpp index b0ef6e3..b556223 100644 --- a/cores/arduino/HID.cpp +++ b/cores/arduino/HID.cpp @@ -467,17 +467,6 @@ size_t Keyboard_::press(uint8_t k) // it shouldn't be repeated any more. size_t Keyboard_::release(uint8_t k) { - /* - uint8_t i; - k = pgm_read_byte(_asciimap + k); - if (!k) { - return 0; - } - if (k & 0x80) { - _keyReport.modifiers |= 0x02; // the left shift modifier - k &= 0x7F; - } - */ uint8_t i; if (k >= 136) { // it's a non-printing key (not a modifier) k = k - 136; @@ -509,6 +498,87 @@ size_t Keyboard_::release(uint8_t k) return 1; } +size_t Keyboard_::press(uint8_t k[], uint8_t len) { + uint8_t i; + uint8_t result = 0; + for (i=0; i