Skip to content

Commit 253e41a

Browse files
author
Francois Best
committed
Add dep to MidiUSB for specific example & guards for non-usb boards.
1 parent 29c705f commit 253e41a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ env:
2626
- PLATFORMIO_CI_SRC=examples/Callbacks
2727
- PLATFORMIO_CI_SRC=examples/DualMerger
2828
- PLATFORMIO_CI_SRC=examples/Input
29-
- PLATFORMIO_CI_SRC=examples/MidiUSB
29+
- PLATFORMIO_CI_SRC=examples/MidiUSB PLATFORMIO_CI_EXTRA_ARGS="--lib=external/midi-usb/src"
3030
- PLATFORMIO_CI_SRC=examples/RPN_NRPN
3131
- PLATFORMIO_CI_SRC=examples/SimpleSynth
3232

@@ -74,7 +74,7 @@ script:
7474
# Build current example
7575
- |
7676
if [ ! "${BUILD_UNIT_TESTS}" ]; then
77-
platformio ci --lib="." --board=uno --board="due" --board="zero" --board="leonardo"
77+
platformio ci --lib="." --board=uno --board="due" --board="zero" --board="leonardo" $PLATFORMIO_CI_EXTRA_ARGS
7878
fi
7979
8080
after_success:

examples/MidiUSB/MidiUSB.ino

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#include <MIDI.h>
2+
3+
#if defined(USBCON)
24
#include <midi_UsbTransport.h>
35

46
static const unsigned sUsbTransportBufferSize = 16;
@@ -8,6 +10,10 @@ UsbTransport sUsbTransport;
810

911
MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, MIDI);
1012

13+
#else // No USB available, fallback to Serial
14+
MIDI_CREATE_DEFAULT_INSTANCE();
15+
#endif
16+
1117
// --
1218

1319
void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
@@ -36,4 +42,4 @@ void setup() {
3642

3743
void loop() {
3844
MIDI.read();
39-
}
45+
}

0 commit comments

Comments
 (0)