硬汉嵌入式论坛

 找回密码
 立即注册
查看: 1274|回复: 1
收起左侧

RL-USB V6.X的USB Host设备插拔情况回调函数

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106660
QQ
发表于 2022-3-3 10:33:22 | 显示全部楼层 |阅读模式
image.png

  1. #include <Board_LED.h>
  2. #include <rl_usb.h>

  3. void USBH_Notify (uint8_t ctrl, uint8_t port, uint8_t device, USBH_NOTIFY notify) {
  4.   switch (notify) {
  5.     case USBH_NOTIFY_CONNECT:
  6.       // A new device was connected on port
  7.       LED_On(0);
  8.       break;
  9.     case USBH_NOTIFY_DISCONNECT:
  10.       // A device was dis-connected from a port
  11.       LED_Off(0);
  12.       break;
  13.     case USBH_NOTIFY_OVERCURRENT:
  14.       // An overcurrent has happened on a port
  15.       break;
  16.     case USBH_NOTIFY_REMOTE_WAKEUP:
  17.       // Resume signaling has started on a port
  18.       break;
  19.     case USBH_NOTIFY_READY:
  20.       // Device was enumerated, initialized and is ready for communication
  21.       break;
  22.     case USBH_NOTIFY_UNKNOWN_DEVICE:
  23.       // A new device was connected but USB Host does not have a driver for it
  24.       break;
  25.     case USBH_NOTIFY_INSUFFICIENT_POWER:
  26.       // A new device was connected but we can not supply it with enough power
  27.       break;
  28.     case USBH_NOTIFY_CONFIGURATION_FAILED:
  29.       // A new device was connected but there aren't enough of resources to use it
  30.       break;
  31.     case USBH_NOTIFY_INITIALIZATION_FAILED:
  32.       // A new device was connected but initialization of it has failed
  33.       break;
  34.   }
  35. }

  36. int main (void)  {
  37.   ..
  38.   LED_Initialize();
  39.   USBH_Initialize(0);               // USB Host 0 Initialize
  40.   ..
  41.   USBH_Uninitialize(0);             // USB Host 0 De-Initialize
  42.   ..
  43. }
复制代码


回复

使用道具 举报

0

主题

3

回帖

3

积分

新手上路

积分
3
发表于 2024-2-1 15:59:34 | 显示全部楼层
硬汉哥你好,这有样例吗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-4-29 06:15 , Processed in 0.151088 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表