diff options
| author | Saulo VerĂssimo <[email protected]> | 2026-05-17 19:56:04 -0300 |
|---|---|---|
| committer | Saulo VerĂssimo <[email protected]> | 2026-05-17 19:56:04 -0300 |
| commit | b31e7cdbbedec4a3286700f3ec24bb63fd7c224f (patch) | |
| tree | 2daea8c1fa49830638d3beb6d4298c05689c4b76 /examples | |
| parent | 287096f7333aa10b6aaaf75337ccd3de9b06b95d (diff) | |
midi2: drain pattern for RX FIFO
Default RX/TX buffers to EPSIZE for both device and host. Document
drain-in-loop on ump_read; example device callback drains until
empty.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/midi2_device/src/main.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/device/midi2_device/src/main.c b/examples/device/midi2_device/src/main.c index cc918e198..d5f9bae24 100644 --- a/examples/device/midi2_device/src/main.c +++ b/examples/device/midi2_device/src/main.c @@ -529,7 +529,13 @@ void send_initial_setup(void); //--------------------------------------------------------------------+ void tud_midi2_rx_cb(uint8_t itf) { - (void)itf; + // Drain the RX FIFO in a loop until empty. Leaving words in the FIFO + // across callbacks can prevent subsequent bulk OUT transfers from landing. + uint32_t words[8]; + uint32_t n; + while ((n = tud_midi2_n_ump_read(itf, words, TU_ARRAY_SIZE(words))) > 0) { + (void) n; + } } // Reset playback state and re-send setup when host switches alt setting or |
