From 0670a64f02a584d83fe44a57b23411e004920be7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 16 Feb 2013 23:46:31 +0000 Subject: hhd70dongle now uses new usbio lib git-svn-id: https://svn.spreadspace.org/mur.sat@674 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/hhd70dongle/Makefile | 2 +- software/hhd70dongle/hhd70dongle.c | 75 +++----------------------------------- 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 -//#include -#include -#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< 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) { -- cgit v1.2.3