Committer:
chris
Date:
Fri Oct 21 23:02:16 2011 +0000
Revision:
1:4d08e0ebf5dd
Parent:
0:e98d1c2b16c6

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chris 0:e98d1c2b16c6 1 /* USBClass_HID_Types.h */
chris 0:e98d1c2b16c6 2 /* USB HID class type definitions, conversions and constants */
chris 0:e98d1c2b16c6 3 /* Copyright (c) 2011 ARM Limited. All rights reserved. */
chris 0:e98d1c2b16c6 4
chris 0:e98d1c2b16c6 5 #ifndef USBCLASS_HID_TYPES
chris 0:e98d1c2b16c6 6 #define USBCLASS_HID_TYPES
chris 0:e98d1c2b16c6 7
chris 0:e98d1c2b16c6 8 #include <stdint.h>
chris 0:e98d1c2b16c6 9
chris 0:e98d1c2b16c6 10 /* */
chris 0:e98d1c2b16c6 11 #define HID_VERSION_1_11 (0x0111)
chris 0:e98d1c2b16c6 12
chris 0:e98d1c2b16c6 13 /* HID Class */
chris 0:e98d1c2b16c6 14 #define HID_CLASS (3)
chris 0:e98d1c2b16c6 15 #define HID_SUBCLASS_NONE (0)
chris 0:e98d1c2b16c6 16 #define HID_PROTOCOL_NONE (0)
chris 0:e98d1c2b16c6 17
chris 0:e98d1c2b16c6 18 /* Descriptors */
chris 0:e98d1c2b16c6 19 #define HID_DESCRIPTOR (33)
chris 0:e98d1c2b16c6 20 #define HID_DESCRIPTOR_LENGTH (0x09)
chris 0:e98d1c2b16c6 21 #define REPORT_DESCRIPTOR (34)
chris 0:e98d1c2b16c6 22
chris 0:e98d1c2b16c6 23 /* Class requests */
chris 0:e98d1c2b16c6 24 #define GET_REPORT (0x1)
chris 0:e98d1c2b16c6 25 #define GET_IDLE (0x2)
chris 0:e98d1c2b16c6 26 #define SET_REPORT (0x9)
chris 0:e98d1c2b16c6 27 #define SET_IDLE (0xa)
chris 0:e98d1c2b16c6 28
chris 0:e98d1c2b16c6 29 /* HID Class Report Descriptor */
chris 0:e98d1c2b16c6 30 /* Short items: size is 0, 1, 2 or 3 specifying 0, 1, 2 or 4 (four) bytes */
chris 0:e98d1c2b16c6 31 /* of data as per HID Class standard */
chris 0:e98d1c2b16c6 32
chris 0:e98d1c2b16c6 33 /* Main items */
chris 0:e98d1c2b16c6 34 #define INPUT(size) (0x80 | size)
chris 0:e98d1c2b16c6 35 #define OUTPUT(size) (0x90 | size)
chris 0:e98d1c2b16c6 36 #define FEATURE(size) (0xb0 | size)
chris 0:e98d1c2b16c6 37 #define COLLECTION(size) (0xa0 | size)
chris 0:e98d1c2b16c6 38 #define END_COLLECTION(size) (0xc0 | size)
chris 0:e98d1c2b16c6 39
chris 0:e98d1c2b16c6 40 /* Global items */
chris 0:e98d1c2b16c6 41 #define USAGE_PAGE(size) (0x04 | size)
chris 0:e98d1c2b16c6 42 #define LOGICAL_MINIMUM(size) (0x14 | size)
chris 0:e98d1c2b16c6 43 #define LOGICAL_MAXIMUM(size) (0x24 | size)
chris 0:e98d1c2b16c6 44 #define PHYSICAL_MINIMUM(size) (0x34 | size)
chris 0:e98d1c2b16c6 45 #define PHYSICAL_MAXIMUM(size) (0x44 | size)
chris 0:e98d1c2b16c6 46 #define UNIT_EXPONENT(size) (0x54 | size)
chris 0:e98d1c2b16c6 47 #define UNIT(size) (0x64 | size)
chris 0:e98d1c2b16c6 48 #define REPORT_SIZE(size) (0x74 | size)
chris 0:e98d1c2b16c6 49 #define REPORT_ID(size) (0x84 | size)
chris 0:e98d1c2b16c6 50 #define REPORT_COUNT(size) (0x94 | size)
chris 0:e98d1c2b16c6 51 #define PUSH(size) (0xa4 | size)
chris 0:e98d1c2b16c6 52 #define POP(size) (0xb4 | size)
chris 0:e98d1c2b16c6 53
chris 0:e98d1c2b16c6 54 /* Local items */
chris 0:e98d1c2b16c6 55 #define USAGE(size) (0x08 | size)
chris 0:e98d1c2b16c6 56 #define USAGE_MINIMUM(size) (0x18 | size)
chris 0:e98d1c2b16c6 57 #define USAGE_MAXIMUM(size) (0x28 | size)
chris 0:e98d1c2b16c6 58 #define DESIGNATOR_INDEX(size) (0x38 | size)
chris 0:e98d1c2b16c6 59 #define DESIGNATOR_MINIMUM(size) (0x48 | size)
chris 0:e98d1c2b16c6 60 #define DESIGNATOR_MAXIMUM(size) (0x58 | size)
chris 0:e98d1c2b16c6 61 #define STRING_INDEX(size) (0x78 | size)
chris 0:e98d1c2b16c6 62 #define STRING_MINIMUM(size) (0x88 | size)
chris 0:e98d1c2b16c6 63 #define STRING_MAXIMUM(size) (0x98 | size)
chris 0:e98d1c2b16c6 64 #define DELIMITER(size) (0xa8 | size)
chris 0:e98d1c2b16c6 65
chris 0:e98d1c2b16c6 66 /* HID Report */
chris 0:e98d1c2b16c6 67 /* Where report IDs are used the first byte of 'data' will be the */
chris 0:e98d1c2b16c6 68 /* report ID and 'length' will include this report ID byte. */
chris 0:e98d1c2b16c6 69
chris 0:e98d1c2b16c6 70 #define MAX_HID_REPORT_SIZE (64)
chris 0:e98d1c2b16c6 71
chris 0:e98d1c2b16c6 72 typedef struct {
chris 0:e98d1c2b16c6 73 uint32_t length;
chris 0:e98d1c2b16c6 74 uint8_t data[MAX_HID_REPORT_SIZE];
chris 0:e98d1c2b16c6 75 } HID_REPORT;
chris 0:e98d1c2b16c6 76
chris 0:e98d1c2b16c6 77 #endif