summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usb-led/usb-led.c7
-rw-r--r--usb-spi/usb-spi.c83
2 files changed, 27 insertions, 63 deletions
diff --git a/usb-led/usb-led.c b/usb-led/usb-led.c
index d7cbce5..5493ebc 100644
--- a/usb-led/usb-led.c
+++ b/usb-led/usb-led.c
@@ -26,12 +26,9 @@
#include <avr/interrupt.h>
#include <avr/power.h>
-#include "lufa-descriptor-usbserial.h"
-
#include "util.h"
#include "led.h"
-/* some parts of this examaple are based on LUFA */
/*
LUFA Library
Copyright (C) Dean Camera, 2012.
@@ -39,8 +36,8 @@
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
-
#include <LUFA/Drivers/USB/USB.h>
+#include "lufa-descriptor-usbserial.h"
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
@@ -71,7 +68,7 @@ void EVENT_USB_Device_ControlRequest(void)
{
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
}
-
+/* end LUFA CDC-ACM specific definitions*/
void handle_cmd(uint8_t cmd)
{
diff --git a/usb-spi/usb-spi.c b/usb-spi/usb-spi.c
index 1dc438c..803214c 100644
--- a/usb-spi/usb-spi.c
+++ b/usb-spi/usb-spi.c
@@ -20,9 +20,13 @@
* along with spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <avr/io.h>
+#include <avr/wdt.h>
+#include <avr/interrupt.h>
+#include <avr/power.h>
-/* this is based on the LUFA example Project USBtoSerial
- this is their LICENSE Header */
+#include "util.h"
+#include "led.h"
/*
LUFA Library
@@ -31,55 +35,11 @@
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.
-*/
-
-/** \file
- *
- * Main source file for the USBtoSerial project. This file contains the main tasks of
- * the project and is responsible for the initial application hardware configuration.
- */
-
-
-#include <avr/io.h>
-#include <avr/wdt.h>
-#include <avr/interrupt.h>
-#include <avr/power.h>
-
-#include "lufa-descriptor-usbserial.h"
-
-#include "util.h"
-#include "led.h"
-
#include <LUFA/Version.h>
#include <LUFA/Drivers/Peripheral/SPI.h>
#include <LUFA/Drivers/Misc/RingBuffer.h>
#include <LUFA/Drivers/USB/USB.h>
-
- /* Hardware Defines: */
-#define SPI_CS_DDR DDRB
-#define SPI_CS_PORT PORTB
-#define CS 0
+#include "lufa-descriptor-usbserial.h"
/* Global I/O Buffers: */
static RingBuffer_t USBtoSPI_Buffer;
@@ -111,6 +71,23 @@ 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);
+}
+/* end LUFA CDC-ACM specific definitions*/
+
+
+ /* Hardware Defines: */
+#define SPI_CS_DDR DDRB
+#define SPI_CS_PORT PORTB
+#define CS 0
+
void SetupHardware(void)
{
MCUSR &= ~(1 << WDRF);
@@ -128,7 +105,7 @@ void SetupHardware(void)
SPI_CS_PORT |= (1<<CS);
}
-void SPI_TransferBuffer()
+void SPI_TransferBuffer(void)
{
SPI_CS_PORT &= ~(1<<CS);
led_on();
@@ -146,16 +123,6 @@ void SPI_TransferBuffer()
SPI_CS_PORT |= (1<<CS);
}
-void EVENT_USB_Device_ConfigurationChanged(void)
-{
- CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
-}
-
-void EVENT_USB_Device_ControlRequest(void)
-{
- CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
-}
-
int main(void)
{
SetupHardware();