Select one of the symbols to view example projects that use it.
 
Outline
#define __USBH_HID_H
#include "usbh_core.h"
#include "usbh_hid_mouse.h"
#include "usbh_hid_keybd.h"
#define HID_MIN_POLL
#define HID_REPORT_SIZE
#define HID_MAX_USAGE
#define HID_MAX_NBR_REPORT_FMT
#define HID_QUEUE_SIZE
#define HID_ITEM_LONG
#define HID_ITEM_TYPE_MAIN
#define HID_ITEM_TYPE_GLOBAL
#define HID_ITEM_TYPE_LOCAL
#define HID_ITEM_TYPE_RESERVED
#define HID_MAIN_ITEM_TAG_INPUT
#define HID_MAIN_ITEM_TAG_OUTPUT
#define HID_MAIN_ITEM_TAG_COLLECTION
#define HID_MAIN_ITEM_TAG_FEATURE
#define HID_MAIN_ITEM_TAG_ENDCOLLECTION
#define HID_GLOBAL_ITEM_TAG_USAGE_PAGE
#define HID_GLOBAL_ITEM_TAG_LOG_MIN
#define HID_GLOBAL_ITEM_TAG_LOG_MAX
#define HID_GLOBAL_ITEM_TAG_PHY_MIN
#define HID_GLOBAL_ITEM_TAG_PHY_MAX
#define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT
#define HID_GLOBAL_ITEM_TAG_UNIT
#define HID_GLOBAL_ITEM_TAG_REPORT_SIZE
#define HID_GLOBAL_ITEM_TAG_REPORT_ID
#define HID_GLOBAL_ITEM_TAG_REPORT_COUNT
#define HID_GLOBAL_ITEM_TAG_PUSH
#define HID_GLOBAL_ITEM_TAG_POP
#define HID_LOCAL_ITEM_TAG_USAGE
#define HID_LOCAL_ITEM_TAG_USAGE_MIN
#define HID_LOCAL_ITEM_TAG_USAGE_MAX
#define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX
#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MIN
#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAX
#define HID_LOCAL_ITEM_TAG_STRING_INDEX
#define HID_LOCAL_ITEM_TAG_STRING_MIN
#define HID_LOCAL_ITEM_TAG_STRING_MAX
#define HID_LOCAL_ITEM_TAG_DELIMITER
USBH_HID_StateTypeDef
HID_CtlStateTypeDef
HID_TypeTypeDef
_HID_ReportData
_HID_ReportIDTypeDef
_HID_CollectionTypeDef
_HID_AppCollectionTypeDef
_HIDDescriptor
FIFO_TypeDef
_HID_Process
#define USB_HID_GET_REPORT
#define USB_HID_GET_IDLE
#define USB_HID_GET_PROTOCOL
#define USB_HID_SET_REPORT
#define USB_HID_SET_IDLE
#define USB_HID_SET_PROTOCOL
#define USB_HID_CLASS
#define HID_BOOT_CODE
#define HID_KEYBRD_BOOT_CODE
#define HID_MOUSE_BOOT_CODE
HID_Class;
#define USBH_HID_CLASS
USBH_HID_SetReport(USBH_HandleTypeDef *, uint8_t, uint8_t, uint8_t *, uint8_t);
USBH_HID_GetReport(USBH_HandleTypeDef *, uint8_t, uint8_t, uint8_t *, uint8_t);
USBH_HID_GetHIDReportDescriptor(USBH_HandleTypeDef *, uint16_t);
USBH_HID_GetHIDDescriptor(USBH_HandleTypeDef *, uint16_t);
USBH_HID_SetIdle(USBH_HandleTypeDef *, uint8_t, uint8_t);
USBH_HID_SetProtocol(USBH_HandleTypeDef *, uint8_t);
USBH_HID_EventCallback(USBH_HandleTypeDef *);
USBH_HID_GetDeviceType(USBH_HandleTypeDef *);
USBH_HID_GetPollInterval(USBH_HandleTypeDef *);
USBH_HID_FifoInit(FIFO_TypeDef *, uint8_t *, uint16_t);
USBH_HID_FifoRead(FIFO_TypeDef *, void *, uint16_t);
USBH_HID_FifoWrite(FIFO_TypeDef *, void *, uint16_t);
Files
loading...
SourceVuSTM32 Libraries and SamplesSTM32_USB_Host_LibraryClass/HID/Inc/usbh_hid.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file usbh_hid.h * @author MCD Application Team * @brief This file contains all the prototypes for the usbh_hid.c ****************************************************************************** * @attention * * Copyright (c) 2015 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* Define to prevent recursive ----------------------------------------------*/ #ifndef __USBH_HID_H #define __USBH_HID_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "usbh_core.h" #include "usbh_hid_mouse.h" #include "usbh_hid_keybd.h" /** @addtogroup USBH_LIB * @{ *//* ... */ /** @addtogroup USBH_CLASS * @{ *//* ... */ /** @addtogroup USBH_HID_CLASS * @{ *//* ... */ /** @defgroup USBH_HID_CORE * @brief This file is the Header file for usbh_hid.c * @{ *//* ... */ /** @defgroup USBH_HID_CORE_Exported_Types * @{ *//* ... */ #define HID_MIN_POLL 10U #define HID_REPORT_SIZE 16U #define HID_MAX_USAGE 10U #define HID_MAX_NBR_REPORT_FMT 10U #define HID_QUEUE_SIZE 10U #define HID_ITEM_LONG 0xFEU #define HID_ITEM_TYPE_MAIN 0x00U #define HID_ITEM_TYPE_GLOBAL 0x01U #define HID_ITEM_TYPE_LOCAL 0x02U #define HID_ITEM_TYPE_RESERVED 0x03U #define HID_MAIN_ITEM_TAG_INPUT 0x08U #define HID_MAIN_ITEM_TAG_OUTPUT 0x09U #define HID_MAIN_ITEM_TAG_COLLECTION 0x0AU #define HID_MAIN_ITEM_TAG_FEATURE 0x0BU #define HID_MAIN_ITEM_TAG_ENDCOLLECTION 0x0CU #define HID_GLOBAL_ITEM_TAG_USAGE_PAGE 0x00U #define HID_GLOBAL_ITEM_TAG_LOG_MIN 0x01U #define HID_GLOBAL_ITEM_TAG_LOG_MAX 0x02U #define HID_GLOBAL_ITEM_TAG_PHY_MIN 0x03U #define HID_GLOBAL_ITEM_TAG_PHY_MAX 0x04U #define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT 0x05U #define HID_GLOBAL_ITEM_TAG_UNIT 0x06U #define HID_GLOBAL_ITEM_TAG_REPORT_SIZE 0x07U #define HID_GLOBAL_ITEM_TAG_REPORT_ID 0x08U #define HID_GLOBAL_ITEM_TAG_REPORT_COUNT 0x09U #define HID_GLOBAL_ITEM_TAG_PUSH 0x0AU #define HID_GLOBAL_ITEM_TAG_POP 0x0BU #define HID_LOCAL_ITEM_TAG_USAGE 0x00U #define HID_LOCAL_ITEM_TAG_USAGE_MIN 0x01U #define HID_LOCAL_ITEM_TAG_USAGE_MAX 0x02U #define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX 0x03U #define HID_LOCAL_ITEM_TAG_DESIGNATOR_MIN 0x04U #define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAX 0x05U #define HID_LOCAL_ITEM_TAG_STRING_INDEX 0x07U #define HID_LOCAL_ITEM_TAG_STRING_MIN 0x08U #define HID_LOCAL_ITEM_TAG_STRING_MAX 0x09U #define HID_LOCAL_ITEM_TAG_DELIMITER 0x0AU 37 defines /* States for HID State Machine */ typedef enum { USBH_HID_INIT = 0, USBH_HID_IDLE, USBH_HID_SEND_DATA, USBH_HID_BUSY, USBH_HID_GET_DATA, USBH_HID_SYNC, USBH_HID_POLL, USBH_HID_ERROR, ...} USBH_HID_StateTypeDef; typedef enum { USBH_HID_REQ_INIT = 0, USBH_HID_REQ_IDLE, USBH_HID_REQ_GET_REPORT_DESC, USBH_HID_REQ_GET_HID_DESC, USBH_HID_REQ_SET_IDLE, USBH_HID_REQ_SET_PROTOCOL, USBH_HID_REQ_SET_REPORT, ...} HID_CtlStateTypeDef; typedef enum { HID_MOUSE = 0x01, HID_KEYBOARD = 0x02, HID_UNKNOWN = 0xFF, ...} HID_TypeTypeDef; typedef struct _HID_ReportData { uint8_t ReportID; uint8_t ReportType; uint16_t UsagePage; uint32_t Usage[HID_MAX_USAGE]; uint32_t NbrUsage; uint32_t UsageMin; uint32_t UsageMax; int32_t LogMin; int32_t LogMax; int32_t PhyMin; int32_t PhyMax; int32_t UnitExp; uint32_t Unit; uint32_t ReportSize; uint32_t ReportCnt; uint32_t Flag; uint32_t PhyUsage; uint32_t AppUsage; uint32_t LogUsage; ...} HID_ReportDataTypeDef; typedef struct _HID_ReportIDTypeDef { uint8_t Size; /* Report size return by the device id */ uint8_t ReportID; /* Report Id */ uint8_t Type; /* Report Type (INPUT/OUTPUT/FEATURE) */ ...} HID_ReportIDTypeDef; typedef struct _HID_CollectionTypeDef { uint32_t Usage; uint8_t Type; struct _HID_CollectionTypeDef *NextPtr; ...} HID_CollectionTypeDef; typedef struct _HID_AppCollectionTypeDef { uint32_t Usage; uint8_t Type; uint8_t NbrReportFmt; HID_ReportDataTypeDef ReportData[HID_MAX_NBR_REPORT_FMT]; ...} HID_AppCollectionTypeDef; typedef struct _HIDDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t bcdHID; /* indicates what endpoint this descriptor is describing */ uint8_t bCountryCode; /* specifies the transfer type. */ uint8_t bNumDescriptors; /* specifies the transfer type. */ uint8_t bReportDescriptorType; /* Maximum Packet Size this endpoint is capable of sending or receiving */ uint16_t wItemLength; /* is used to specify the polling interval of certain transfers. */ ...} HID_DescTypeDef; typedef struct { uint8_t *buf; uint16_t head; uint16_t tail; uint16_t size; uint8_t lock; ...} FIFO_TypeDef; /* Structure for HID process */ typedef struct _HID_Process { uint8_t OutPipe; uint8_t InPipe; USBH_HID_StateTypeDef state; uint8_t OutEp; uint8_t InEp; HID_CtlStateTypeDef ctl_state; FIFO_TypeDef fifo; uint8_t *pData; uint16_t length; uint8_t ep_addr; uint16_t poll; uint32_t timer; uint8_t DataReady; HID_DescTypeDef HID_Desc; USBH_StatusTypeDef(* Init)(USBH_HandleTypeDef *phost); ...} HID_HandleTypeDef; /** * @} *//* ... */ /** @defgroup USBH_HID_CORE_Exported_Defines * @{ *//* ... */ #define USB_HID_GET_REPORT 0x01U #define USB_HID_GET_IDLE 0x02U #define USB_HID_GET_PROTOCOL 0x03U #define USB_HID_SET_REPORT 0x09U #define USB_HID_SET_IDLE 0x0AU #define USB_HID_SET_PROTOCOL 0x0BU /* HID Class Codes */ #define USB_HID_CLASS 0x03U /* Interface Descriptor field values for HID Boot Protocol */ #define HID_BOOT_CODE 0x01U #define HID_KEYBRD_BOOT_CODE 0x01U #define HID_MOUSE_BOOT_CODE 0x02U 10 defines /** * @} *//* ... */ /** @defgroup USBH_HID_CORE_Exported_Macros * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup USBH_HID_CORE_Exported_Variables * @{ *//* ... */ extern USBH_ClassTypeDef HID_Class; #define USBH_HID_CLASS &HID_Class /** * @} *//* ... */ /** @defgroup USBH_HID_CORE_Exported_FunctionsPrototype * @{ *//* ... */ USBH_StatusTypeDef USBH_HID_SetReport(USBH_HandleTypeDef *phost, uint8_t reportType, uint8_t reportId, uint8_t *reportBuff, uint8_t reportLen); USBH_StatusTypeDef USBH_HID_GetReport(USBH_HandleTypeDef *phost, uint8_t reportType, uint8_t reportId, uint8_t *reportBuff, uint8_t reportLen); USBH_StatusTypeDef USBH_HID_GetHIDReportDescriptor(USBH_HandleTypeDef *phost, uint16_t length); USBH_StatusTypeDef USBH_HID_GetHIDDescriptor(USBH_HandleTypeDef *phost, uint16_t length); USBH_StatusTypeDef USBH_HID_SetIdle(USBH_HandleTypeDef *phost, uint8_t duration, uint8_t reportId); USBH_StatusTypeDef USBH_HID_SetProtocol(USBH_HandleTypeDef *phost, uint8_t protocol); void USBH_HID_EventCallback(USBH_HandleTypeDef *phost); HID_TypeTypeDef USBH_HID_GetDeviceType(USBH_HandleTypeDef *phost); uint8_t USBH_HID_GetPollInterval(USBH_HandleTypeDef *phost); void USBH_HID_FifoInit(FIFO_TypeDef *f, uint8_t *buf, uint16_t size); uint16_t USBH_HID_FifoRead(FIFO_TypeDef *f, void *buf, uint16_t nbytes); uint16_t USBH_HID_FifoWrite(FIFO_TypeDef *f, void *buf, uint16_t nbytes); /** * @} *//* ... */ #ifdef __cplusplus }extern "C" { ... } #endif /* ... */ #endif /* __USBH_HID_H */ /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.