summaryrefslogtreecommitdiff
path: root/software/hhd70dongle
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2013-02-16 23:46:31 +0000
committerChristian Pointner <equinox@mur.at>2013-02-16 23:46:31 +0000
commit0670a64f02a584d83fe44a57b23411e004920be7 (patch)
tree6132e61d8e2ecfdc545a16cbda5a4a119804f975 /software/hhd70dongle
parentupgraded avr buildroot (diff)
hhd70dongle now uses new usbio lib
git-svn-id: https://svn.spreadspace.org/mur.sat@674 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/hhd70dongle')
-rw-r--r--software/hhd70dongle/Makefile2
-rw-r--r--software/hhd70dongle/hhd70dongle.c75
2 files changed, 7 insertions, 70 deletions
diff --git a/software/hhd70dongle/Makefile b/software/hhd70dongle/Makefile
index 29dca09..1519a5f 100644
--- a/software/hhd70dongle/Makefile
+++ b/software/hhd70dongle/Makefile
@@ -23,7 +23,7 @@
NAME := hhd70dongle
BOARD_TYPE := hhd70dongle
OBJ := $(NAME).o hhd70.o c1101lib.o util.o
-LIBS := led lufa-descriptor-usbserial
+LIBS := led lufa-descriptor-usbserial usbio
RESET_FUNC := ./reset.sh
EXTERNAL_LIBS := lufa
diff --git a/software/hhd70dongle/hhd70dongle.c b/software/hhd70dongle/hhd70dongle.c
index d094e6c..c93e7a8 100644
--- a/software/hhd70dongle/hhd70dongle.c
+++ b/software/hhd70dongle/hhd70dongle.c
@@ -38,6 +38,8 @@
#include "led.h"
#include "util.h"
+#include "usbio.h"
+
#include "hhd70.h"
#include "c1101lib.h"
@@ -64,70 +66,6 @@ char write_buffer[64]; // buffer for writing usb signals
// * safely save state in eeprom (2 memory regions, only use the one with the "written successfully bit" which is written last)
// * what if c1101 resets spuriously and clears it's settings ? -> check peridically ?
-
-/* ###### ######
- LUFA Library
- Copyright (C) Dean Camera, 2012.
-
- dean [at] fourwalledcubicle [dot] com
- www.lufa-lib.org
-*/
-//#include <LUFA/Drivers/Peripheral/SPI.h>
-//#include <LUFA/Drivers/Misc/RingBuffer.h>
-#include <LUFA/Drivers/USB/USB.h>
-#include "lufa-descriptor-usbserial.h"
-
- /* Global I/O Buffers: */
-//static RingBuffer_t SPItoUSB_Buffer;
-//static uint8_t SPItoUSB_Buffer_Data[8];
-
-/** 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 =
- {
- .ControlInterfaceNumber = 0,
-
- .DataINEndpointNumber = CDC_TX_EPNUM,
- .DataINEndpointSize = CDC_TXRX_EPSIZE,
- .DataINEndpointDoubleBank = false,
-
- .DataOUTEndpointNumber = CDC_RX_EPNUM,
- .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
- .DataOUTEndpointDoubleBank = false,
-
- .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
- .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
- .NotificationEndpointDoubleBank = false,
- },
- };
-
-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 ###### */
-
-FILE usb_stream;
-
-/* this creates an non-blocking IO Stream which can be used by printf and scanf */
-void stdio_init(void)
-{
- CDC_Device_CreateStream(&VirtualSerial_CDC_Interface,&usb_stream);
- stdin = &usb_stream;
- stdout = &usb_stream;
- stderr = &usb_stream;
-}
-
-
bool enable_tx_part=false;
bool enable_rx_part=false;
bool enable_beacon_part=false;
@@ -185,8 +123,7 @@ int main(void)
CPU_PRESCALE(0); //cpu_init
led_init();
- USB_Init();
- stdio_init();
+ usbio_init();
hhd70_init();
DDRB &= ~(1<<DDB5); // set PB5/ADC12 to INPUT (c1101 temp sensor)
@@ -215,7 +152,7 @@ int main(void)
for(;;)
{
- int16_t num_bytes_received = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface);
+ int16_t num_bytes_received = usbio_bytes_received();
while(num_bytes_received > 0)
{
int16_t recv_byte = fgetc(stdin);
@@ -361,8 +298,8 @@ int main(void)
}
}
- CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
- USB_USBTask();
+
+ usbio_task();
if (enable_rx_part)
{