Mbed OS Reference
Loading...
Searching...
No Matches
USBHID_Types.h
1
/*
2
* Copyright (c) 2018-2019, Arm Limited and affiliates.
3
* SPDX-License-Identifier: Apache-2.0
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
#ifndef USBCLASS_HID_TYPES
19
#define USBCLASS_HID_TYPES
20
21
#include <stdint.h>
22
23
/* */
24
#define HID_VERSION_1_11 (0x0111)
25
26
/* HID Class */
27
#define HID_CLASS (3)
28
#define HID_SUBCLASS_NONE (0)
29
#define HID_SUBCLASS_BOOT (1)
30
#define HID_PROTOCOL_NONE (0)
31
#define HID_PROTOCOL_KEYBOARD (1)
32
#define HID_PROTOCOL_MOUSE (2)
33
34
/* Descriptors */
35
#define HID_DESCRIPTOR (33)
36
#define HID_DESCRIPTOR_LENGTH (0x09)
37
#define REPORT_DESCRIPTOR (34)
38
39
/* Class requests */
40
#define GET_REPORT (0x1)
41
#define GET_IDLE (0x2)
42
#define SET_REPORT (0x9)
43
#define SET_IDLE (0xa)
44
45
/* HID Class Report Descriptor */
46
/* Short items: size is 0, 1, 2 or 3 specifying 0, 1, 2 or 4 (four) bytes */
47
/* of data as per HID Class standard */
48
49
/* Main items */
50
#define INPUT(size) (0x80 | size)
51
#define OUTPUT(size) (0x90 | size)
52
#define FEATURE(size) (0xb0 | size)
53
#define COLLECTION(size) (0xa0 | size)
54
#define END_COLLECTION(size) (0xc0 | size)
55
56
/* Global items */
57
#define USAGE_PAGE(size) (0x04 | size)
58
#define LOGICAL_MINIMUM(size) (0x14 | size)
59
#define LOGICAL_MAXIMUM(size) (0x24 | size)
60
#define PHYSICAL_MINIMUM(size) (0x34 | size)
61
#define PHYSICAL_MAXIMUM(size) (0x44 | size)
62
#define UNIT_EXPONENT(size) (0x54 | size)
63
#define UNIT(size) (0x64 | size)
64
#define REPORT_SIZE(size) (0x74 | size)
65
#define REPORT_ID(size) (0x84 | size)
66
#define REPORT_COUNT(size) (0x94 | size)
67
#define PUSH(size) (0xa4 | size)
68
#define POP(size) (0xb4 | size)
69
70
/* Local items */
71
#define USAGE(size) (0x08 | size)
72
#define USAGE_MINIMUM(size) (0x18 | size)
73
#define USAGE_MAXIMUM(size) (0x28 | size)
74
#define DESIGNATOR_INDEX(size) (0x38 | size)
75
#define DESIGNATOR_MINIMUM(size) (0x48 | size)
76
#define DESIGNATOR_MAXIMUM(size) (0x58 | size)
77
#define STRING_INDEX(size) (0x78 | size)
78
#define STRING_MINIMUM(size) (0x88 | size)
79
#define STRING_MAXIMUM(size) (0x98 | size)
80
#define DELIMITER(size) (0xa8 | size)
81
82
/* HID Report */
83
/* Where report IDs are used the first byte of 'data' will be the */
84
/* report ID and 'length' will include this report ID byte. */
85
86
#define MAX_HID_REPORT_SIZE (64)
87
88
typedef
struct
{
89
uint32_t length;
90
uint8_t data[MAX_HID_REPORT_SIZE];
91
}
HID_REPORT
;
92
93
#endif
HID_REPORT
Definition:
USBHID_Types.h:88
drivers
usb
include
usb
internal
USBHID_Types.h
Generated by
1.9.5