Fixed broken USBFOO board drivers due to missing BOARD_USBFOO define.
[pub/USBasp.git] / Projects / Benito / Benito.c
index 37a5850..fbb8184 100644 (file)
@@ -92,10 +92,9 @@ int main(void)
        for (;;)
        {
                /* Echo bytes from the host to the target via the hardware USART */
-               int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
-               if (!(ReceivedByte < 0) && (UCSR1A & (1 << UDRE1)))
+               if ((UCSR1A & (1 << UDRE1)) && CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface))
                {
-                       UDR1 = ReceivedByte;
+                       UDR1 = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
 
                        LEDs_TurnOnLEDs(LEDMASK_TX);
                        PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS;
@@ -199,8 +198,11 @@ void EVENT_USB_Device_ConfigurationChanged(void)
        LEDs_SetAllLEDs(ConfigSuccess ? LEDS_NO_LEDS : LEDMASK_ERROR);
 }
 
-/** Event handler for the library USB Unhandled Control Request event. */
-void EVENT_USB_Device_UnhandledControlRequest(void)
+/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
+ *  the device from the USB host before passing along unhandled control requests to the library for processing
+ *  internally.
+ */
+void EVENT_USB_Device_ControlRequest(void)
 {
        CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
 }