Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Read MIDI messages to avoid lockups.
- Loading branch information
Showing
with
8 additions
and
0 deletions.
-
+8
−0
firmware/_16n_faderbank_firmware/_16n_faderbank_firmware.ino
|
|
@@ -64,6 +64,7 @@ const int muxMapping[16] = { 0,1,2,3,4,5,6,7,15,14,13,12,11,10,9,8 }; |
|
|
|
|
|
// the MIDI write timer |
|
|
IntervalTimer midiWriteTimer; |
|
|
IntervalTimer midiReadTimer; |
|
|
int midiInterval = 5000; // 5ms |
|
|
|
|
|
// helper values for i2c reading and future expansion |
|
|
@@ -140,6 +141,7 @@ void setup() { |
|
|
// turn on the MIDI party |
|
|
MIDI.begin(); |
|
|
midiWriteTimer.begin(writeMidi, midiInterval); |
|
|
midiReadTimer.begin(readMidi,midiInterval); |
|
|
|
|
|
#ifdef LED |
|
|
pinMode(13, OUTPUT); |
|
|
@@ -180,6 +182,12 @@ void loop() { |
|
|
} |
|
|
} |
|
|
|
|
|
void readMidi() { |
|
|
// important to catch inbound MIDI messages even if we do nothiing with them. |
|
|
MIDI.read(); |
|
|
usbMIDI.read(); |
|
|
} |
|
|
|
|
|
/* |
|
|
* The function that writes changes in slider positions out the midi ports |
|
|
*/ |
|
|
|