/* Keyboard.h Copyright (c) 2015, Arduino LLC Original code (pre-library): Copyright (c) 2011, Peter Barrett This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef KEYBOARD_h #define KEYBOARD_h #include "HID.h" #define MODIFIER_LEFT_CTRL 0b00000001 #define MODIFIER_LEFT_SHIFT 0b00000010 #define MODIFIER_LEFT_ALT 0b00000100 #define MODIFIER_LEFT_GUI 0b00001000 #define MODIFIER_RIGHT_CTRL 0b00010000 #define MODIFIER_RIGHT_SHIFT 0b00100000 #define MODIFIER_RIGHT_ALT 0b01000000 #define MODIFIER_RIGHT_GUI 0b10000000 typedef struct { uint8_t modifiers; uint8_t reserved; uint8_t keys[6]; } KeyReport; class Keyboard_ : public Print { private: KeyReport _keyReport; void sendReport(KeyReport* keys); public: Keyboard_(void); size_t write(uint8_t k); size_t press(uint8_t k); size_t release(uint8_t k); size_t pressmod(uint8_t m); size_t releasemod(uint8_t m); void releaseAll(void); }; extern Keyboard_ Keyboard; #endif