00001 /* 00002 * This implementation of a serial.c-like interface for the Teacup firmware 00003 * is based on LUFA/Demos/Device/LowLevel/VirtualSerial. 00004 * 00005 * Modifications by Ben Jackson <ben@ben.com> under GPLv2 00006 */ 00007 00008 /* 00009 LUFA Library 00010 Copyright (C) Dean Camera, 2010. 00011 00012 dean [at] fourwalledcubicle [dot] com 00013 www.lufa-lib.org 00014 */ 00015 00016 /* 00017 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) 00018 00019 Permission to use, copy, modify, distribute, and sell this 00020 software and its documentation for any purpose is hereby granted 00021 without fee, provided that the above copyright notice appear in 00022 all copies and that both that the copyright notice and this 00023 permission notice and warranty disclaimer appear in supporting 00024 documentation, and that the name of the author not be used in 00025 advertising or publicity pertaining to distribution of the 00026 software without specific, written prior permission. 00027 00028 The author disclaim all warranties with regard to this 00029 software, including all implied warranties of merchantability 00030 and fitness. In no event shall the author be liable for any 00031 special, indirect or consequential damages or any damages 00032 whatsoever resulting from loss of use, data or profits, whether 00033 in an action of contract, negligence or other tortious action, 00034 arising out of or in connection with the use or performance of 00035 this software. 00036 */ 00037 00043 #ifndef _VIRTUALSERIAL_H_ 00044 #define _VIRTUALSERIAL_H_ 00045 00046 /* Includes: */ 00047 #include <avr/io.h> 00048 #include <avr/wdt.h> 00049 #include <avr/power.h> 00050 #include <avr/interrupt.h> 00051 #include <string.h> 00052 00053 #include "Descriptors.h" 00054 00055 #include <LUFA/Version.h> 00056 #include <LUFA/Drivers/USB/USB.h> 00057 #include <LUFA/Drivers/Board/Joystick.h> 00058 #include <LUFA/Drivers/Board/LEDs.h> 00059 00060 /* Macros: */ 00062 #define LEDMASK_USB_NOTREADY LEDS_LED1 00063 00065 #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) 00066 00068 #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) 00069 00071 #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) 00072 00073 /* Function Prototypes: */ 00074 void SetupHardware(void); 00075 void CDC_Task(void); 00076 00077 void EVENT_USB_Device_Connect(void); 00078 void EVENT_USB_Device_Disconnect(void); 00079 void EVENT_USB_Device_ConfigurationChanged(void); 00080 void EVENT_USB_Device_ControlRequest(void); 00081 00082 #endif 00083