USBDevice
Dependents: QEI_X1_LCD_test3 macnica_test
USBHID/USBHID_Types.h@0:2d8d0b73e1ff, 2013-04-18 (annotated)
- Committer:
- toucyy
- Date:
- Thu Apr 18 07:49:37 2013 +0000
- Revision:
- 0:2d8d0b73e1ff
[mbed] converted /QEI_HelloWorld/USBDevice
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
toucyy | 0:2d8d0b73e1ff | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
toucyy | 0:2d8d0b73e1ff | 2 | * |
toucyy | 0:2d8d0b73e1ff | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
toucyy | 0:2d8d0b73e1ff | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
toucyy | 0:2d8d0b73e1ff | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
toucyy | 0:2d8d0b73e1ff | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
toucyy | 0:2d8d0b73e1ff | 7 | * Software is furnished to do so, subject to the following conditions: |
toucyy | 0:2d8d0b73e1ff | 8 | * |
toucyy | 0:2d8d0b73e1ff | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
toucyy | 0:2d8d0b73e1ff | 10 | * substantial portions of the Software. |
toucyy | 0:2d8d0b73e1ff | 11 | * |
toucyy | 0:2d8d0b73e1ff | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
toucyy | 0:2d8d0b73e1ff | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
toucyy | 0:2d8d0b73e1ff | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
toucyy | 0:2d8d0b73e1ff | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
toucyy | 0:2d8d0b73e1ff | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
toucyy | 0:2d8d0b73e1ff | 17 | */ |
toucyy | 0:2d8d0b73e1ff | 18 | |
toucyy | 0:2d8d0b73e1ff | 19 | #ifndef USBCLASS_HID_TYPES |
toucyy | 0:2d8d0b73e1ff | 20 | #define USBCLASS_HID_TYPES |
toucyy | 0:2d8d0b73e1ff | 21 | |
toucyy | 0:2d8d0b73e1ff | 22 | #include <stdint.h> |
toucyy | 0:2d8d0b73e1ff | 23 | |
toucyy | 0:2d8d0b73e1ff | 24 | /* */ |
toucyy | 0:2d8d0b73e1ff | 25 | #define HID_VERSION_1_11 (0x0111) |
toucyy | 0:2d8d0b73e1ff | 26 | |
toucyy | 0:2d8d0b73e1ff | 27 | /* HID Class */ |
toucyy | 0:2d8d0b73e1ff | 28 | #define HID_CLASS (3) |
toucyy | 0:2d8d0b73e1ff | 29 | #define HID_SUBCLASS_NONE (0) |
toucyy | 0:2d8d0b73e1ff | 30 | #define HID_PROTOCOL_NONE (0) |
toucyy | 0:2d8d0b73e1ff | 31 | |
toucyy | 0:2d8d0b73e1ff | 32 | /* Descriptors */ |
toucyy | 0:2d8d0b73e1ff | 33 | #define HID_DESCRIPTOR (33) |
toucyy | 0:2d8d0b73e1ff | 34 | #define HID_DESCRIPTOR_LENGTH (0x09) |
toucyy | 0:2d8d0b73e1ff | 35 | #define REPORT_DESCRIPTOR (34) |
toucyy | 0:2d8d0b73e1ff | 36 | |
toucyy | 0:2d8d0b73e1ff | 37 | /* Class requests */ |
toucyy | 0:2d8d0b73e1ff | 38 | #define GET_REPORT (0x1) |
toucyy | 0:2d8d0b73e1ff | 39 | #define GET_IDLE (0x2) |
toucyy | 0:2d8d0b73e1ff | 40 | #define SET_REPORT (0x9) |
toucyy | 0:2d8d0b73e1ff | 41 | #define SET_IDLE (0xa) |
toucyy | 0:2d8d0b73e1ff | 42 | |
toucyy | 0:2d8d0b73e1ff | 43 | /* HID Class Report Descriptor */ |
toucyy | 0:2d8d0b73e1ff | 44 | /* Short items: size is 0, 1, 2 or 3 specifying 0, 1, 2 or 4 (four) bytes */ |
toucyy | 0:2d8d0b73e1ff | 45 | /* of data as per HID Class standard */ |
toucyy | 0:2d8d0b73e1ff | 46 | |
toucyy | 0:2d8d0b73e1ff | 47 | /* Main items */ |
toucyy | 0:2d8d0b73e1ff | 48 | #define INPUT(size) (0x80 | size) |
toucyy | 0:2d8d0b73e1ff | 49 | #define OUTPUT(size) (0x90 | size) |
toucyy | 0:2d8d0b73e1ff | 50 | #define FEATURE(size) (0xb0 | size) |
toucyy | 0:2d8d0b73e1ff | 51 | #define COLLECTION(size) (0xa0 | size) |
toucyy | 0:2d8d0b73e1ff | 52 | #define END_COLLECTION(size) (0xc0 | size) |
toucyy | 0:2d8d0b73e1ff | 53 | |
toucyy | 0:2d8d0b73e1ff | 54 | /* Global items */ |
toucyy | 0:2d8d0b73e1ff | 55 | #define USAGE_PAGE(size) (0x04 | size) |
toucyy | 0:2d8d0b73e1ff | 56 | #define LOGICAL_MINIMUM(size) (0x14 | size) |
toucyy | 0:2d8d0b73e1ff | 57 | #define LOGICAL_MAXIMUM(size) (0x24 | size) |
toucyy | 0:2d8d0b73e1ff | 58 | #define PHYSICAL_MINIMUM(size) (0x34 | size) |
toucyy | 0:2d8d0b73e1ff | 59 | #define PHYSICAL_MAXIMUM(size) (0x44 | size) |
toucyy | 0:2d8d0b73e1ff | 60 | #define UNIT_EXPONENT(size) (0x54 | size) |
toucyy | 0:2d8d0b73e1ff | 61 | #define UNIT(size) (0x64 | size) |
toucyy | 0:2d8d0b73e1ff | 62 | #define REPORT_SIZE(size) (0x74 | size) |
toucyy | 0:2d8d0b73e1ff | 63 | #define REPORT_ID(size) (0x84 | size) |
toucyy | 0:2d8d0b73e1ff | 64 | #define REPORT_COUNT(size) (0x94 | size) |
toucyy | 0:2d8d0b73e1ff | 65 | #define PUSH(size) (0xa4 | size) |
toucyy | 0:2d8d0b73e1ff | 66 | #define POP(size) (0xb4 | size) |
toucyy | 0:2d8d0b73e1ff | 67 | |
toucyy | 0:2d8d0b73e1ff | 68 | /* Local items */ |
toucyy | 0:2d8d0b73e1ff | 69 | #define USAGE(size) (0x08 | size) |
toucyy | 0:2d8d0b73e1ff | 70 | #define USAGE_MINIMUM(size) (0x18 | size) |
toucyy | 0:2d8d0b73e1ff | 71 | #define USAGE_MAXIMUM(size) (0x28 | size) |
toucyy | 0:2d8d0b73e1ff | 72 | #define DESIGNATOR_INDEX(size) (0x38 | size) |
toucyy | 0:2d8d0b73e1ff | 73 | #define DESIGNATOR_MINIMUM(size) (0x48 | size) |
toucyy | 0:2d8d0b73e1ff | 74 | #define DESIGNATOR_MAXIMUM(size) (0x58 | size) |
toucyy | 0:2d8d0b73e1ff | 75 | #define STRING_INDEX(size) (0x78 | size) |
toucyy | 0:2d8d0b73e1ff | 76 | #define STRING_MINIMUM(size) (0x88 | size) |
toucyy | 0:2d8d0b73e1ff | 77 | #define STRING_MAXIMUM(size) (0x98 | size) |
toucyy | 0:2d8d0b73e1ff | 78 | #define DELIMITER(size) (0xa8 | size) |
toucyy | 0:2d8d0b73e1ff | 79 | |
toucyy | 0:2d8d0b73e1ff | 80 | /* HID Report */ |
toucyy | 0:2d8d0b73e1ff | 81 | /* Where report IDs are used the first byte of 'data' will be the */ |
toucyy | 0:2d8d0b73e1ff | 82 | /* report ID and 'length' will include this report ID byte. */ |
toucyy | 0:2d8d0b73e1ff | 83 | |
toucyy | 0:2d8d0b73e1ff | 84 | #define MAX_HID_REPORT_SIZE (64) |
toucyy | 0:2d8d0b73e1ff | 85 | |
toucyy | 0:2d8d0b73e1ff | 86 | typedef struct { |
toucyy | 0:2d8d0b73e1ff | 87 | uint32_t length; |
toucyy | 0:2d8d0b73e1ff | 88 | uint8_t data[MAX_HID_REPORT_SIZE]; |
toucyy | 0:2d8d0b73e1ff | 89 | } HID_REPORT; |
toucyy | 0:2d8d0b73e1ff | 90 | |
toucyy | 0:2d8d0b73e1ff | 91 | #endif |