From 042ba3534e9c12c4f5f5b22647c117ccaa7c2ad7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 30 May 2012 12:27:56 +0000 Subject: cleanup git-svn-id: https://svn.spreadspace.org/avr/trunk@48 aa12f405-d877-488e-9caf-2d797e2a1cc7 --- usb-led/usb-led.c | 71 +++++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 41 deletions(-) (limited to 'usb-led/usb-led.c') diff --git a/usb-led/usb-led.c b/usb-led/usb-led.c index b58a180..d7cbce5 100644 --- a/usb-led/usb-led.c +++ b/usb-led/usb-led.c @@ -21,17 +21,6 @@ */ -/* this is based on the LUFA example Project USBtoSerial - this is their Copyright Header */ - -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - #include #include #include @@ -42,17 +31,17 @@ #include "util.h" #include "led.h" -#include +/* some parts of this examaple are based on LUFA */ +/* + LUFA Library + Copyright (C) Dean Camera, 2012. - /* Function Prototypes: */ -void handle_cmd(uint8_t cmd); -void EVENT_USB_Device_ConfigurationChanged(void); -void EVENT_USB_Device_ControlRequest(void); + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +#include -/** LUFA CDC Class driver interface configuration and state information. This structure is - * passed to all CDC Class driver functions, so that multiple instances of the same class - * within a device can be differentiated from one another. - */ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = @@ -73,6 +62,27 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = }, }; +void EVENT_USB_Device_ConfigurationChanged(void) +{ + CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); +} + +void EVENT_USB_Device_ControlRequest(void) +{ + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); +} + + +void handle_cmd(uint8_t cmd) +{ + switch(cmd) { + case '0': led_off(); break; + case '1': led_on(); break; + case 't': led_toggle(); break; + default: CDC_Device_SendString(&VirtualSerial_CDC_Interface, "error\n"); return; + } + CDC_Device_SendString(&VirtualSerial_CDC_Interface, "ok\n"); +} int main(void) { @@ -98,24 +108,3 @@ int main(void) USB_USBTask(); } } - -void handle_cmd(uint8_t cmd) -{ - switch(cmd) { - case '0': led_off(); break; - case '1': led_on(); break; - case 't': led_toggle(); break; - default: CDC_Device_SendString(&VirtualSerial_CDC_Interface, "error\n"); return; - } - CDC_Device_SendString(&VirtualSerial_CDC_Interface, "ok\n"); -} - -void EVENT_USB_Device_ConfigurationChanged(void) -{ - CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); -} - -void EVENT_USB_Device_ControlRequest(void) -{ - CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); -} -- cgit v1.2.3