discoverpixy
usbh_hid_core.h
Go to the documentation of this file.
1 
22 /* Define to prevent recursive ----------------------------------------------*/
23 #ifndef __USBH_HID_CORE_H
24 #define __USBH_HID_CORE_H
25 
26 /* Includes ------------------------------------------------------------------*/
27 #include "usbh_core.h"
28 #include "usbh_stdreq.h"
29 #include "usb_bsp.h"
30 #include "usbh_ioreq.h"
31 #include "usbh_hcs.h"
32 
56 /* States for HID State Machine */
57 typedef enum
58 {
59  HID_IDLE= 0,
60  HID_SEND_DATA,
61  HID_BUSY,
62  HID_GET_DATA,
63  HID_POLL,
64  HID_ERROR,
65 }
66 HID_State;
67 
68 typedef enum
69 {
70  HID_REQ_IDLE = 0,
71  HID_REQ_GET_REPORT_DESC,
72  HID_REQ_GET_HID_DESC,
73  HID_REQ_SET_IDLE,
74  HID_REQ_SET_PROTOCOL,
75  HID_REQ_SET_REPORT,
76 
77 }
78 HID_CtlState;
79 
80 typedef struct HID_cb
81 {
82  void (*Init) (void);
83  void (*Decode) (uint8_t *data);
84 
86 
87 typedef struct _HID_Report
88 {
89  uint8_t ReportID;
90  uint8_t ReportType;
91  uint16_t UsagePage;
92  uint32_t Usage[2];
93  uint32_t NbrUsage;
94  uint32_t UsageMin;
95  uint32_t UsageMax;
96  int32_t LogMin;
97  int32_t LogMax;
98  int32_t PhyMin;
99  int32_t PhyMax;
100  int32_t UnitExp;
101  uint32_t Unit;
102  uint32_t ReportSize;
103  uint32_t ReportCnt;
104  uint32_t Flag;
105  uint32_t PhyUsage;
106  uint32_t AppUsage;
107  uint32_t LogUsage;
108 }
110 
111 /* Structure for HID process */
112 typedef struct _HID_Process
113 {
114  uint8_t buff[64];
115  uint8_t hc_num_in;
116  uint8_t hc_num_out;
117  HID_State state;
118  uint8_t HIDIntOutEp;
119  uint8_t HIDIntInEp;
120  HID_CtlState ctl_state;
121  uint16_t length;
122  uint8_t ep_addr;
123  uint16_t poll;
124  __IO uint16_t timer;
125  HID_cb_TypeDef *cb;
126 }
128 
137 #define USB_HID_REQ_GET_REPORT 0x01
138 #define USB_HID_GET_IDLE 0x02
139 #define USB_HID_GET_PROTOCOL 0x03
140 #define USB_HID_SET_REPORT 0x09
141 #define USB_HID_SET_IDLE 0x0A
142 #define USB_HID_SET_PROTOCOL 0x0B
143 
166 USBH_Status USBH_Set_Report (USB_OTG_CORE_HANDLE *pdev,
167  USBH_HOST *phost,
168  uint8_t reportType,
169  uint8_t reportId,
170  uint8_t reportLen,
171  uint8_t* reportBuff);
177 #endif /* __USBH_HID_CORE_H */
178 
194 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
195 
Specific api's relative to the used hardware platform.
Header file for usbh_core.c.
USBH_Status USBH_Set_Report(USB_OTG_CORE_HANDLE *pdev, USBH_HOST *phost, uint8_t reportType, uint8_t reportId, uint8_t reportLen, uint8_t *reportBuff)
USBH_Set_Report Issues Set Report.
Definition: usbh_hid_core.c:541
Header file for usbh_stdreq.c.
Definition: usbh_hid_core.h:112
Definition: usbh_hid_core.h:80
#define __IO
Definition: core_cm4.h:222
Header file for usbh_ioreq.c.
Definition: usb_core.h:287
Definition: usbh_hid_core.h:87
Header file for usbh_hcs.c.
Definition: usbh_core.h:215
Definition: usbh_core.h:174