From 10859a834fbc1f3a125db09876b8adf71b147968 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 17 Aug 2013 18:55:38 +0000 Subject: upgraded avr utils git-svn-id: https://svn.spreadspace.org/mur.sat@831 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/avr.lib/anyio.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'software/avr.lib/anyio.c') diff --git a/software/avr.lib/anyio.c b/software/avr.lib/anyio.c index 1ad4e96..aaa5f47 100644 --- a/software/avr.lib/anyio.c +++ b/software/avr.lib/anyio.c @@ -83,8 +83,13 @@ void anyio_init(const uint32_t baudrate, const uint8_t doublespeed) void anyio_task(void) { - CDC_Device_USBTask(&VirtualSerial_CDC_Interface); - USB_USBTask(); + if(USB_DeviceState == DEVICE_STATE_Unattached && USB_VBUS_GetStatus()) { + USB_Disable(); + USB_Init(); + } + + CDC_Device_USBTask(&VirtualSerial_CDC_Interface); + USB_USBTask(); } int16_t anyio_bytes_received(void) @@ -95,7 +100,7 @@ int16_t anyio_bytes_received(void) return (int16_t)Serial_IsCharReceived(); } -void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) { if(CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR) stdin = stdout = stderr = &usb_stream; -- cgit v1.2.3