Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
USBHID_Types.h
00001 /* Copyright (c) 2010-2011 mbed.org, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without 00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00007 * Software is furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #ifndef USBCLASS_HID_TYPES 00020 #define USBCLASS_HID_TYPES 00021 00022 #include <stdint.h> 00023 00024 /* */ 00025 #define HID_VERSION_1_11 (0x0111) 00026 00027 /* HID Class */ 00028 #define HID_CLASS (3) 00029 #define HID_SUBCLASS_NONE (0) 00030 #define HID_SUBCLASS_BOOT (1) 00031 #define HID_PROTOCOL_NONE (0) 00032 #define HID_PROTOCOL_KEYBOARD (1) 00033 #define HID_PROTOCOL_MOUSE (2) 00034 00035 /* Descriptors */ 00036 #define HID_DESCRIPTOR (33) 00037 #define HID_DESCRIPTOR_LENGTH (0x09) 00038 #define REPORT_DESCRIPTOR (34) 00039 00040 /* Class requests */ 00041 #define GET_REPORT (0x1) 00042 #define GET_IDLE (0x2) 00043 #define SET_REPORT (0x9) 00044 #define SET_IDLE (0xa) 00045 00046 /* HID Class Report Descriptor */ 00047 /* Short items: size is 0, 1, 2 or 3 specifying 0, 1, 2 or 4 (four) bytes */ 00048 /* of data as per HID Class standard */ 00049 00050 /* Main items */ 00051 #define INPUT(size) (0x80 | size) 00052 #define OUTPUT(size) (0x90 | size) 00053 #define FEATURE(size) (0xb0 | size) 00054 #define COLLECTION(size) (0xa0 | size) 00055 #define END_COLLECTION(size) (0xc0 | size) 00056 00057 /* Global items */ 00058 #define USAGE_PAGE(size) (0x04 | size) 00059 #define LOGICAL_MINIMUM(size) (0x14 | size) 00060 #define LOGICAL_MAXIMUM(size) (0x24 | size) 00061 #define PHYSICAL_MINIMUM(size) (0x34 | size) 00062 #define PHYSICAL_MAXIMUM(size) (0x44 | size) 00063 #define UNIT_EXPONENT(size) (0x54 | size) 00064 #define UNIT(size) (0x64 | size) 00065 #define REPORT_SIZE(size) (0x74 | size) 00066 #define REPORT_ID(size) (0x84 | size) 00067 #define REPORT_COUNT(size) (0x94 | size) 00068 #define PUSH(size) (0xa4 | size) 00069 #define POP(size) (0xb4 | size) 00070 00071 /* Local items */ 00072 #define USAGE(size) (0x08 | size) 00073 #define USAGE_MINIMUM(size) (0x18 | size) 00074 #define USAGE_MAXIMUM(size) (0x28 | size) 00075 #define DESIGNATOR_INDEX(size) (0x38 | size) 00076 #define DESIGNATOR_MINIMUM(size) (0x48 | size) 00077 #define DESIGNATOR_MAXIMUM(size) (0x58 | size) 00078 #define STRING_INDEX(size) (0x78 | size) 00079 #define STRING_MINIMUM(size) (0x88 | size) 00080 #define STRING_MAXIMUM(size) (0x98 | size) 00081 #define DELIMITER(size) (0xa8 | size) 00082 00083 /* HID Report */ 00084 /* Where report IDs are used the first byte of 'data' will be the */ 00085 /* report ID and 'length' will include this report ID byte. */ 00086 00087 #define MAX_HID_REPORT_SIZE (64) 00088 00089 typedef struct { 00090 uint32_t length; 00091 uint8_t data[MAX_HID_REPORT_SIZE]; 00092 } HID_REPORT; 00093 00094 #endif
Generated on Sun Jul 17 2022 08:25:33 by 1.7.2