Adding support for a SOF callback

This commit is contained in:
Rocky04
2023-08-08 17:48:45 +00:00
parent 51a0889b75
commit 0161955c22
2 changed files with 7 additions and 0 deletions

View File

@@ -597,6 +597,10 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr)
break;
case DCD_EVENT_SOF:
TU_LOG_USBD("\r\n");
if ( tud_sof_cb ) tud_sof_cb(event->rhport, event->sof.frame_count);
break;
default:
TU_BREAKPOINT();
break;

View File

@@ -148,6 +148,9 @@ TU_ATTR_WEAK void tud_suspend_cb(bool remote_wakeup_en);
// Invoked when usb bus is resumed
TU_ATTR_WEAK void tud_resume_cb(void);
// Invoked when a new (micro) frame started
TU_ATTR_WEAK void tud_sof_cb(uint8_t rhport, uint32_t frame_count);
// Invoked when received control request with VENDOR TYPE
TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);