Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for a generic SOF callback #2213

Merged
merged 16 commits into from
May 10, 2024
4 changes: 4 additions & 0 deletions src/device/usbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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->sof.frame_count);
break;

default:
TU_BREAKPOINT();
break;
Expand Down
3 changes: 3 additions & 0 deletions src/device/usbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(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);

Expand Down