aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Kistner <ralf.kistner@gmail.com>2013-04-04 01:33:24 -0700
committerRalf Kistner <ralf.kistner@gmail.com>2013-04-04 01:33:24 -0700
commit4c377becab19d2a10b3036dd1bc6b7688f914daa (patch)
tree72cb37ee629293287bfda5afdd21f5be7aaa7e1d
parent5f45af0438d24d491caa39b67c0e4a68856d0bc9 (diff)
parent1ed4c9f4f719b57a42ed1264e804dcae25e5322f (diff)
Merge pull request #1 from fbbdev/master
Fix for MIDI RX bug
-rw-r--r--avr/cores/arcore/MIDIUSB.cpp2
-rw-r--r--avr/cores/arcore/USBCore.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/avr/cores/arcore/MIDIUSB.cpp b/avr/cores/arcore/MIDIUSB.cpp
index aeec8a7..74f3320 100644
--- a/avr/cores/arcore/MIDIUSB.cpp
+++ b/avr/cores/arcore/MIDIUSB.cpp
@@ -87,7 +87,7 @@ void MIDIUSB_::accept(void)
// while we have room to store a byte
while (i != buffer->tail) {
- int c = USB_Recv(CDC_RX);
+ int c = USB_Recv(MIDI_RX);
if (c == -1)
break; // no more data
buffer->buffer[buffer->head] = c;
diff --git a/avr/cores/arcore/USBCore.cpp b/avr/cores/arcore/USBCore.cpp
index 686a2e8..8b95058 100644
--- a/avr/cores/arcore/USBCore.cpp
+++ b/avr/cores/arcore/USBCore.cpp
@@ -630,7 +630,9 @@ ISR(USB_GEN_vect)
Serial.accept();
#endif
#ifdef MIDI_ENABLED
- MIDIUSB.accept();
+ USB_Flush(MIDI_TX);
+ if (USB_Available(MIDI_RX))
+ MIDIUSB.accept();
#endif
// check whether the one-shot period has elapsed. if so, turn off the LED
if (TxLEDPulse && !(--TxLEDPulse))