diff options
| author | Zixun LI <[email protected]> | 2026-07-05 17:46:14 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-07-05 17:46:14 +0200 |
| commit | 536157cb98fbc40329c9695281506fe7f04e526f (patch) | |
| tree | ced35911cd15c1d6b7cca9b63b517168f123cc94 /examples/device/midi2_device/src/main.c | |
| parent | 3579ea1888936bfe46b5a5635727707168b62223 (diff) | |
| parent | 0309e7c016b5217734791ba5ad8f3fd8c82ac2e1 (diff) | |
Merge pull request #3738 from sauloverissimo/fix/midi2-fb-direction
feat(midi2): derive function blocks from the GTB descriptor
Diffstat (limited to 'examples/device/midi2_device/src/main.c')
| -rw-r--r-- | examples/device/midi2_device/src/main.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/device/midi2_device/src/main.c b/examples/device/midi2_device/src/main.c index ce052a20b..2c77652dc 100644 --- a/examples/device/midi2_device/src/main.c +++ b/examples/device/midi2_device/src/main.c @@ -546,6 +546,25 @@ void tud_midi2_set_itf_cb(uint8_t itf, uint8_t alt) { printf("[ALT] Host selected alt=%u\r\n", (unsigned)alt); } +// PROTOTYPE: two Function Blocks with independent directions. +// FB0: output only, group 0 FB1: input only, group 1 +static const uint8_t gtb_two_blocks[] = { + TUD_MIDI2_GTB_HEADER(2), + TUD_MIDI2_GTB_BLOCK(1, MIDI2_GTB_OUTPUT_ONLY, 0, 1, 0), // block 1: group 0 + TUD_MIDI2_GTB_BLOCK(2, MIDI2_GTB_INPUT_ONLY, 1, 1, 0), // block 2: group 1 +}; + +const uint8_t* tud_midi2_gtb_desc_cb(uint8_t itf, uint16_t* len) { + (void)itf; + *len = sizeof(gtb_two_blocks); + return gtb_two_blocks; +} + +const char* tud_midi2_fb_name_cb(uint8_t itf, uint8_t fb_idx) { + (void)itf; + return (fb_idx == 0) ? "Synth Out" : "Keys In"; +} + //--------------------------------------------------------------------+ // Initial Setup - Program Change, CC, Per-Note Management //--------------------------------------------------------------------+ |
