summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/device/dynamic_configuration/src/main.c6
-rw-r--r--examples/device/midi_test/src/main.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/examples/device/dynamic_configuration/src/main.c b/examples/device/dynamic_configuration/src/main.c
index 3ad13aefa..45786e99a 100644
--- a/examples/device/dynamic_configuration/src/main.c
+++ b/examples/device/dynamic_configuration/src/main.c
@@ -165,6 +165,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;
diff --git a/examples/device/midi_test/src/main.c b/examples/device/midi_test/src/main.c
index 96292dd6b..d92621fc9 100644
--- a/examples/device/midi_test/src/main.c
+++ b/examples/device/midi_test/src/main.c
@@ -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;