STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
usbh_hid.c
Go to the documentation of this file.
1 
42 /* Includes ------------------------------------------------------------------*/
43 #include "usbh_hid.h"
44 #include "usbh_hid_parser.h"
45 
46 
101 static USBH_StatusTypeDef USBH_HID_InterfaceInit (USBH_HandleTypeDef *phost);
102 static USBH_StatusTypeDef USBH_HID_InterfaceDeInit (USBH_HandleTypeDef *phost);
103 static USBH_StatusTypeDef USBH_HID_ClassRequest(USBH_HandleTypeDef *phost);
104 static USBH_StatusTypeDef USBH_HID_Process(USBH_HandleTypeDef *phost);
105 static USBH_StatusTypeDef USBH_HID_SOFProcess(USBH_HandleTypeDef *phost);
106 static void USBH_HID_ParseHIDDesc (HID_DescTypeDef *desc, uint8_t *buf);
107 
110 
112 {
113  "HID",
115  USBH_HID_InterfaceInit,
116  USBH_HID_InterfaceDeInit,
117  USBH_HID_ClassRequest,
118  USBH_HID_Process,
119  USBH_HID_SOFProcess,
120  NULL,
121 };
138 static USBH_StatusTypeDef USBH_HID_InterfaceInit (USBH_HandleTypeDef *phost)
139 {
140  uint8_t max_ep;
141  uint8_t num = 0;
142  uint8_t interface;
143 
144  USBH_StatusTypeDef status = USBH_FAIL ;
145  HID_HandleTypeDef *HID_Handle;
146 
147  interface = USBH_FindInterface(phost, phost->pActiveClass->ClassCode, HID_BOOT_CODE, 0xFF);
148 
149  if(interface == 0xFF) /* No Valid Interface */
150  {
151  status = USBH_FAIL;
152  USBH_DbgLog ("Cannot Find the interface for %s class.", phost->pActiveClass->Name);
153  }
154  else
155  {
156  USBH_SelectInterface (phost, interface);
157  phost->pActiveClass->pData = (HID_HandleTypeDef *)USBH_malloc (sizeof(HID_HandleTypeDef));
158  HID_Handle = (HID_HandleTypeDef *) phost->pActiveClass->pData;
159  HID_Handle->state = HID_ERROR;
160 
161  /*Decode Bootclass Protocol: Mouse or Keyboard*/
162  if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bInterfaceProtocol == HID_KEYBRD_BOOT_CODE)
163  {
164  USBH_UsrLog ("KeyBoard device found!");
165  HID_Handle->Init = USBH_HID_KeybdInit;
166  }
167  else if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bInterfaceProtocol == HID_MOUSE_BOOT_CODE)
168  {
169  USBH_UsrLog ("Mouse device found!");
170  HID_Handle->Init = USBH_HID_MouseInit;
171  }
172  else
173  {
174  USBH_UsrLog ("Protocol not supported.");
175  return USBH_FAIL;
176  }
177 
178  HID_Handle->state = HID_INIT;
179  HID_Handle->ctl_state = HID_REQ_INIT;
180  HID_Handle->ep_addr = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].bEndpointAddress;
181  HID_Handle->length = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].wMaxPacketSize;
182  HID_Handle->poll = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].bInterval ;
183 
184  if (HID_Handle->poll < HID_MIN_POLL)
185  {
186  HID_Handle->poll = HID_MIN_POLL;
187  }
188 
189  /* Check fo available number of endpoints */
190  /* Find the number of EPs in the Interface Descriptor */
191  /* Choose the lower number in order not to overrun the buffer allocated */
192  max_ep = ( (phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bNumEndpoints <= USBH_MAX_NUM_ENDPOINTS) ?
193  phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bNumEndpoints :
195 
196 
197  /* Decode endpoint IN and OUT address from interface descriptor */
198  for ( ;num < max_ep; num++)
199  {
200  if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[num].bEndpointAddress & 0x80)
201  {
202  HID_Handle->InEp = (phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[num].bEndpointAddress);
203  HID_Handle->InPipe =\
204  USBH_AllocPipe(phost, HID_Handle->InEp);
205 
206  /* Open pipe for IN endpoint */
207  USBH_OpenPipe (phost,
208  HID_Handle->InPipe,
209  HID_Handle->InEp,
210  phost->device.address,
211  phost->device.speed,
213  HID_Handle->length);
214 
215  USBH_LL_SetToggle (phost, HID_Handle->InPipe, 0);
216 
217  }
218  else
219  {
220  HID_Handle->OutEp = (phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[num].bEndpointAddress);
221  HID_Handle->OutPipe =\
222  USBH_AllocPipe(phost, HID_Handle->OutEp);
223 
224  /* Open pipe for OUT endpoint */
225  USBH_OpenPipe (phost,
226  HID_Handle->OutPipe,
227  HID_Handle->OutEp,
228  phost->device.address,
229  phost->device.speed,
231  HID_Handle->length);
232 
233  USBH_LL_SetToggle (phost, HID_Handle->OutPipe, 0);
234  }
235 
236  }
237  status = USBH_OK;
238  }
239  return status;
240 }
241 
248 USBH_StatusTypeDef USBH_HID_InterfaceDeInit (USBH_HandleTypeDef *phost )
249 {
250  HID_HandleTypeDef *HID_Handle = (HID_HandleTypeDef *) phost->pActiveClass->pData;
251 
252  if(HID_Handle->InPipe != 0x00)
253  {
254  USBH_ClosePipe (phost, HID_Handle->InPipe);
255  USBH_FreePipe (phost, HID_Handle->InPipe);
256  HID_Handle->InPipe = 0; /* Reset the pipe as Free */
257  }
258 
259  if(HID_Handle->OutPipe != 0x00)
260  {
261  USBH_ClosePipe(phost, HID_Handle->OutPipe);
262  USBH_FreePipe (phost, HID_Handle->OutPipe);
263  HID_Handle->OutPipe = 0; /* Reset the pipe as Free */
264  }
265 
266  if(phost->pActiveClass->pData)
267  {
268  USBH_free (phost->pActiveClass->pData);
269  }
270 
271  return USBH_OK;
272 }
273 
281 static USBH_StatusTypeDef USBH_HID_ClassRequest(USBH_HandleTypeDef *phost)
282 {
283 
284  USBH_StatusTypeDef status = USBH_BUSY;
285  USBH_StatusTypeDef classReqStatus = USBH_BUSY;
286  HID_HandleTypeDef *HID_Handle = (HID_HandleTypeDef *) phost->pActiveClass->pData;
287 
288  /* Switch HID state machine */
289  switch (HID_Handle->ctl_state)
290  {
291  case HID_REQ_INIT:
293 
294  /* Get HID Desc */
296  {
297 
298  USBH_HID_ParseHIDDesc(&HID_Handle->HID_Desc, phost->device.Data);
299  HID_Handle->ctl_state = HID_REQ_GET_REPORT_DESC;
300  }
301 
302  break;
304 
305 
306  /* Get Report Desc */
307  if (USBH_HID_GetHIDReportDescriptor(phost, HID_Handle->HID_Desc.wItemLength) == USBH_OK)
308  {
309  /* The descriptor is available in phost->device.Data */
310 
311  HID_Handle->ctl_state = HID_REQ_SET_IDLE;
312  }
313 
314  break;
315 
316  case HID_REQ_SET_IDLE:
317 
318  classReqStatus = USBH_HID_SetIdle (phost, 0, 0);
319 
320  /* set Idle */
321  if (classReqStatus == USBH_OK)
322  {
323  HID_Handle->ctl_state = HID_REQ_SET_PROTOCOL;
324  }
325  else if(classReqStatus == USBH_NOT_SUPPORTED)
326  {
327  HID_Handle->ctl_state = HID_REQ_SET_PROTOCOL;
328  }
329  break;
330 
332  /* set protocol */
333  if (USBH_HID_SetProtocol (phost, 0) == USBH_OK)
334  {
335  HID_Handle->ctl_state = HID_REQ_IDLE;
336 
337  /* all requests performed*/
338  phost->pUser(phost, HOST_USER_CLASS_ACTIVE);
339  status = USBH_OK;
340  }
341  break;
342 
343  case HID_REQ_IDLE:
344  default:
345  break;
346  }
347 
348  return status;
349 }
350 
357 static USBH_StatusTypeDef USBH_HID_Process(USBH_HandleTypeDef *phost)
358 {
359  USBH_StatusTypeDef status = USBH_OK;
360  HID_HandleTypeDef *HID_Handle = (HID_HandleTypeDef *) phost->pActiveClass->pData;
361 
362  switch (HID_Handle->state)
363  {
364  case HID_INIT:
365  HID_Handle->Init(phost);
366  case HID_IDLE:
367  if(USBH_HID_GetReport (phost,
368  0x01,
369  0,
370  HID_Handle->pData,
371  HID_Handle->length) == USBH_OK)
372  {
373 
374  fifo_write(&HID_Handle->fifo, HID_Handle->pData, HID_Handle->length);
375  HID_Handle->state = HID_SYNC;
376  }
377 
378  break;
379 
380  case HID_SYNC:
381 
382  /* Sync with start of Even Frame */
383  if(phost->Timer & 1)
384  {
385  HID_Handle->state = HID_GET_DATA;
386  }
387 #if (USBH_USE_OS == 1)
388  osMessagePut ( phost->os_event, USBH_URB_EVENT, 0);
389 #endif
390  break;
391 
392  case HID_GET_DATA:
393 
395  HID_Handle->pData,
396  HID_Handle->length,
397  HID_Handle->InPipe);
398 
399  HID_Handle->state = HID_POLL;
400  HID_Handle->timer = phost->Timer;
401  HID_Handle->DataReady = 0;
402  break;
403 
404  case HID_POLL:
405 
406  if(USBH_LL_GetURBState(phost , HID_Handle->InPipe) == USBH_URB_DONE)
407  {
408  if(HID_Handle->DataReady == 0)
409  {
410  fifo_write(&HID_Handle->fifo, HID_Handle->pData, HID_Handle->length);
411  HID_Handle->DataReady = 1;
412  USBH_HID_EventCallback(phost);
413 #if (USBH_USE_OS == 1)
414  osMessagePut ( phost->os_event, USBH_URB_EVENT, 0);
415 #endif
416  }
417  }
418  else if(USBH_LL_GetURBState(phost , HID_Handle->InPipe) == USBH_URB_STALL) /* IN Endpoint Stalled */
419  {
420 
421  /* Issue Clear Feature on interrupt IN endpoint */
422  if(USBH_ClrFeature(phost,
423  HID_Handle->ep_addr) == USBH_OK)
424  {
425  /* Change state to issue next IN token */
426  HID_Handle->state = HID_GET_DATA;
427  }
428  }
429 
430 
431  break;
432 
433  default:
434  break;
435  }
436  return status;
437 }
438 
445 static USBH_StatusTypeDef USBH_HID_SOFProcess(USBH_HandleTypeDef *phost)
446 {
447  HID_HandleTypeDef *HID_Handle = (HID_HandleTypeDef *) phost->pActiveClass->pData;
448 
449  if(HID_Handle->state == HID_POLL)
450  {
451  if(( phost->Timer - HID_Handle->timer) >= HID_Handle->poll)
452  {
453  HID_Handle->state = HID_GET_DATA;
454 #if (USBH_USE_OS == 1)
455  osMessagePut ( phost->os_event, USBH_URB_EVENT, 0);
456 #endif
457  }
458  }
459  return USBH_OK;
460 }
461 
471  uint16_t length)
472 {
473 
474  USBH_StatusTypeDef status;
475 
476  status = USBH_GetDescriptor(phost,
479  phost->device.Data,
480  length);
481 
482  /* HID report descriptor is available in phost->device.Data.
483  In case of USB Boot Mode devices for In report handling ,
484  HID report descriptor parsing is not required.
485  In case, for supporting Non-Boot Protocol devices and output reports,
486  user may parse the report descriptor*/
487 
488 
489  return status;
490 }
491 
501  uint16_t length)
502 {
503 
504  USBH_StatusTypeDef status;
505 
506  status = USBH_GetDescriptor( phost,
508  USB_DESC_HID,
509  phost->device.Data,
510  length);
511 
512  return status;
513 }
514 
524  uint8_t duration,
525  uint8_t reportId)
526 {
527 
529  USB_REQ_TYPE_CLASS;
530 
531 
533  phost->Control.setup.b.wValue.w = (duration << 8 ) | reportId;
534 
535  phost->Control.setup.b.wIndex.w = 0;
536  phost->Control.setup.b.wLength.w = 0;
537 
538  return USBH_CtlReq(phost, 0 , 0 );
539 }
540 
541 
553  uint8_t reportType,
554  uint8_t reportId,
555  uint8_t* reportBuff,
556  uint8_t reportLen)
557 {
558 
560  USB_REQ_TYPE_CLASS;
561 
562 
564  phost->Control.setup.b.wValue.w = (reportType << 8 ) | reportId;
565 
566  phost->Control.setup.b.wIndex.w = 0;
567  phost->Control.setup.b.wLength.w = reportLen;
568 
569  return USBH_CtlReq(phost, reportBuff , reportLen );
570 }
571 
572 
584  uint8_t reportType,
585  uint8_t reportId,
586  uint8_t* reportBuff,
587  uint8_t reportLen)
588 {
589 
591  USB_REQ_TYPE_CLASS;
592 
593 
595  phost->Control.setup.b.wValue.w = (reportType << 8 ) | reportId;
596 
597  phost->Control.setup.b.wIndex.w = 0;
598  phost->Control.setup.b.wLength.w = reportLen;
599 
600  return USBH_CtlReq(phost, reportBuff , reportLen );
601 }
602 
611  uint8_t protocol)
612 {
613 
614 
616  USB_REQ_TYPE_CLASS;
617 
618 
620  phost->Control.setup.b.wValue.w = protocol != 0 ? 0 : 1;
621  phost->Control.setup.b.wIndex.w = 0;
622  phost->Control.setup.b.wLength.w = 0;
623 
624  return USBH_CtlReq(phost, 0 , 0 );
625 
626 }
627 
635 static void USBH_HID_ParseHIDDesc (HID_DescTypeDef *desc, uint8_t *buf)
636 {
637 
638  desc->bLength = *(uint8_t *) (buf + 0);
639  desc->bDescriptorType = *(uint8_t *) (buf + 1);
640  desc->bcdHID = LE16 (buf + 2);
641  desc->bCountryCode = *(uint8_t *) (buf + 4);
642  desc->bNumDescriptors = *(uint8_t *) (buf + 5);
643  desc->bReportDescriptorType = *(uint8_t *) (buf + 6);
644  desc->wItemLength = LE16 (buf + 7);
645 }
646 
654 {
656 
657  if(phost->gState == HOST_CLASS)
658  {
659 
662  {
663  type = HID_KEYBOARD;
664  }
667  {
668  type= HID_MOUSE;
669  }
670  }
671  return type;
672 }
673 
674 
682 {
683  HID_HandleTypeDef *HID_Handle = (HID_HandleTypeDef *) phost->pActiveClass->pData;
684 
685  if((phost->gState == HOST_CLASS_REQUEST) ||
686  (phost->gState == HOST_INPUT) ||
687  (phost->gState == HOST_SET_CONFIGURATION) ||
688  (phost->gState == HOST_CHECK_CLASS) ||
689  ((phost->gState == HOST_CLASS)))
690  {
691  return (HID_Handle->poll);
692  }
693  else
694  {
695  return 0;
696  }
697 }
706 void fifo_init(FIFO_TypeDef * f, uint8_t * buf, uint16_t size)
707 {
708  f->head = 0;
709  f->tail = 0;
710  f->lock = 0;
711  f->size = size;
712  f->buf = buf;
713 }
714 
723 uint16_t fifo_read(FIFO_TypeDef * f, void * buf, uint16_t nbytes)
724 {
725  uint16_t i;
726  uint8_t * p;
727  p = (uint8_t*) buf;
728 
729  if(f->lock == 0)
730  {
731  f->lock = 1;
732  for(i=0; i < nbytes; i++)
733  {
734  if( f->tail != f->head )
735  {
736  *p++ = f->buf[f->tail];
737  f->tail++;
738  if( f->tail == f->size )
739  {
740  f->tail = 0;
741  }
742  } else
743  {
744  f->lock = 0;
745  return i;
746  }
747  }
748  }
749  f->lock = 0;
750  return nbytes;
751 }
752 
761 uint16_t fifo_write(FIFO_TypeDef * f, const void * buf, uint16_t nbytes)
762 {
763  uint16_t i;
764  const uint8_t * p;
765  p = (const uint8_t*) buf;
766  if(f->lock == 0)
767  {
768  f->lock = 1;
769  for(i=0; i < nbytes; i++)
770  {
771  if( (f->head + 1 == f->tail) ||
772  ( (f->head + 1 == f->size) && (f->tail == 0)) )
773  {
774  f->lock = 0;
775  return i;
776  }
777  else
778  {
779  f->buf[f->head] = *p++;
780  f->head++;
781  if( f->head == f->size )
782  {
783  f->head = 0;
784  }
785  }
786  }
787  }
788  f->lock = 0;
789  return nbytes;
790 }
791 
792 
799 {
800 
801 }
824 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
USBH_StatusTypeDef USBH_InterruptReceiveData(USBH_HandleTypeDef *phost, uint8_t *buff, uint8_t length, uint8_t hc_num)
USBH_InterruptReceiveData Receives the Device Response to the Interrupt IN token. ...
Definition: usbh_ioreq.c:244
uint8_t bNumDescriptors
Definition: usbh_hid.h:198
#define HID_KEYBRD_BOOT_CODE
Definition: usbh_hid.h:259
#define USB_H2D
Definition: usbh_def.h:108
USB_Setup_TypeDef setup
Definition: usbh_def.h:412
uint16_t head
Definition: usbh_hid.h:208
USBH_DeviceTypeDef device
Definition: usbh_def.h:456
HID_TypeTypeDef
Definition: usbh_hid.h:137
USBH_StatusTypeDef USBH_HID_SetIdle(USBH_HandleTypeDef *phost, uint8_t duration, uint8_t reportId)
USBH_Set_Idle Set Idle State.
Definition: usbh_hid.c:523
USBH_StatusTypeDef USBH_OpenPipe(USBH_HandleTypeDef *phost, uint8_t ch_num, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
USBH_Open_Pipe Open a pipe.
Definition: usbh_pipes.c:93
#define USB_D2H
Definition: usbh_def.h:109
uint16_t length
Definition: usbh_hid.h:226
__IO uint32_t Timer
Definition: usbh_def.h:461
USBH_StatusTypeDef USBH_SelectInterface(USBH_HandleTypeDef *phost, uint8_t interface)
USBH_SelectInterface Select current interface.
Definition: usbh_core.c:233
USBH_StatusTypeDef USBH_HID_MouseInit(USBH_HandleTypeDef *phost)
USBH_HID_MouseInit The function init the HID mouse.
uint32_t timer
Definition: usbh_hid.h:229
uint8_t DataReady
Definition: usbh_hid.h:230
uint16_t_uint8_t wValue
Definition: usbh_def.h:223
#define USB_EP_TYPE_INTR
Definition: usbh_def.h:173
FIFO_TypeDef fifo
Definition: usbh_hid.h:224
#define USB_HID_GET_REPORT
Definition: usbh_hid.h:244
uint16_t wItemLength
Definition: usbh_hid.h:200
#define HOST_USER_CLASS_ACTIVE
Definition: usbh_core.h:65
uint16_t poll
Definition: usbh_hid.h:228
uint8_t * buf
Definition: usbh_hid.h:207
HID_TypeTypeDef USBH_HID_GetDeviceType(USBH_HandleTypeDef *phost)
USBH_HID_GetDeviceType Return Device function.
Definition: usbh_hid.c:653
USBH_StatusTypeDef USBH_FreePipe(USBH_HandleTypeDef *phost, uint8_t idx)
USBH_Free_Pipe Free the USB Pipe.
Definition: usbh_pipes.c:158
uint16_t tail
Definition: usbh_hid.h:209
uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, uint8_t Class, uint8_t SubClass, uint8_t Protocol)
USBH_FindInterface Find the interface index for a specific class.
Definition: usbh_core.c:274
USBH_StatusTypeDef USBH_ClrFeature(USBH_HandleTypeDef *phost, uint8_t ep_num)
USBH_ClrFeature This request is used to clear or disable a specific feature.
Definition: usbh_ctlreq.c:308
void(* pUser)(struct _USBH_HandleTypeDef *pHandle, uint8_t id)
Definition: usbh_def.h:464
uint16_t_uint8_t wLength
Definition: usbh_def.h:225
This file contains all the prototypes for the usbh_hid.c.
#define USBH_MAX_NUM_ENDPOINTS
USBH_InterfaceDescTypeDef Itf_Desc[USBH_MAX_NUM_INTERFACES]
Definition: usbh_def.h:296
USBH_StatusTypeDef USBH_HID_KeybdInit(USBH_HandleTypeDef *phost)
USBH_HID_KeybdInit The function init the HID keyboard.
USBH_CfgDescTypeDef CfgDesc
Definition: usbh_def.h:430
#define USB_REQ_RECIPIENT_INTERFACE
Definition: usbd_def.h:79
#define NULL
Definition: usbd_def.h:53
USBH_StatusTypeDef(* Init)(USBH_HandleTypeDef *phost)
Definition: usbh_hid.h:232
USBH_CtrlTypeDef Control
Definition: usbh_def.h:455
USBH_StatusTypeDef USBH_CtlReq(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length)
USBH_CtlReq USBH_CtlReq sends a control request and provide the status after completion of the reques...
Definition: usbh_ctlreq.c:531
#define USB_DESC_HID
Definition: usbh_def.h:167
uint8_t * pData
Definition: usbh_hid.h:225
HID_DescTypeDef HID_Desc
Definition: usbh_hid.h:231
uint8_t bDescriptorType
Definition: usbh_hid.h:195
#define USBH_malloc
#define LE16(addr)
Definition: usbh_def.h:69
uint16_t size
Definition: usbh_hid.h:210
HID_StateTypeDef state
Definition: usbh_hid.h:220
USBH_ClassTypeDef HID_Class
Definition: usbh_hid.c:111
#define USB_DESC_HID_REPORT
Definition: usbh_def.h:166
void fifo_init(FIFO_TypeDef *f, uint8_t *buf, uint16_t size)
fifo_init Initialize FIFO.
Definition: usbh_hid.c:706
#define USB_REQ_TYPE_STANDARD
Definition: usbd_def.h:73
uint8_t lock
Definition: usbh_hid.h:211
uint16_t w
Definition: usbh_def.h:204
__weak void USBH_HID_EventCallback(USBH_HandleTypeDef *phost)
The function is a callback about HID Data events.
Definition: usbh_hid.c:798
uint16_t fifo_read(FIFO_TypeDef *f, void *buf, uint16_t nbytes)
fifo_read Read from FIFO.
Definition: usbh_hid.c:723
USBH_StatusTypeDef USBH_LL_SetToggle(USBH_HandleTypeDef *phost, uint8_t, uint8_t)
USBH_LL_SetToggle Set toggle for a pipe.
USBH_StatusTypeDef USBH_HID_SetReport(USBH_HandleTypeDef *phost, uint8_t reportType, uint8_t reportId, uint8_t *reportBuff, uint8_t reportLen)
USBH_HID_Set_Report Issues Set Report.
Definition: usbh_hid.c:552
USBH_URBStateTypeDef USBH_LL_GetURBState(USBH_HandleTypeDef *phost, uint8_t)
USBH_LL_GetURBState Get a URB state from the low level driver.
uint8_t bReportDescriptorType
Definition: usbh_hid.h:199
uint8_t ep_addr
Definition: usbh_hid.h:227
uint8_t InPipe
Definition: usbh_hid.h:219
#define USB_HID_DESC_SIZE
Definition: usbh_def.h:152
#define USB_HID_SET_IDLE
Definition: usbh_hid.h:248
USBH_StatusTypeDef USBH_GetDescriptor(USBH_HandleTypeDef *phost, uint8_t req_type, uint16_t value_idx, uint8_t *buff, uint16_t length)
USBH_GetDescriptor Issues Descriptor command to the device. Once the response received, it parses the descriptor and updates the status.
Definition: usbh_ctlreq.c:204
#define USB_HID_CLASS
Definition: usbh_hid.h:255
#define HID_MIN_POLL
Definition: usbh_hid.h:63
USBH_StatusTypeDef USBH_HID_SetProtocol(USBH_HandleTypeDef *phost, uint8_t protocol)
USBH_Set_Protocol Set protocol State.
Definition: usbh_hid.c:610
USBH_StatusTypeDef
Definition: usbh_def.h:302
#define USBH_DbgLog(...)
__IO HOST_StateTypeDef gState
Definition: usbh_def.h:452
uint16_t fifo_write(FIFO_TypeDef *f, const void *buf, uint16_t nbytes)
fifo_write Read from FIFO.
Definition: usbh_hid.c:761
uint8_t current_interface
Definition: usbh_def.h:428
#define USBH_UsrLog(...)
#define USB_HID_SET_PROTOCOL
Definition: usbh_hid.h:249
USBH_StatusTypeDef USBH_HID_GetReport(USBH_HandleTypeDef *phost, uint8_t reportType, uint8_t reportId, uint8_t *reportBuff, uint8_t reportLen)
USBH_HID_GetReport retreive Set Report.
Definition: usbh_hid.c:583
#define USB_HID_SET_REPORT
Definition: usbh_hid.h:247
uint8_t OutEp
Definition: usbh_hid.h:221
USBH_StatusTypeDef USBH_HID_GetHIDDescriptor(USBH_HandleTypeDef *phost, uint16_t length)
USBH_Get_HID_Descriptor Issue HID Descriptor command to the device. Once the response received...
Definition: usbh_hid.c:500
uint8_t bInterfaceProtocol
Definition: usbh_def.h:279
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a Message to a Queue.
Definition: cmsis_os.c:951
#define HID_MOUSE_BOOT_CODE
Definition: usbh_hid.h:260
uint8_t Data[USBH_MAX_DATA_BUFFER]
Definition: usbh_def.h:424
uint8_t bCountryCode
Definition: usbh_hid.h:197
uint8_t OutPipe
Definition: usbh_hid.h:218
uint8_t bLength
Definition: usbh_hid.h:194
USBH_ClassTypeDef * pActiveClass
Definition: usbh_def.h:458
HID_CtlStateTypeDef ctl_state
Definition: usbh_hid.h:223
#define USBH_free
uint16_t_uint8_t wIndex
Definition: usbh_def.h:224
USBH_StatusTypeDef USBH_HID_GetHIDReportDescriptor(USBH_HandleTypeDef *phost, uint16_t length)
USBH_Get_HID_ReportDescriptor Issue report Descriptor command to the device. Once the response receiv...
Definition: usbh_hid.c:470
struct _USB_Setup::_SetupPkt_Struc b
uint8_t USBH_HID_GetPollInterval(USBH_HandleTypeDef *phost)
USBH_HID_GetPollInterval Return HID device poll time.
Definition: usbh_hid.c:681
USBH_StatusTypeDef USBH_ClosePipe(USBH_HandleTypeDef *phost, uint8_t pipe_num)
USBH_ClosePipe Close a pipe.
Definition: usbh_pipes.c:121
uint16_t bcdHID
Definition: usbh_hid.h:196
uint8_t InEp
Definition: usbh_hid.h:222