xmos / xcore_iot

Other
30 stars 40 forks source link

Add new callback to DCD USB handler #423

Closed ACascarino closed 2 years ago

ACascarino commented 2 years ago

As part of xmos/sln_avona#21 - thought I'd spin it off into a separate PR!

This PR does two things:

bool tud_xcore_data_cb(uint32_t cur_time, uint32_t ep_num, uint32_t ep_dir, size_t xfer_len);

where

The function currently expects a bool return, but does nothing with this return value. This opens the possibility of application callbacks being able to modify behaviour of the DCD dynamically. It is suggested for forwards-compatibility that applications that implement this callback set the return to True in line with the expectations of tud_xcore_sof_cb, where a return value of True instructs TinyUSB to send the SOF event to the stack.