X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/864196c884ef3602aee44f1a68aceb5819a07f21..a2001ac1ccf4d4919c8243fbc69aff0b68973d3f:/Projects/Benito/Benito.c diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c index 9e85fbd2f..afe29b4a9 100644 --- a/Projects/Benito/Benito.c +++ b/Projects/Benito/Benito.c @@ -79,7 +79,7 @@ int main(void) for (;;) { /* Echo bytes from the host to the target via the hardware USART */ - if (CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface)) + if (CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface) > 0) { Serial_TxByte(CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface)); @@ -102,7 +102,7 @@ int main(void) /* Check if the LEDs should be ping-ponging (during enumeration) */ if (PingPongMSRemaining && !(--PingPongMSRemaining)) { - LEDs_ToggleLEDs(LEDMASK_BUSY); + LEDs_ToggleLEDs(LEDMASK_TX | LEDMASK_RX); PingPongMSRemaining = PING_PONG_LED_PULSE_MS; } @@ -141,6 +141,7 @@ void SetupHardware(void) clock_prescale_set(clock_div_1); /* Hardware Initialization */ + Serial_Init(9600, false); LEDs_Init(); USB_Init(); @@ -155,33 +156,33 @@ void SetupHardware(void) } /** Event handler for the library USB Connection event. */ -void EVENT_USB_Connect(void) +void EVENT_USB_Device_Connect(void) { PingPongMSRemaining = PING_PONG_LED_PULSE_MS; LEDs_SetAllLEDs(LEDMASK_TX); } /** Event handler for the library USB Disconnection event. */ -void EVENT_USB_Disconnect(void) +void EVENT_USB_Device_Disconnect(void) { PingPongMSRemaining = 0; - LEDs_TurnOffLEDs(LEDMASK_BUSY); + LEDs_SetAllLEDs(LEDS_NO_LEDS); } /** Event handler for the library USB Configuration Changed event. */ -void EVENT_USB_ConfigurationChanged(void) +void EVENT_USB_Device_ConfigurationChanged(void) { PingPongMSRemaining = 0; - LEDs_TurnOffLEDs(LEDMASK_BUSY); + LEDs_SetAllLEDs(LEDS_NO_LEDS); if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface))) - LEDs_TurnOnLEDs(LEDMASK_ERROR); + LEDs_SetAllLEDs(LEDMASK_ERROR); } -/** Event handler for the library USB Unhandled Control Packet event. */ -void EVENT_USB_UnhandledControlPacket(void) +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) { - CDC_Device_ProcessControlPacket(&VirtualSerial_CDC_Interface); + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } /** Event handler for the CDC Class driver Line Encoding Changed event. @@ -233,9 +234,9 @@ void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const C /* Check if the DTR line has been asserted - if so, start the target AVR's reset pulse */ if (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR) { - LEDs_TurnOnLEDs(LEDMASK_BUSY); + LEDs_SetAllLEDs(LEDMASK_BUSY); - AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK; - ResetPulseMSRemaining = AVR_RESET_PULSE_MS; + AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK; + ResetPulseMSRemaining = AVR_RESET_PULSE_MS; } }