|
32 | 32 | #include <MIDI.h>
|
33 | 33 | #include <MIDIUSB.h>
|
34 | 34 |
|
| 35 | +// setup Dotstar LED on Trinket M0 |
| 36 | +#include <Adafruit_DotStar.h> |
| 37 | +#define DATAPIN 7 |
| 38 | +#define CLOCKPIN 8 |
| 39 | +Adafruit_DotStar strip = Adafruit_DotStar(1, DATAPIN, CLOCKPIN, DOTSTAR_BRG); |
| 40 | + |
35 | 41 | // 1 turns on debug, 0 off
|
36 | 42 | #define DBGSERIAL if (0) SERIAL_PORT_MONITOR
|
37 | 43 |
|
@@ -99,12 +105,32 @@ void sysex_end(uint8_t i)
|
99 | 105 | sysexSize = 0;
|
100 | 106 | }
|
101 | 107 |
|
| 108 | +const uint8_t MIDI_passthru_pin=2; |
| 109 | +bool MIDI_passthru; |
102 | 110 |
|
103 | 111 | void setup() {
|
| 112 | + // Turn off built-in RED LED |
| 113 | + pinMode(LED_BUILTIN, OUTPUT); |
| 114 | + digitalWrite(LED_BUILTIN, LOW); |
| 115 | + // Turn off built-in Dotstar RGB LED |
| 116 | + strip.begin(); |
| 117 | + strip.clear(); |
| 118 | + strip.show(); |
| 119 | + |
104 | 120 | DBGSERIAL.begin(115200);
|
105 | 121 |
|
| 122 | + // Pin 0 LOW selects MIDI pass through on |
| 123 | + pinMode(MIDI_passthru_pin, INPUT_PULLUP); |
| 124 | + MIDI_passthru = (digitalRead(MIDI_passthru_pin) == LOW); |
| 125 | + |
106 | 126 | MIDIUART.begin(MIDI_CHANNEL_OMNI);
|
107 |
| - MIDIUART.turnThruOff(); |
| 127 | + if (MIDI_passthru) { |
| 128 | + DBGSERIAL.println("MIDI thru on"); |
| 129 | + } |
| 130 | + else { |
| 131 | + DBGSERIAL.println("MIDI thru off"); |
| 132 | + MIDIUART.turnThruOff(); |
| 133 | + } |
108 | 134 | }
|
109 | 135 |
|
110 | 136 | void loop()
|
@@ -142,6 +168,8 @@ void loop()
|
142 | 168 | case midi::SystemExclusive:
|
143 | 169 | USBSystemExclusive(MIDIUART.getSysExArrayLength(),
|
144 | 170 | (byte *)MIDIUART.getSysExArray(), true);
|
| 171 | + DBGSERIAL.print("sysex size "); |
| 172 | + DBGSERIAL.println(MIDIUART.getSysExArrayLength()); |
145 | 173 | MidiUSB.flush();
|
146 | 174 | break;
|
147 | 175 | case midi::TuneRequest:
|
|
0 commit comments