summaryrefslogtreecommitdiff
path: root/usb-led/usb-led.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-05-30 12:27:56 +0000
committerChristian Pointner <equinox@spreadspace.org>2012-05-30 12:27:56 +0000
commit042ba3534e9c12c4f5f5b22647c117ccaa7c2ad7 (patch)
tree1dd47f3ee12439530acb651106508cd36c96263d /usb-led/usb-led.c
parentadded distclean target (diff)
cleanup
git-svn-id: https://svn.spreadspace.org/avr/trunk@48 aa12f405-d877-488e-9caf-2d797e2a1cc7
Diffstat (limited to 'usb-led/usb-led.c')
-rw-r--r--usb-led/usb-led.c71
1 files changed, 30 insertions, 41 deletions
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 <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
@@ -42,17 +31,17 @@
#include "util.h"
#include "led.h"
-#include <LUFA/Drivers/USB/USB.h>
+/* 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/Drivers/USB/USB.h>
-/** 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);
-}