diff options
| author | Reinhard Panhuber <[email protected]> | 2021-02-23 19:47:57 +0100 |
|---|---|---|
| committer | Reinhard Panhuber <[email protected]> | 2021-02-23 19:47:57 +0100 |
| commit | e223d46033ad9d947724130bf484147555caf83b (patch) | |
| tree | d4ed631c04e31db6b7f7dcc3c91cae38f2ea93a1 /examples/device | |
| parent | 313dd1439db037e676429d11646008f143e6bdb9 (diff) | |
| parent | ac30211853e9f8948d03db871f839e93a75b1edd (diff) | |
Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer
Conflicts:
src/common/tusb_fifo.h
src/osal/osal_none.h
Diffstat (limited to 'examples/device')
| -rw-r--r-- | examples/device/dynamic_configuration/src/main.c | 7 | ||||
| -rw-r--r-- | examples/device/midi_test/src/main.c | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/examples/device/dynamic_configuration/src/main.c b/examples/device/dynamic_configuration/src/main.c index 45786e99a..acee295f6 100644 --- a/examples/device/dynamic_configuration/src/main.c +++ b/examples/device/dynamic_configuration/src/main.c @@ -165,6 +165,9 @@ void midi_task(void) { static uint32_t start_ms = 0; + uint8_t const cable_num = 0; // MIDI jack associated with USB endpoint + uint8_t const channel = 0; // 0 for channel 1 + // 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 @@ -183,10 +186,10 @@ void midi_task(void) if (previous < 0) previous = sizeof(note_sequence) - 1; // Send Note On for current position at full velocity (127) on channel 1. - tudi_midi_write24(0, 0x90, note_sequence[note_pos], 127); + tud_midi_write24(cable_num, 0x90 | channel, note_sequence[note_pos], 127); // Send Note Off for previous note. - tudi_midi_write24(0, 0x80, note_sequence[previous], 0); + tud_midi_write24(cable_num, 0x80 | channel, note_sequence[previous], 0); // Increment position note_pos++; diff --git a/examples/device/midi_test/src/main.c b/examples/device/midi_test/src/main.c index d92621fc9..858a096b6 100644 --- a/examples/device/midi_test/src/main.c +++ b/examples/device/midi_test/src/main.c @@ -125,6 +125,9 @@ void midi_task(void) { static uint32_t start_ms = 0; + uint8_t const cable_num = 0; // MIDI jack associated with USB endpoint + uint8_t const channel = 0; // 0 for channel 1 + // 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 @@ -143,10 +146,10 @@ void midi_task(void) if (previous < 0) previous = sizeof(note_sequence) - 1; // Send Note On for current position at full velocity (127) on channel 1. - tudi_midi_write24(0, 0x90, note_sequence[note_pos], 127); + tud_midi_write24(cable_num, 0x90 | channel, note_sequence[note_pos], 127); // Send Note Off for previous note. - tudi_midi_write24(0, 0x80, note_sequence[previous], 0); + tud_midi_write24(cable_num, 0x80 | channel, note_sequence[previous], 0); // Increment position note_pos++; |
