Add dep to MidiUSB for specific example & guards for non-usb boards.

This commit is contained in:
Francois Best 2016-11-02 00:05:27 +01:00
parent 29c705fbfa
commit 253e41acc6
2 changed files with 9 additions and 3 deletions

View File

@ -26,7 +26,7 @@ env:
- PLATFORMIO_CI_SRC=examples/Callbacks - PLATFORMIO_CI_SRC=examples/Callbacks
- PLATFORMIO_CI_SRC=examples/DualMerger - PLATFORMIO_CI_SRC=examples/DualMerger
- PLATFORMIO_CI_SRC=examples/Input - PLATFORMIO_CI_SRC=examples/Input
- PLATFORMIO_CI_SRC=examples/MidiUSB - PLATFORMIO_CI_SRC=examples/MidiUSB PLATFORMIO_CI_EXTRA_ARGS="--lib=external/midi-usb/src"
- PLATFORMIO_CI_SRC=examples/RPN_NRPN - PLATFORMIO_CI_SRC=examples/RPN_NRPN
- PLATFORMIO_CI_SRC=examples/SimpleSynth - PLATFORMIO_CI_SRC=examples/SimpleSynth
@ -74,7 +74,7 @@ script:
# Build current example # Build current example
- | - |
if [ ! "${BUILD_UNIT_TESTS}" ]; then if [ ! "${BUILD_UNIT_TESTS}" ]; then
platformio ci --lib="." --board=uno --board="due" --board="zero" --board="leonardo" platformio ci --lib="." --board=uno --board="due" --board="zero" --board="leonardo" $PLATFORMIO_CI_EXTRA_ARGS
fi fi
after_success: after_success:

View File

@ -1,4 +1,6 @@
#include <MIDI.h> #include <MIDI.h>
#if defined(USBCON)
#include <midi_UsbTransport.h> #include <midi_UsbTransport.h>
static const unsigned sUsbTransportBufferSize = 16; static const unsigned sUsbTransportBufferSize = 16;
@ -8,6 +10,10 @@ UsbTransport sUsbTransport;
MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, MIDI); MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, MIDI);
#else // No USB available, fallback to Serial
MIDI_CREATE_DEFAULT_INSTANCE();
#endif
// -- // --
void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
@ -36,4 +42,4 @@ void setup() {
void loop() { void loop() {
MIDI.read(); MIDI.read();
} }