00001 /* ---------------------------------------------------------------------------- */ 00002 /* Atmel Microcontroller Software Support */ 00003 /* SAM Software Package License */ 00004 /* ---------------------------------------------------------------------------- */ 00005 /* Copyright (c) 2015, Atmel Corporation */ 00006 /* */ 00007 /* All rights reserved. */ 00008 /* */ 00009 /* Redistribution and use in source and binary forms, with or without */ 00010 /* modification, are permitted provided that the following condition is met: */ 00011 /* */ 00012 /* - Redistributions of source code must retain the above copyright notice, */ 00013 /* this list of conditions and the disclaimer below. */ 00014 /* */ 00015 /* Atmel's name may not be used to endorse or promote products derived from */ 00016 /* this software without specific prior written permission. */ 00017 /* */ 00018 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ 00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ 00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ 00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ 00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ 00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ 00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ 00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00028 /* ---------------------------------------------------------------------------- */ 00029 00030 /**\file 00031 * 00032 * \section Purpose 00033 * 00034 * Definitions used for declaring the usages of a HID device. 00035 * 00036 */ 00037 00038 #ifndef _HIDUSAGES_H_ 00039 #define _HIDUSAGES_H_ 00040 /** \addtogroup usb_hid 00041 *@{ 00042 */ 00043 00044 /*---------------------------------------------------------------------------- 00045 * Includes 00046 *----------------------------------------------------------------------------*/ 00047 00048 #include <stdint.h> 00049 00050 00051 /*---------------------------------------------------------------------------- 00052 * Defines 00053 *----------------------------------------------------------------------------*/ 00054 00055 /** \addtogroup usb_hid_usage_pages HID Usage Pages' IDs 00056 * @{ 00057 * (HUT section 3) 00058 */ 00059 00060 /** ID for the HID Generic Desktop Controls. */ 00061 #define HIDUsage_GENERICDESKTOP 1 00062 /** ID for the HID Game Controls. */ 00063 #define HIDUsage_GAME 5 00064 /** ID for the HID Generic Device Controls. */ 00065 #define HIDUsage_GENERICDEVICE 6 00066 /** ID for the HID Keyboard/Keypad */ 00067 #define HIDUsage_KEYBOARD 7 00068 /** ID for the HID LEDs. */ 00069 #define HIDUsage_LEDS 8 00070 /** ID for the HID buttons. */ 00071 #define HIDUsage_BUTTON 9 00072 /** ID for Bar Code Scanner page. */ 00073 #define HIDUsage_BARCODE 0x8C 00074 /** ID for Camera Control Page. */ 00075 #define HIDUsage_CAMERA 0x90 00076 /** ID for vendor-defined controls. */ 00077 #define HIDUsage_VENDOR 0xFF 00078 /** @}*/ 00079 00080 /** \addtogroup usb_hid_genericdesktop_page_id HID GenericDesktop Page ID 00081 * @{ 00082 * 00083 * \section ID 00084 * - HIDGenericDesktop_PAGEID 00085 */ 00086 00087 /** ID for the HID generic desktop usage page. */ 00088 #define HIDGenericDesktop_PAGEID 0x01 00089 /** @}*/ 00090 00091 /** \addtogroup usb_hid_genericdesktop_usages HID GenericDesktop Usages 00092 * @{ 00093 * 00094 * \section Usages 00095 * - HIDGenericDesktop_POINTER 00096 * - HIDGenericDesktop_MOUSE 00097 * - HIDGenericDesktop_JOYSTICK 00098 * - HIDGenericDesktop_GAMEPAD 00099 * - HIDGenericDesktop_KEYBOARD 00100 * - HIDGenericDesktop_KEYPAD 00101 * - HIDGenericDesktop_MULTIAXIS 00102 * - HIDGenericDesktop_X 00103 * - HIDGenericDesktop_Y 00104 */ 00105 00106 /** Pointer usage ID. */ 00107 #define HIDGenericDesktop_POINTER 0x01 00108 /** Mouse usage ID. */ 00109 #define HIDGenericDesktop_MOUSE 0x02 00110 /** Joystick usage ID. */ 00111 #define HIDGenericDesktop_JOYSTICK 0x04 00112 /** Gamepad usage ID. */ 00113 #define HIDGenericDesktop_GAMEPAD 0x05 00114 /** Keyboard usage ID. */ 00115 #define HIDGenericDesktop_KEYBOARD 0x06 00116 /** Keypad usage ID. */ 00117 #define HIDGenericDesktop_KEYPAD 0x07 00118 /** Multi-axis controller usage ID. */ 00119 #define HIDGenericDesktop_MULTIAXIS 0x08 00120 00121 /** Axis Usage X direction ID. */ 00122 #define HIDGenericDesktop_X 0x30 00123 /** Axis Usage Y direction ID. */ 00124 #define HIDGenericDesktop_Y 0x31 00125 /** @}*/ 00126 00127 00128 /** \addtogroup usb_hid_keypad_page_id HID Keypad Page ID 00129 * @{ 00130 * This page lists HID Keypad page ID. 00131 * 00132 * \section ID 00133 * - HIDKeypad_PAGEID 00134 */ 00135 00136 /** Identifier for the HID keypad usage page */ 00137 #define HIDKeypad_PAGEID 0x07 00138 /** @}*/ 00139 00140 /** \addtogroup usb_hid_alphabetic_keys HID Alphabetic Keys 00141 * @{ 00142 * 00143 * \section Keys 00144 * - HIDKeypad_A 00145 * - HIDKeypad_B 00146 * - HIDKeypad_C 00147 * - HIDKeypad_D 00148 * - HIDKeypad_E 00149 * - HIDKeypad_F 00150 * - HIDKeypad_G 00151 * - HIDKeypad_H 00152 * - HIDKeypad_I 00153 * - HIDKeypad_J 00154 * - HIDKeypad_K 00155 * - HIDKeypad_L 00156 * - HIDKeypad_M 00157 * - HIDKeypad_N 00158 * - HIDKeypad_O 00159 * - HIDKeypad_P 00160 * - HIDKeypad_Q 00161 * - HIDKeypad_R 00162 * - HIDKeypad_S 00163 * - HIDKeypad_T 00164 * - HIDKeypad_U 00165 * - HIDKeypad_V 00166 * - HIDKeypad_W 00167 * - HIDKeypad_X 00168 * - HIDKeypad_Y 00169 * - HIDKeypad_Z 00170 */ 00171 00172 /** Key code for 'a' and 'A'. */ 00173 #define HIDKeypad_A 4 00174 /** Key code for 'b' and 'B'. */ 00175 #define HIDKeypad_B 5 00176 /** Key code for 'c' and 'C'. */ 00177 #define HIDKeypad_C 6 00178 /** Key code for 'd' and 'D'. */ 00179 #define HIDKeypad_D 7 00180 /** Key code for 'e' and 'E'. */ 00181 #define HIDKeypad_E 8 00182 /** Key code for 'f' and 'F'. */ 00183 #define HIDKeypad_F 9 00184 /** Key code for 'g' and 'G'. */ 00185 #define HIDKeypad_G 10 00186 /** Key code for 'h' and 'H'. */ 00187 #define HIDKeypad_H 11 00188 /** Key code for 'i' and 'I'. */ 00189 #define HIDKeypad_I 12 00190 /** Key code for 'j' and 'J'. */ 00191 #define HIDKeypad_J 13 00192 /** Key code for 'k' and 'K'. */ 00193 #define HIDKeypad_K 14 00194 /** Key code for 'l' and 'L'. */ 00195 #define HIDKeypad_L 15 00196 /** Key code for 'm' and 'M'. */ 00197 #define HIDKeypad_M 16 00198 /** Key code for 'n' and 'N'. */ 00199 #define HIDKeypad_N 17 00200 /** Key code for 'o' and 'O'. */ 00201 #define HIDKeypad_O 18 00202 /** Key code for 'p' and 'P'. */ 00203 #define HIDKeypad_P 19 00204 /** Key code for 'q' and 'Q'. */ 00205 #define HIDKeypad_Q 20 00206 /** Key code for 'r' and 'R'. */ 00207 #define HIDKeypad_R 21 00208 /** Key code for 's' and 'S'. */ 00209 #define HIDKeypad_S 22 00210 /** Key code for 't' and 'T'. */ 00211 #define HIDKeypad_T 23 00212 /** Key code for 'u' and 'U'. */ 00213 #define HIDKeypad_U 24 00214 /** Key code for 'v' and 'V'. */ 00215 #define HIDKeypad_V 25 00216 /** Key code for 'w' and 'W'. */ 00217 #define HIDKeypad_W 26 00218 /** Key code for 'x' and 'X'. */ 00219 #define HIDKeypad_X 27 00220 /** Key code for 'y' and 'Y'. */ 00221 #define HIDKeypad_Y 28 00222 /** Key code for 'z' and 'Z'. */ 00223 #define HIDKeypad_Z 29 00224 /** @}*/ 00225 00226 /** \addtogroup usb_hid_numeric_keys HID Numeric Keys 00227 * @{ 00228 * 00229 * \section Keys 00230 * - HIDKeypad_1 00231 * - HIDKeypad_2 00232 * - HIDKeypad_3 00233 * - HIDKeypad_4 00234 * - HIDKeypad_5 00235 * - HIDKeypad_6 00236 * - HIDKeypad_7 00237 * - HIDKeypad_8 00238 * - HIDKeypad_9 00239 * - HIDKeypad_0 00240 */ 00241 00242 /** Key code for '1' and '!'. */ 00243 #define HIDKeypad_1 30 00244 /** Key code for '2' and '@'. */ 00245 #define HIDKeypad_2 31 00246 /** Key code for '3' and '#'. */ 00247 #define HIDKeypad_3 32 00248 /** Key code for '4' and '$'. */ 00249 #define HIDKeypad_4 33 00250 /** Key code for '5' and '%'. */ 00251 #define HIDKeypad_5 34 00252 /** Key code for '6' and '^'. */ 00253 #define HIDKeypad_6 35 00254 /** Key code for '7' and '&'. */ 00255 #define HIDKeypad_7 36 00256 /** Key code for '8' and '*'. */ 00257 #define HIDKeypad_8 37 00258 /** Key code for '9' and '('. */ 00259 #define HIDKeypad_9 38 00260 /** Key code for '0' and ')'. */ 00261 #define HIDKeypad_0 39 00262 /** @}*/ 00263 00264 /** \addtogroup usb_hid_special_keys HID Special Keys 00265 * @{ 00266 * 00267 * \section Keys 00268 * - HIDKeypad_ENTER 00269 * - HIDKeypad_ESCAPE 00270 * - HIDKeypad_BACKSPACE 00271 * - HIDKeypad_TAB 00272 * - HIDKeypad_SPACEBAR 00273 * - HIDKeypad_PRINTSCREEN 00274 * - HIDKeypad_SCROLLLOCK 00275 * - HIDKeypad_NUMLOCK 00276 */ 00277 00278 /** Enter key code. */ 00279 #define HIDKeypad_ENTER 40 00280 /** Escape key code. */ 00281 #define HIDKeypad_ESCAPE 41 00282 /** Backspace key code. */ 00283 #define HIDKeypad_BACKSPACE 42 00284 /** Tab key code. */ 00285 #define HIDKeypad_TAB 43 00286 /** Spacebar key code. */ 00287 #define HIDKeypad_SPACEBAR 44 00288 /** Printscreen key code. */ 00289 #define HIDKeypad_PRINTSCREEN 70 00290 /** Scroll lock key code. */ 00291 #define HIDKeypad_SCROLLLOCK 71 00292 /** Num lock key code. */ 00293 #define HIDKeypad_NUMLOCK 83 00294 /** @}*/ 00295 00296 /** \addtogroup usb_hid_modified_keys HID Modified Keys 00297 * @{ 00298 * 00299 * \section Keys 00300 * - HIDKeypad_LEFTCONTROL 00301 * - HIDKeypad_LEFTSHIFT 00302 * - HIDKeypad_LEFTALT 00303 * - HIDKeypad_LEFTGUI 00304 * - HIDKeypad_RIGHTCONTROL 00305 * - HIDKeypad_RIGHTSHIFT 00306 * - HIDKeypad_RIGHTALT 00307 * - HIDKeypad_RIGHTGUI 00308 */ 00309 00310 /** Key code for the left 'Control' key. */ 00311 #define HIDKeypad_LEFTCONTROL 224 00312 /** Key code for the left 'Shift' key. */ 00313 #define HIDKeypad_LEFTSHIFT 225 00314 /** Key code for the left 'Alt' key. */ 00315 #define HIDKeypad_LEFTALT 226 00316 /** Key code for the left 'GUI' (e.g. Windows) key. */ 00317 #define HIDKeypad_LEFTGUI 227 00318 /** Key code for the right 'Control' key. */ 00319 #define HIDKeypad_RIGHTCONTROL 228 00320 /** Key code for the right 'Shift' key. */ 00321 #define HIDKeypad_RIGHTSHIFT 229 00322 /** Key code for the right 'Alt' key. */ 00323 #define HIDKeypad_RIGHTALT 230 00324 /** Key code for the right 'GUI' key. */ 00325 #define HIDKeypad_RIGHTGUI 231 00326 /** @}*/ 00327 00328 /** \addtogroup usb_hid_error_codes HID Error Codes 00329 * @{ 00330 * 00331 * \section Codes 00332 * - HIDKeypad_ERRORROLLOVER 00333 * - HIDKeypad_POSTFAIL 00334 * - HIDKeypad_ERRORUNDEFINED 00335 */ 00336 00337 /** Indicates that too many keys have been pressed at the same time. */ 00338 #define HIDKeypad_ERRORROLLOVER 1 00339 /** postfail */ 00340 #define HIDKeypad_POSTFAIL 2 00341 /** Indicates an undefined error. */ 00342 #define HIDKeypad_ERRORUNDEFINED 3 00343 /** @}*/ 00344 00345 00346 /** \addtogroup usb_hid_leds_page_id HID LEDs Page ID 00347 * @{ 00348 * This page lists the page ID of the HID LEDs usage page. 00349 * 00350 * \section ID 00351 * - HIDLeds_PAGEID 00352 */ 00353 00354 /** ID of the HID LEDs usage page. */ 00355 #define HIDLeds_PAGEID 0x08 00356 /** @}*/ 00357 00358 /** \addtogroup usb_hid_leds_usage HID LEDs Usages 00359 * @{ 00360 * This page lists the Usages of the HID LEDs. 00361 * 00362 * \section Usages 00363 * - HIDLeds_NUMLOCK 00364 * - HIDLeds_CAPSLOCK 00365 * - HIDLeds_SCROLLLOCK 00366 */ 00367 00368 /** Num lock LED usage. */ 00369 #define HIDLeds_NUMLOCK 0x01 00370 /** Caps lock LED usage. */ 00371 #define HIDLeds_CAPSLOCK 0x02 00372 /** Scroll lock LED usage. */ 00373 #define HIDLeds_SCROLLLOCK 0x03 00374 /** @}*/ 00375 00376 00377 /** \addtogroup usb_hid_buttons_page_id HID BUTTONs Page ID 00378 * @{ 00379 */ 00380 /** Identifier for the HID button usage page*/ 00381 #define HIDButton_PAGEID 0x09 00382 /** @}*/ 00383 00384 00385 /*------------------------------------------------------------------------------ 00386 * Exported functions 00387 *------------------------------------------------------------------------------*/ 00388 00389 extern uint8_t HIDKeypad_IsModifierKey(uint8_t key); 00390 00391 /**@}*/ 00392 #endif /* #define _HIDUSAGES_H_ */ 00393