diff options
author | Christian Pointner <equinox@spreadspace.org> | 2012-05-31 01:32:59 +0000 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2012-05-31 01:32:59 +0000 |
commit | d583d39b48120fa907a53dbaddc53709a4bdef12 (patch) | |
tree | e155fc05f59071f34a7a88dc116723a255f06e0a /usb-spi | |
parent | fixed ring buffer error (diff) |
cleanup
git-svn-id: https://svn.spreadspace.org/avr/trunk@53 aa12f405-d877-488e-9caf-2d797e2a1cc7
Diffstat (limited to 'usb-spi')
-rw-r--r-- | usb-spi/usb-spi.c | 83 |
1 files changed, 25 insertions, 58 deletions
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();
|