X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/f1b6ddb7107fd9534cc6a8d6ab2d46f349d9cdb7..9e8bf8c0cfba6613d10a90b0ce76bdbbc9a72c8b:/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c index 36ff503f7..13c8018ed 100644 --- a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c +++ b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2012. + Copyright (C) Dean Camera, 2013. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted @@ -18,7 +18,7 @@ advertising or publicity pertaining to distribution of the software without specific, written prior permission. - The author disclaim all warranties with regard to this + The author disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, indirect or consequential damages or any damages @@ -44,14 +44,21 @@ USB_ClassInfo_CDC_Host_t VirtualSerial_CDC_Interface = { .Config = { - .DataINPipeNumber = 1, - .DataINPipeDoubleBank = false, - - .DataOUTPipeNumber = 2, - .DataOUTPipeDoubleBank = false, - - .NotificationPipeNumber = 3, - .NotificationPipeDoubleBank = false, + .DataINPipe = + { + .Address = (PIPE_DIR_IN | 1), + .Banks = 1, + }, + .DataOUTPipe = + { + .Address = (PIPE_DIR_OUT | 2), + .Banks = 1, + }, + .NotificationPipe = + { + .Address = (PIPE_DIR_IN | 3), + .Banks = 1, + }, }, }; @@ -66,7 +73,7 @@ int main(void) puts_P(PSTR(ESC_FG_CYAN "CDC Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); - sei(); + GlobalInterruptEnable(); for (;;) { @@ -163,6 +170,18 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); return; } + + VirtualSerial_CDC_Interface.State.LineEncoding.BaudRateBPS = 9600; + VirtualSerial_CDC_Interface.State.LineEncoding.CharFormat = CDC_LINEENCODING_OneStopBit; + VirtualSerial_CDC_Interface.State.LineEncoding.ParityType = CDC_PARITY_None; + VirtualSerial_CDC_Interface.State.LineEncoding.DataBits = 8; + + if (CDC_Host_SetLineEncoding(&VirtualSerial_CDC_Interface)) + { + puts_P(PSTR("Error Setting Device Line Encoding.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } puts_P(PSTR("CDC Device Enumerated.\r\n")); LEDs_SetAllLEDs(LEDMASK_USB_READY);