diff options
-rw-r--r-- | README | 40 | ||||
-rw-r--r-- | usb-led/usb-led.c | 71 |
2 files changed, 70 insertions, 41 deletions
@@ -54,3 +54,43 @@ build and flash blink example # make # make program # make run + + +License +======= + +The spreadspace AVR utils are licensed under GPLv3. You can find the +full text of the license in the file LICENSE. + +Some examples are based on LUFA which has been licensed under the +following conditions. + +/* + LUFA Library + Copyright (C) Dean Camera, 2012. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2012 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 + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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 + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ 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);
-}
|