[STM32F1] 请教一下关于USBH_HID_SetReport的使用

[复制链接]
 楼主| LZR13179 发表于 2017-8-4 17:50 | 显示全部楼层 |阅读模式
在官方的en.stm32cubef1\STM32Cube_FW_F1_V1.4.0\Projects\STM3210C_EVAL\Applications\USB_Host\HID_Standalone没有看到关于USBH_HID_SetReport的使用。但是在一些HID设备通讯需要将host数据( 通过控制通道发送报告数据 )发给driver时,USBH_HID_SetReport该如果调用
lxyppc 发表于 2017-8-4 19:33 来自手机 | 显示全部楼层
可以仿照着get descriptor的命令写一个
改改命令id就行了
稳稳の幸福 发表于 2017-8-4 20:55 | 显示全部楼层
  1. +/**
  2. +  * [url=home.php?mod=space&uid=247401]@brief[/url]  USBH_HID_Set_Report
  3. +  *         Issues Set Report
  4. +  * @param  phost: Host handle
  5. +  * @param  reportType  : Report type to be sent
  6. +  * @param  reportId    : Targetted report ID for Set Report request
  7. +  * @param  reportBuff  : Report Buffer
  8. +  * @param  reportLen   : Length of data report to be send
  9. +  * @retval USBH Status
  10. +  */
  11. +USBH_StatusTypeDef USBH_HID_SetReport (USBH_HandleTypeDef *phost,
  12. +                                    uint8_t reportType,
  13. +                                    uint8_t reportId,
  14. +                                    uint8_t* reportBuff,
  15. +                                    uint8_t reportLen)
  16. +{
  17. +  
  18. +  phost->Control.setup.b.bmRequestType = USB_H2D | USB_REQ_RECIPIENT_INTERFACE |\
  19. +    USB_REQ_TYPE_CLASS;
  20. +  
  21. +  
  22. +  phost->Control.setup.b.bRequest = USB_HID_SET_REPORT;
  23. +  phost->Control.setup.b.wValue.w = (reportType << 8 ) | reportId;
  24. +  
  25. +  phost->Control.setup.b.wIndex.w = 0;
  26. +  phost->Control.setup.b.wLength.w = reportLen;
  27. +  
  28. +  return USBH_CtlReq(phost, reportBuff , reportLen );


这个??
稳稳の幸福 发表于 2017-8-4 20:56 | 显示全部楼层
搞错了,上面那个好像是Python里面用的。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

6

主题

87

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部