Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
87819f6
feat(usb): allow the MIDI constructor to define a device name
SuGlider Aug 12, 2025
e8d506c
feat(usb): changes the MIDI device descriptor in the example
SuGlider Aug 12, 2025
36ac341
feat(usb): changes the MIDI device descriptor in the example
SuGlider Aug 12, 2025
74fa530
fix(usb): typo in commentary - start CI again
SuGlider Aug 12, 2025
5af16d1
feat(usb): allow the MIDI constructor to define a device name
SuGlider Aug 12, 2025
8bb446b
fix(usb): correct constructor declaration
SuGlider Aug 12, 2025
fdd6ccd
fix(usb): typo in commentary - start CI again
SuGlider Aug 12, 2025
473a4c6
feat(usb_midi): Enhance USBMIDI with device name
SuGlider Aug 22, 2025
75d04db
feat(usb_midi): Refactor USBMIDI with device name handling
SuGlider Aug 22, 2025
b3fbce7
feat(usb_midi): Add macro to set USB MIDI device name
SuGlider Aug 22, 2025
c930bc1
feat(usb_midi): demonstrate the use of macro to change the device name
SuGlider Aug 22, 2025
40fbd4f
fix(usb_midi): reduce changes to the code
SuGlider Aug 22, 2025
059a037
Merge branch 'master' into feature/device_name_usb_midi
SuGlider Aug 22, 2025
fb36be8
fix(usb_midi): Add macro guards
SuGlider Aug 22, 2025
2f4667a
Merge branch 'master' into feature/device_name_usb_midi
SuGlider Sep 8, 2025
b7b61c3
feat(midi): add midi dev name from macro
SuGlider Sep 9, 2025
1b4aea2
feat(midi): Enhance USBMIDI device name handling
SuGlider Sep 9, 2025
60e4a0b
feat(midi): USBMIDI class for device name
SuGlider Sep 9, 2025
219f838
fix(midi): comment typo
SuGlider Sep 9, 2025
10e1948
fix(rmt): fixes bad commentary formating
SuGlider Sep 9, 2025
62659c9
feat(rmt): more commentaries
SuGlider Sep 9, 2025
0d4dce2
fix(midi): move commentaries
SuGlider Sep 9, 2025
f3bd145
fix(midi): move commentaries
SuGlider Sep 9, 2025
c5cb5f0
feat(midi): add more commentaries
SuGlider Sep 9, 2025
fa7d041
fix(midi): fixes constructor commentary
SuGlider Sep 9, 2025
ce55c99
fix(midi): safeguard for memory leak
SuGlider Sep 9, 2025
c14e769
fix(midi): removes debug logging
SuGlider Sep 9, 2025
861abb9
feat(midi): explicit safer test and return
SuGlider Sep 9, 2025
3f59ac6
feat(midi): avoids possible strlen(NULL)
SuGlider Sep 9, 2025
d9f89b8
Merge branch 'master' into feature/device_name_usb_midi
SuGlider Sep 10, 2025
4bca706
ci(pre-commit): Apply automatic fixes
pre-commit-ci-lite[bot] Sep 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ void loop() {}

#include "USB.h"
#include "USBMIDI.h"
USBMIDI MIDI;
// Create the MIDI device with specific descriptor
USBMIDI MIDI("ESP MIDI Device");

#define MIDI_NOTE_C4 60

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ void loop() {}

#include "USB.h"
#include "USBMIDI.h"
USBMIDI MIDI;
// Create the MIDI device with specific descriptor
USBMIDI MIDI("ESP MIDI Device");


#define MIDI_RX 39
#define MIDI_TX 40
Expand Down
7 changes: 4 additions & 3 deletions libraries/USB/src/USBMIDI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

static bool tinyusb_midi_descriptor_loaded = false;
static bool tinyusb_midi_interface_enabled = false;
static String deviceDescriptor("");

extern "C" uint16_t tusb_midi_load_descriptor(uint8_t *dst, uint8_t *itf) {
if (tinyusb_midi_descriptor_loaded) {
return 0;
}
tinyusb_midi_descriptor_loaded = true;

uint8_t str_index = tinyusb_add_string_descriptor("TinyUSB MIDI");
uint8_t str_index = tinyusb_add_string_descriptor(deviceDescriptor.c_str());
uint8_t ep_in = tinyusb_get_free_in_endpoint();
TU_VERIFY(ep_in != 0);
uint8_t ep_out = tinyusb_get_free_out_endpoint();
Expand All @@ -32,9 +32,10 @@ extern "C" uint16_t tusb_midi_load_descriptor(uint8_t *dst, uint8_t *itf) {
return TUD_MIDI_DESC_LEN;
}

USBMIDI::USBMIDI() {
USBMIDI::USBMIDI(String devDescName = "TinyUSB MIDI") {
if (!tinyusb_midi_interface_enabled) {
tinyusb_midi_interface_enabled = true;
deviceDescriptor = devDescName;
tinyusb_enable_interface(USB_INTERFACE_MIDI, TUD_MIDI_DESC_LEN, tusb_midi_load_descriptor);
} else {
log_e("USBMIDI: Multiple instances of USBMIDI not supported!");
Expand Down
Loading