summaryrefslogtreecommitdiff
path: root/supervisor/shared
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-11-16 17:04:42 -0800
committerScott Shawcroft <scott@tannewt.org>2019-01-09 14:02:11 -0800
commitb5e40f52c2b1c2890c866d7305e0e99b4811b7f5 (patch)
tree6fcfa19251ce19f5930f63343105c4820acbde23 /supervisor/shared
parent172311fad896fdb0780bdd6597b0b6d4d8bdadd3 (diff)
Add USB MIDI support for SAMD and nRF.
The API should be identical to using a UART for MIDI. Fixes #672
Diffstat (limited to 'supervisor/shared')
-rw-r--r--supervisor/shared/usb/tusb_config.h1
-rw-r--r--supervisor/shared/usb/usb.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/supervisor/shared/usb/tusb_config.h b/supervisor/shared/usb/tusb_config.h
index 649c390ac..301805275 100644
--- a/supervisor/shared/usb/tusb_config.h
+++ b/supervisor/shared/usb/tusb_config.h
@@ -75,6 +75,7 @@
#define CFG_TUD_CDC 1
#define CFG_TUD_MSC 1
#define CFG_TUD_HID 1
+#define CFG_TUD_MIDI 1
#define CFG_TUD_CUSTOM_CLASS 0
/*------------------------------------------------------------------*/
diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c
index 1aa34e9e6..5898323e8 100644
--- a/supervisor/shared/usb/usb.c
+++ b/supervisor/shared/usb/usb.c
@@ -26,6 +26,7 @@
#include "tick.h"
#include "shared-bindings/microcontroller/Processor.h"
+#include "shared-module/usb_midi/__init__.h"
#include "supervisor/port.h"
#include "supervisor/usb.h"
#include "lib/utils/interrupt_char.h"
@@ -71,11 +72,13 @@ void usb_init(void) {
// This callback always got invoked regardless of mp_interrupt_char value since we only set it once here
tud_cdc_set_wanted_char(CHAR_CTRL_C);
#endif
+
+ usb_midi_init();
}
void usb_background(void) {
if (usb_enabled()) {
- tusb_task();
+ tud_task();
tud_cdc_write_flush();
}
}