Skip to content

Commit 6f5bc70

Browse files
committed
Turn off LEDs
Ground pin 2 to enable MIDI pass thru. Add Trinket M0 UF2 file for easy firmware programming.
1 parent 9d3a9e8 commit 6f5bc70

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

MIDIUARTUSB.ino

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
#include <MIDI.h>
3333
#include <MIDIUSB.h>
3434

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+
3541
// 1 turns on debug, 0 off
3642
#define DBGSERIAL if (0) SERIAL_PORT_MONITOR
3743

@@ -99,12 +105,32 @@ void sysex_end(uint8_t i)
99105
sysexSize = 0;
100106
}
101107

108+
const uint8_t MIDI_passthru_pin=2;
109+
bool MIDI_passthru;
102110

103111
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+
104120
DBGSERIAL.begin(115200);
105121

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+
106126
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+
}
108134
}
109135

110136
void loop()
@@ -142,6 +168,8 @@ void loop()
142168
case midi::SystemExclusive:
143169
USBSystemExclusive(MIDIUART.getSysExArrayLength(),
144170
(byte *)MIDIUART.getSysExArray(), true);
171+
DBGSERIAL.print("sysex size ");
172+
DBGSERIAL.println(MIDIUART.getSysExArrayLength());
145173
MidiUSB.flush();
146174
break;
147175
case midi::TuneRequest:

MIDIUARTUSB.ino.trinket_m0.uf2

29.5 KB
Binary file not shown.

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,22 @@ resistor values on the MIDI board for 3.3V operation.
4949

5050
![Trinket M0 3.3V with MIDI breakout board](https://github.com/gdsports/MIDIUARTUSB/blob/master/images/trinketm0_midi.jpg)
5151

52+
## Options
53+
54+
Ground pin 2 to enable MIDI pass thru.
55+
56+
## Trinket M0 firmware
57+
58+
Compiled programs can be burned into the Trinket M0 just by dragging and
59+
dropping a UF2 file on to the Trinket M0 USB drive. There is no need to install
60+
the Arduino IDE, source code, or USB serial device driver.
61+
62+
* Download the UF2 file.
63+
* Plug in the Trinket M0 to the computer.
64+
* Double tap the Trinket M0 reset button.
65+
* When the TRINKETBOOT USB drive appears, drop the UF2 file on to the drive.
66+
* Wait until the Trinket M0 reboots.
67+
5268
## References
5369

5470
https://www.midi.org/specifications/

0 commit comments

Comments
 (0)