3      Copyright (C) Dean Camera, 2010. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, distribute, and sell this  
  13   software and its documentation for any purpose is hereby granted 
  14   without fee, provided that the above copyright notice appear in  
  15   all copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting  
  17   documentation, and that the name of the author not be used in  
  18   advertising or publicity pertaining to distribution of the  
  19   software without specific, written prior permission. 
  21   The author disclaim all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  33  *  Header file for DualVirtualSerial.c. 
  36 #ifndef _DUAL_VIRTUALSERIAL_H_ 
  37 #define _DUAL_VIRTUALSERIAL_H_ 
  42                 #include <avr/power.h> 
  45                 #include "Descriptors.h" 
  47                 #include <LUFA/Version.h> 
  48                 #include <LUFA/Drivers/USB/USB.h> 
  49                 #include <LUFA/Drivers/Board/Joystick.h> 
  50                 #include <LUFA/Drivers/Board/LEDs.h> 
  53                 /** CDC Class specific request to get the current virtual serial port configuration settings. */ 
  54                 #define REQ_GetLineEncoding       0x21 
  56                 /** CDC Class specific request to set the current virtual serial port configuration settings. */ 
  57                 #define REQ_SetLineEncoding       0x20 
  59                 /** CDC Class specific request to set the current virtual serial port handshake line states. */ 
  60                 #define REQ_SetControlLineState   0x22 
  62                 /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ 
  63                 #define LEDMASK_USB_NOTREADY      LEDS_LED1 
  65                 /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ 
  66                 #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3) 
  68                 /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ 
  69                 #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4) 
  71                 /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ 
  72                 #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3) 
  75                 /** Type define for the virtual serial port line encoding settings, for storing the current USART configuration 
  76                  *  as set by the host via a class specific request. 
  80                         uint32_t BaudRateBPS
; /**< Baud rate of the virtual serial port, in bits per second */ 
  81                         uint8_t  CharFormat
; /**< Character format of the virtual serial port, a value from the 
  82                                               *   CDCDevice_CDC_LineCodingFormats_t enum 
  84                         uint8_t  ParityType
; /**< Parity setting of the virtual serial port, a value from the 
  85                                               *   CDCDevice_LineCodingParity_t enum 
  87                         uint8_t  DataBits
; /**< Bits of data per character of the virtual serial port */ 
  91                 /** Enum for the possible line encoding formats of a virtual serial port. */ 
  92                 enum CDCDevice_CDC_LineCodingFormats_t
 
  94                         OneStopBit          
= 0, /**< Each frame contains one stop bit */ 
  95                         OneAndAHalfStopBits 
= 1, /**< Each frame contains one and a half stop bits */ 
  96                         TwoStopBits         
= 2, /**< Each frame contains two stop bits */ 
  99                 /** Enum for the possible line encoding parity settings of a virtual serial port. */ 
 100                 enum CDCDevice_LineCodingParity_t
 
 102                         Parity_None         
= 0, /**< No parity bit mode on each frame */ 
 103                         Parity_Odd          
= 1, /**< Odd parity bit mode on each frame */ 
 104                         Parity_Even         
= 2, /**< Even parity bit mode on each frame */ 
 105                         Parity_Mark         
= 3, /**< Mark parity bit mode on each frame */ 
 106                         Parity_Space        
= 4, /**< Space parity bit mode on each frame */ 
 109         /* Function Prototypes: */ 
 110                 void CDC1_Task(void); 
 111                 void CDC2_Task(void); 
 112                 void SetupHardware(void); 
 114                 void EVENT_USB_Device_Connect(void); 
 115                 void EVENT_USB_Device_Disconnect(void); 
 116                 void EVENT_USB_Device_ConfigurationChanged(void); 
 117                 void EVENT_USB_Device_UnhandledControlRequest(void);