From fbea67532a03cbcb35c47209f902797c80c499f7 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Sat, 3 Mar 2012 22:54:45 -0500 Subject: added Keyboard methods press(), release(), and releaseAll() Changes mean that a single, persistent key report must be used so keys can be added or removed. Also reimplemented type() using the new methods. --- cores/arduino/USBAPI.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cores/arduino/USBAPI.h') diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h index 3c97ff1..6615fa8 100644 --- a/cores/arduino/USBAPI.h +++ b/cores/arduino/USBAPI.h @@ -100,12 +100,16 @@ class Keyboard_ : public Print { private: KeyMap* _keyMap; + KeyReport _keyReport; void sendReport(KeyReport* keys); void setKeyMap(KeyMap* keyMap); public: Keyboard_(); - virtual size_t write(uint8_t c) {return type(c);}; - virtual size_t type(uint8_t c); + virtual size_t write(uint8_t k) {return type(k);}; + virtual size_t type(uint8_t k); + virtual size_t press(uint8_t k); + virtual size_t release(uint8_t k); + virtual void releaseAll(void); }; extern Keyboard_ Keyboard; -- cgit v1.2.3-18-g5258