Merge pull request #618 from homeodor/master

A CDC-like blocking behaviour for MIDI, incl. SysEx
This commit is contained in:
Ha Thach
2021-02-06 12:30:28 +07:00
committed by GitHub
3 changed files with 50 additions and 10 deletions

View File

@@ -125,6 +125,12 @@ void midi_task(void)
{
static uint32_t start_ms = 0;
// The MIDI interface always creates input and output port/jack descriptors
// regardless of these being used or not. Therefore incoming traffic should be read
// (possibly just discarded) to avoid the sender blocking in IO
uint8_t packet[4];
while(tud_midi_available()) tud_midi_receive(packet);
// send note every 1000 ms
if (board_millis() - start_ms < 286) return; // not enough time
start_ms += 286;