Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef _HID_H_
00051 #define _HID_H_
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 #define HID_DESCRIPTOR 0x21
00063 #define HID_REPORT_DESCRIPTOR 0x22
00064 #define HID_PHYSICAL_DESCRIPTOR 0x23
00065
00066
00067
00068
00069
00070 #define HID_BDC 0x0111 //!< Numeric expression identifying the HID Class Specification release (here V1.11)
00071 #define HID_CLASS_DESC_NB_DEFAULT 0x01 //!< Numeric expression specifying the number of class descriptors (always at least one i.e. Report descriptor.)
00072
00073
00074
00075
00076
00077 #define HID_COUNTRY_CODE_NOT_SUPPORTED 0
00078 #define HID_COUNTRY_CODE_ARABIC 1
00079 #define HID_COUNTRY_CODE_BELGIAN 2
00080 #define HID_COUNTRY_CODE_CANADIAN_BILINGUAL 3
00081 #define HID_COUNTRY_CODE_CANADIAN_FRENCH 4
00082 #define HID_COUNTRY_CODE_CZECH_REPUBLIC 5
00083 #define HID_COUNTRY_CODE_DANISH 6
00084 #define HID_COUNTRY_CODE_FINNISH 7
00085 #define HID_COUNTRY_CODE_FRENCH 8
00086 #define HID_COUNTRY_CODE_GERMAN 9
00087 #define HID_COUNTRY_CODE_GREEK 10
00088 #define HID_COUNTRY_CODE_HEBREW 11
00089 #define HID_COUNTRY_CODE_HUNGARY 12
00090 #define HID_COUNTRY_CODE_INTERNATIONAL_ISO 13
00091 #define HID_COUNTRY_CODE_ITALIAN 14
00092 #define HID_COUNTRY_CODE_JAPAN_KATAKANA 15
00093 #define HID_COUNTRY_CODE_KOREAN 16
00094 #define HID_COUNTRY_CODE_LATIN_AMERICAN 17
00095 #define HID_COUNTRY_CODE_NETHERLANDS_DUTCH 18
00096 #define HID_COUNTRY_CODE_NORWEGIAN 19
00097 #define HID_COUNTRY_CODE_PERSIAN_FARSI 20
00098 #define HID_COUNTRY_CODE_POLAND 21
00099 #define HID_COUNTRY_CODE_PORTUGUESE 22
00100 #define HID_COUNTRY_CODE_RUSSIA 23
00101 #define HID_COUNTRY_CODE_SLOVAKIA 24
00102 #define HID_COUNTRY_CODE_SPANISH 25
00103 #define HID_COUNTRY_CODE_SWEDISH 26
00104 #define HID_COUNTRY_CODE_SWISS_FRENCH 27
00105 #define HID_COUNTRY_CODE_SWISS_GERMAN 28
00106 #define HID_COUNTRY_CODE_SWITZERLAND 29
00107 #define HID_COUNTRY_CODE_TAIWAN 30
00108 #define HID_COUNTRY_CODE_TURKISH_Q 31
00109 #define HID_COUNTRY_CODE_UK 32
00110 #define HID_COUNTRY_CODE_US 33
00111 #define HID_COUNTRY_CODE_YUGOSLAVIA 34
00112 #define HID_COUNTRY_CODE_TURKISH_F 35
00113
00114
00115
00116
00117 #define HID_A 4
00118 #define HID_B 5
00119 #define HID_C 6
00120 #define HID_D 7
00121 #define HID_E 8
00122 #define HID_F 9
00123 #define HID_G 10
00124 #define HID_H 11
00125 #define HID_I 12
00126 #define HID_J 13
00127 #define HID_K 14
00128 #define HID_L 15
00129 #define HID_M 16
00130 #define HID_N 17
00131 #define HID_O 18
00132 #define HID_P 19
00133 #define HID_Q 20
00134 #define HID_R 21
00135 #define HID_S 22
00136 #define HID_T 23
00137 #define HID_U 24
00138 #define HID_V 25
00139 #define HID_W 26
00140 #define HID_X 27
00141 #define HID_Y 28
00142 #define HID_Z 29
00143 #define HID_1 30
00144 #define HID_2 31
00145 #define HID_3 32
00146 #define HID_4 33
00147 #define HID_5 34
00148 #define HID_6 35
00149 #define HID_7 36
00150 #define HID_8 37
00151 #define HID_9 38
00152 #define HID_0 39
00153 #define HID_ENTER 40
00154 #define HID_ESCAPE 41
00155 #define HID_BACKSPACE 42
00156 #define HID_TAB 43
00157 #define HID_SPACEBAR 44
00158 #define HID_UNDERSCORE 45
00159 #define HID_PLUS 46
00160
00161
00162
00163
00164 #define HID_BACKSLASH 49
00165
00166
00167
00168
00169
00170 #define HID_TILDE 53
00171 #define HID_COMMA 54
00172 #define HID_DOT 55
00173 #define HID_SLASH 56
00174 #define HID_CAPS LOCK 57
00175 #define HID_F1 58
00176 #define HID_F2 59
00177 #define HID_F3 60
00178 #define HID_F4 61
00179 #define HID_F5 62
00180 #define HID_F6 63
00181 #define HID_F7 64
00182 #define HID_F8 65
00183 #define HID_F9 66
00184 #define HID_F10 67
00185 #define HID_F11 68
00186 #define HID_F12 69
00187 #define HID_PRINTSCREEN 70
00188 #define HID_SCROLL LOCK 71
00189 #define HID_PAUSE 72
00190 #define HID_INSERT 73
00191 #define HID_HOME 74
00192 #define HID_PAGEUP 75
00193 #define HID_DELETE 76
00194 #define HID_END 77
00195 #define HID_PAGEDOWN 78
00196 #define HID_RIGHT 79
00197 #define HID_LEFT 80
00198 #define HID_DOWN 81
00199 #define HID_UP 82
00200 #define HID_KEYPAD_NUM_LOCK 83
00201 #define HID_KEYPAD_DIVIDE 84
00202 #define HID_KEYPAD_AT 85
00203 #define HID_KEYPAD_MULTIPLY 85
00204 #define HID_KEYPAD_MINUS 86
00205 #define HID_KEYPAD_PLUS 87
00206 #define HID_KEYPAD_ENTER 88
00207 #define HID_KEYPAD_1 89
00208 #define HID_KEYPAD_2 90
00209 #define HID_KEYPAD_3 91
00210 #define HID_KEYPAD_4 92
00211 #define HID_KEYPAD_5 93
00212 #define HID_KEYPAD_6 94
00213 #define HID_KEYPAD_7 95
00214 #define HID_KEYPAD_8 96
00215 #define HID_KEYPAD_9 97
00216 #define HID_KEYPAD_0 98
00217
00218
00219
00220 #define HID_MODIFIER_NONE 0x00
00221 #define HID_MODIFIER_LEFT_CTRL 0x01
00222 #define HID_MODIFIER_LEFT_SHIFT 0x02
00223 #define HID_MODIFIER_LEFT_ALT 0x04
00224 #define HID_MODIFIER_LEFT_GUI 0x08
00225 #define HID_MODIFIER_RIGHT_CTRL 0x10
00226 #define HID_MODIFIER_RIGHT_SHIFT 0x20
00227 #define HID_MODIFIER_RIGHT_ALT 0x40
00228 #define HID_MODIFIER_RIGHT_GUI 0x80
00229
00230
00231
00232
00233
00234
00235 #define HID_GET_REPORT 0x01
00236 #define HID_GET_IDLE 0x02
00237 #define HID_GET_PROTOCOL 0x03
00238 #define HID_SET_REPORT 0x09
00239 #define HID_SET_IDLE 0x0A
00240 #define HID_SET_PROTOCOL 0x0B
00241
00242
00243
00244
00245
00246 #define HID_REPORT_INPUT 0x01
00247 #define HID_REPORT_OUTPUT 0x02
00248 #define HID_REPORT_FEATURE 0x03
00249
00250
00251
00252
00253
00254 #define HID_REPORT_ID_ALL 0x00
00255
00256
00257
00258
00259
00260 #define HID_IDLE_DURATION_INDEFINITE 0x00
00261
00262
00263
00264
00265
00266 #define HID_BOOT_PROTOCOL 0x00
00267 #define HID_REPORT_PROTOCOL 0x01
00268
00269
00270
00271
00272
00273 #define HID_ITEM_TYPE_MAIN 0x00
00274 #define HID_ITEM_TYPE_GLOBAL 0x01
00275 #define HID_ITEM_TYPE_LOCAL 0x02
00276 #define HID_ITEM_TYPE_RESERVED 0x03
00277
00278
00279
00280
00281
00282 #define HID_ITEM_TAG_LONG_ITEM 0x0F
00283
00284
00285
00286
00287
00288 #define HID_MAIN_ITEM_TAG_INPUT 0x08
00289 #define HID_MAIN_ITEM_TAG_OUTPUT 0x09
00290 #define HID_MAIN_ITEM_TAG_FEATURE 0x0B
00291 #define HID_MAIN_ITEM_TAG_COLLECTION 0x0A
00292 #define HID_MAIN_ITEM_TAG_END_COLLECTION 0x0C
00293
00294
00295
00296
00297
00298 #define HID_GLOBAL_ITEM_TAG_USAGE_PAGE 0x00
00299 #define HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM 0x01
00300 #define HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM 0x02
00301 #define HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM 0x03
00302 #define HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM 0x04
00303 #define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT 0x05
00304 #define HID_GLOBAL_ITEM_TAG_UNIT 0x06
00305 #define HID_GLOBAL_ITEM_TAG_REPORT_SIZE 0x07
00306 #define HID_GLOBAL_ITEM_TAG_REPORT_ID 0x08
00307 #define HID_GLOBAL_ITEM_TAG_REPORT_COUNT 0x09
00308 #define HID_GLOBAL_ITEM_TAG_PUSH 0x0A
00309 #define HID_GLOBAL_ITEM_TAG_POP 0x0B
00310
00311
00312
00313
00314
00315 #define HID_LOCAL_ITEM_TAG_USAGE 0x00
00316 #define HID_LOCAL_ITEM_TAG_USAGE_MINIMUM 0x01
00317 #define HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM 0x02
00318 #define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX 0x03
00319 #define HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM 0x04
00320 #define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM 0x05
00321 #define HID_LOCAL_ITEM_TAG_STRING_INDEX 0x07
00322 #define HID_LOCAL_ITEM_TAG_STRING_MINIMUM 0x08
00323 #define HID_LOCAL_ITEM_TAG_STRING_MAXIMUM 0x09
00324 #define HID_LOCAL_ITEM_TAG_DELIMITER 0x0A
00325
00326
00327
00328
00329
00330
00331 typedef
00332 #if (defined __ICCAVR32__)
00333 #pragma pack(1)
00334 #endif
00335 struct
00336 #if (defined __GNUC__)
00337 __attribute__((__packed__))
00338 #endif
00339 {
00340 unsigned char bLength;
00341 unsigned char bDescriptorType;
00342 unsigned short bcdHID;
00343 unsigned char bCountryCode;
00344 unsigned char bNumDescriptors;
00345 struct
00346 #if (defined __GNUC__)
00347 __attribute__((__packed__))
00348 #endif
00349 {
00350 unsigned char bType;
00351 unsigned short wLength;
00352 } Descriptor[];
00353 }
00354 #if (defined __ICCAVR32__)
00355 #pragma pack()
00356 #endif
00357 hid_descriptor_t;
00358
00359
00360 typedef unsigned char hid_report_id_t;
00361
00362
00363 typedef
00364 #if (defined __ICCAVR32__)
00365 #pragma pack(1)
00366 #endif
00367 union
00368 #if (defined __GNUC__)
00369 __attribute__((__packed__))
00370 #endif
00371 {
00372 struct
00373 #if (defined __GNUC__)
00374 __attribute__((__packed__))
00375 #endif
00376 {
00377 unsigned char bTag : 4;
00378 unsigned char bType : 2;
00379 unsigned char bSize : 2;
00380 } header;
00381 struct
00382 #if (defined __GNUC__)
00383 __attribute__((__packed__))
00384 #endif
00385 {
00386 unsigned char bTag : 4;
00387 unsigned char bType : 2;
00388 unsigned char bSize : 2;
00389 unsigned char data[];
00390 } short_format;
00391 struct
00392 #if (defined __GNUC__)
00393 __attribute__((__packed__))
00394 #endif
00395 {
00396 unsigned char bTag : 4;
00397 unsigned char bType : 2;
00398 unsigned char bSize : 2;
00399 unsigned char bDataSize;
00400 unsigned char bLongItemTag;
00401 unsigned char data[];
00402 } long_format;
00403 }
00404 #if (defined __ICCAVR32__)
00405 #pragma pack()
00406 #endif
00407 hid_item_t;
00408
00409
00410 typedef union
00411 {
00412 unsigned long value;
00413 union
00414 {
00415 struct
00416 {
00417 unsigned int : 23;
00418 unsigned int buffered_bytes : 1;
00419 unsigned int : 1;
00420 unsigned int null_state : 1;
00421 unsigned int no_preferred : 1;
00422 unsigned int non_linear : 1;
00423 unsigned int wrap : 1;
00424 unsigned int relative : 1;
00425 unsigned int variable : 1;
00426 unsigned int constant : 1;
00427 } input;
00428 struct
00429 {
00430 unsigned int : 23;
00431 unsigned int buffered_bytes : 1;
00432 unsigned int volatile_ : 1;
00433 unsigned int null_state : 1;
00434 unsigned int no_preferred : 1;
00435 unsigned int non_linear : 1;
00436 unsigned int wrap : 1;
00437 unsigned int relative : 1;
00438 unsigned int variable : 1;
00439 unsigned int constant : 1;
00440 } output;
00441 struct
00442 {
00443 unsigned int : 23;
00444 unsigned int buffered_bytes : 1;
00445 unsigned int volatile_ : 1;
00446 unsigned int null_state : 1;
00447 unsigned int no_preferred : 1;
00448 unsigned int non_linear : 1;
00449 unsigned int wrap : 1;
00450 unsigned int relative : 1;
00451 unsigned int variable : 1;
00452 unsigned int constant : 1;
00453 } feature;
00454 enum
00455 {
00456 HID_COLLECTION_PHYSICAL = 0x00,
00457 HID_COLLECTION_APPLICATION = 0x01,
00458 HID_COLLECTION_LOGICAL = 0x02,
00459 HID_COLLECTION_REPORT = 0x03,
00460 HID_COLLECTION_NAMED_ARRAY = 0x04,
00461 HID_COLLECTION_USAGE_SWITCH = 0x05,
00462 HID_COLLECTION_USAGE_MODIFIER = 0x06
00463 } collection;
00464 } main;
00465 union
00466 {
00467 unsigned int usage_page;
00468 int logical_minimum;
00469 int logical_maximum;
00470 int physical_minimum;
00471 int physical_maximum;
00472 struct
00473 {
00474 unsigned int : 28;
00475 int unit_exponent : 4;
00476 };
00477 struct
00478 {
00479 unsigned int : 4;
00480 enum
00481 {
00482 HID_UNIT_LUMINOUS_INTENSITY_NONE = 0x0,
00483 HID_UNIT_LUMINOUS_INTENSITY_CANDELA = 0x1
00484 } luminous_intensity : 4;
00485 enum
00486 {
00487 HID_UNIT_CURRENT_NONE = 0x0,
00488 HID_UNIT_CURRENT_AMPERE = 0x1
00489 } current : 4;
00490 enum
00491 {
00492 HID_UNIT_TEMPERATURE_NONE = 0x0,
00493 HID_UNIT_TEMPERATURE_KELVIN = 0x1,
00494 HID_UNIT_TEMPERATURE_FAHRENHEIT = 0x3
00495 } temperature : 4;
00496 enum
00497 {
00498 HID_UNIT_TIME_NONE = 0x0,
00499 HID_UNIT_TIME_SECONDS = 0x1
00500 } time : 4;
00501 enum
00502 {
00503 HID_UNIT_MASS_NONE = 0x0,
00504 HID_UNIT_MASS_GRAM = 0x1,
00505 HID_UNIT_MASS_SLUG = 0x3
00506 } mass : 4;
00507 enum
00508 {
00509 HID_UNIT_LENGTH_NONE = 0x0,
00510 HID_UNIT_LENGTH_CENTIMETER = 0x1,
00511 HID_UNIT_LENGTH_RADIANS = 0x2,
00512 HID_UNIT_LENGTH_INCH = 0x3,
00513 HID_UNIT_LENGTH_DEGREES = 0x4
00514 } length : 4;
00515 enum
00516 {
00517 HID_UNIT_SYSTEM_NONE = 0x0,
00518 HID_UNIT_SYSTEM_SI_LINEAR = 0x1,
00519 HID_UNIT_SYSTEM_SI_ROTATION = 0x2,
00520 HID_UNIT_SYSTEM_ENGLISH_LINEAR = 0x3,
00521 HID_UNIT_SYSTEM_ENGLISH_ROTATION = 0x4
00522 } system : 4;
00523 } unit;
00524 unsigned int report_size;
00525 unsigned int report_id;
00526 unsigned int report_count;
00527 } global;
00528 union
00529 {
00530 unsigned int usage;
00531 unsigned int usage_minimum;
00532 unsigned int usage_maximum;
00533 unsigned int designator_index;
00534 unsigned int designator_minimum;
00535 unsigned int designator_maximum;
00536 unsigned int string_index;
00537 unsigned int string_minimum;
00538 unsigned int string_maximum;
00539 enum
00540 {
00541 HID_DELIMITER_OPEN_SET = 0x01,
00542 HID_DELIMITER_CLOSE_SET = 0x00
00543 } delimiter;
00544 } local;
00545 } hid_short_item_data_t;
00546
00547
00548
00549
00550
00551 #endif // _HID_H_