Modified for PS3 Joystick

Dependents:   NiseKabuto

Fork of USBDevice by Samuel Mokrani

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers USBHID_Types.h Source File

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_PROTOCOL_NONE   (0)
00031 
00032 /* Descriptors */
00033 #define HID_DESCRIPTOR          (33)
00034 #define HID_DESCRIPTOR_LENGTH   (0x09)
00035 #define REPORT_DESCRIPTOR       (34)
00036 
00037 /* Class requests */
00038 #define GET_REPORT (0x1)
00039 #define GET_IDLE   (0x2)
00040 #define SET_REPORT (0x9)
00041 #define SET_IDLE   (0xa)
00042 
00043 /* HID Class Report Descriptor */
00044 /* Short items: size is 0, 1, 2 or 3 specifying 0, 1, 2 or 4 (four) bytes */
00045 /* of data as per HID Class standard */
00046 
00047 /* Main items */
00048 #define INPUT(size)             (0x80 | size)
00049 #define OUTPUT(size)            (0x90 | size)
00050 #define FEATURE(size)           (0xb0 | size)
00051 #define COLLECTION(size)        (0xa0 | size)
00052 #define END_COLLECTION(size)    (0xc0 | size)
00053 
00054 /* Global items */
00055 #define USAGE_PAGE(size)        (0x04 | size)
00056 #define LOGICAL_MINIMUM(size)   (0x14 | size)
00057 #define LOGICAL_MAXIMUM(size)   (0x24 | size)
00058 #define PHYSICAL_MINIMUM(size)  (0x34 | size)
00059 #define PHYSICAL_MAXIMUM(size)  (0x44 | size)
00060 #define UNIT_EXPONENT(size)     (0x54 | size)
00061 #define UNIT(size)              (0x64 | size)
00062 #define REPORT_SIZE(size)       (0x74 | size)
00063 #define REPORT_ID(size)         (0x84 | size)
00064 #define REPORT_COUNT(size)      (0x94 | size)
00065 #define PUSH(size)              (0xa4 | size)
00066 #define POP(size)               (0xb4 | size)
00067 
00068 /* Local items */
00069 #define USAGE(size)                 (0x08 | size)
00070 #define USAGE_MINIMUM(size)         (0x18 | size)
00071 #define USAGE_MAXIMUM(size)         (0x28 | size)
00072 #define DESIGNATOR_INDEX(size)      (0x38 | size)
00073 #define DESIGNATOR_MINIMUM(size)    (0x48 | size)
00074 #define DESIGNATOR_MAXIMUM(size)    (0x58 | size)
00075 #define STRING_INDEX(size)          (0x78 | size)
00076 #define STRING_MINIMUM(size)        (0x88 | size)
00077 #define STRING_MAXIMUM(size)        (0x98 | size)
00078 #define DELIMITER(size)             (0xa8 | size)
00079 
00080 /* HID Report */
00081 /* Where report IDs are used the first byte of 'data' will be the */
00082 /* report ID and 'length' will include this report ID byte. */
00083 
00084 #define MAX_HID_REPORT_SIZE (64)
00085 
00086 typedef struct {
00087     uint32_t length;
00088     uint8_t data[MAX_HID_REPORT_SIZE];
00089 } HID_REPORT;
00090 
00091 #endif