aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Massaioli <fabio.massaioli@virgilio.it>2013-04-04 00:29:18 +0200
committerFabio Massaioli <fabio.massaioli@virgilio.it>2013-04-04 00:29:18 +0200
commit1ed4c9f4f719b57a42ed1264e804dcae25e5322f (patch)
tree72cb37ee629293287bfda5afdd21f5be7aaa7e1d
parent5f45af0438d24d491caa39b67c0e4a68856d0bc9 (diff)
Fix MIDI RX bug: the MIDIUSB class was trying to receive data from CDC endpoint
-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))