From 1ed4c9f4f719b57a42ed1264e804dcae25e5322f Mon Sep 17 00:00:00 2001 From: Fabio Massaioli Date: Thu, 4 Apr 2013 00:29:18 +0200 Subject: Fix MIDI RX bug: the MIDIUSB class was trying to receive data from CDC endpoint --- avr/cores/arcore/MIDIUSB.cpp | 2 +- avr/cores/arcore/USBCore.cpp | 4 +++- 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)) -- cgit v1.2.3