diff options
author | Christian Pointner <equinox@spreadspace.org> | 2013-08-17 18:42:31 +0000 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2013-08-17 18:42:31 +0000 |
commit | 8e36782588930e2a8f0e2d83ed20c76ace2c94c7 (patch) | |
tree | d86221f801367acd11118cbf12bc25de690683c1 /lib/anyio.c | |
parent | added jtag_disable to make PORTF usable (diff) |
fixed enumartion after bootloader
git-svn-id: https://svn.spreadspace.org/avr/trunk@222 aa12f405-d877-488e-9caf-2d797e2a1cc7
Diffstat (limited to 'lib/anyio.c')
-rw-r--r-- | lib/anyio.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/anyio.c b/lib/anyio.c index 1ad4e96..aaa5f47 100644 --- a/lib/anyio.c +++ b/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; |