CDC-like blocking behaviour for MIDI
Also added a dummy readout for MIDI into examples
This commit is contained in:
parent
2a34be2eb0
commit
9f7143af29
|
@ -165,6 +165,12 @@ void midi_task(void)
|
||||||
{
|
{
|
||||||
static uint32_t start_ms = 0;
|
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
|
// send note every 1000 ms
|
||||||
if (board_millis() - start_ms < 286) return; // not enough time
|
if (board_millis() - start_ms < 286) return; // not enough time
|
||||||
start_ms += 286;
|
start_ms += 286;
|
||||||
|
|
|
@ -125,6 +125,12 @@ void midi_task(void)
|
||||||
{
|
{
|
||||||
static uint32_t start_ms = 0;
|
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
|
// send note every 1000 ms
|
||||||
if (board_millis() - start_ms < 286) return; // not enough time
|
if (board_millis() - start_ms < 286) return; // not enough time
|
||||||
start_ms += 286;
|
start_ms += 286;
|
||||||
|
|
Loading…
Reference in New Issue