eric2013 发表于 2022-3-3 10:33:22

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



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

void USBH_Notify (uint8_t ctrl, uint8_t port, uint8_t device, USBH_NOTIFY notify) {
switch (notify) {
    case USBH_NOTIFY_CONNECT:
      // A new device was connected on port
      LED_On(0);
      break;
    case USBH_NOTIFY_DISCONNECT:
      // A device was dis-connected from a port
      LED_Off(0);
      break;
    case USBH_NOTIFY_OVERCURRENT:
      // An overcurrent has happened on a port
      break;
    case USBH_NOTIFY_REMOTE_WAKEUP:
      // Resume signaling has started on a port
      break;
    case USBH_NOTIFY_READY:
      // Device was enumerated, initialized and is ready for communication
      break;
    case USBH_NOTIFY_UNKNOWN_DEVICE:
      // A new device was connected but USB Host does not have a driver for it
      break;
    case USBH_NOTIFY_INSUFFICIENT_POWER:
      // A new device was connected but we can not supply it with enough power
      break;
    case USBH_NOTIFY_CONFIGURATION_FAILED:
      // A new device was connected but there aren't enough of resources to use it
      break;
    case USBH_NOTIFY_INITIALIZATION_FAILED:
      // A new device was connected but initialization of it has failed
      break;
}
}

int main (void){
..
LED_Initialize();
USBH_Initialize(0);               // USB Host 0 Initialize
..
USBH_Uninitialize(0);             // USB Host 0 De-Initialize
..
}

Guan 发表于 2024-2-1 15:59:34

硬汉哥你好,这有样例吗
页: [1]
查看完整版本: RL-USB V6.X的USB Host设备插拔情况回调函数