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