use usbd_event_handler instead of usbd_configure_done_callback

This commit is contained in:
sakimisu
2023-06-21 21:26:25 +08:00
parent 822cd9d679
commit 340fa4e024
23 changed files with 512 additions and 74 deletions

View File

@@ -167,10 +167,31 @@ USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t write_buffer[64];
/*!< hid state ! Data can be sent only when state is idle */
static volatile uint8_t custom_state = HID_STATE_IDLE;
void usbd_configure_done_callback(void)
void usbd_event_handler(uint8_t event)
{
/* setup first out ep read transfer */
usbd_ep_start_read(HIDRAW_OUT_EP, read_buffer, 64);
switch (event) {
case USBD_EVENT_RESET:
break;
case USBD_EVENT_CONNECTED:
break;
case USBD_EVENT_DISCONNECTED:
break;
case USBD_EVENT_RESUME:
break;
case USBD_EVENT_SUSPEND:
break;
case USBD_EVENT_CONFIGURED:
/* setup first out ep read transfer */
usbd_ep_start_read(HIDRAW_OUT_EP, read_buffer, 64);
break;
case USBD_EVENT_SET_REMOTE_WAKEUP:
break;
case USBD_EVENT_CLR_REMOTE_WAKEUP:
break;
default:
break;
}
}
static void usbd_hid_custom_in_callback(uint8_t ep, uint32_t nbytes)