3 Copyright (C) Dean Camera, 2009.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 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 DualCDC.c.
42 #include <avr/power.h>
45 #include "Descriptors.h"
47 #include <LUFA/Version.h> // Library Version Information
48 #include <LUFA/Drivers/USB/USB.h> // USB Functionality
49 #include <LUFA/Drivers/Board/Joystick.h> // Joystick driver
50 #include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
51 #include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
54 /** CDC Class specific request to get the current virtual serial port configuration settings. */
55 #define REQ_GetLineEncoding 0x21
57 /** CDC Class specific request to set the current virtual serial port configuration settings. */
58 #define REQ_SetLineEncoding 0x20
60 /** CDC Class specific request to set the current virtual serial port handshake line states. */
61 #define REQ_SetControlLineState 0x22
64 /** Type define for the virtual serial port line encoding settings, for storing the current USART configuration
65 * as set by the host via a class specific request.
69 uint32_t BaudRateBPS
; /**< Baud rate of the virtual serial port, in bits per second */
70 uint8_t CharFormat
; /**< Character format of the virtual serial port, a value from the
71 * CDCDevice_CDC_LineCodingFormats_t enum
73 uint8_t ParityType
; /**< Parity setting of the virtual serial port, a value from the
74 * CDCDevice_LineCodingParity_t enum
76 uint8_t DataBits
; /**< Bits of data per character of the virtual serial port */
80 /** Enum for the possible line encoding formats of a virtual serial port. */
81 enum CDCDevice_CDC_LineCodingFormats_t
83 OneStopBit
= 0, /**< Each frame contains one stop bit */
84 OneAndAHalfStopBits
= 1, /**< Each frame contains one and a half stop bits */
85 TwoStopBits
= 2, /**< Each frame contains two stop bits */
88 /** Enum for the possible line encoding parity settings of a virtual serial port. */
89 enum CDCDevice_LineCodingParity_t
91 Parity_None
= 0, /**< No parity bit mode on each frame */
92 Parity_Odd
= 1, /**< Odd parity bit mode on each frame */
93 Parity_Even
= 2, /**< Even parity bit mode on each frame */
94 Parity_Mark
= 3, /**< Mark parity bit mode on each frame */
95 Parity_Space
= 4, /**< Space parity bit mode on each frame */
98 /** Enum for the possible status codes for passing to the UpdateStatus() function. */
99 enum DualCDC_StatusCodes_t
101 Status_USBNotReady
= 0, /**< USB is not ready (disconnected from a USB host) */
102 Status_USBEnumerating
= 1, /**< USB interface is enumerating */
103 Status_USBReady
= 2, /**< USB interface is connected and ready */
110 /* Function Prototypes: */
111 void EVENT_USB_Connect(void);
112 void EVENT_USB_Disconnect(void);
113 void EVENT_USB_ConfigurationChanged(void);
114 void EVENT_USB_UnhandledControlPacket(void);
116 void UpdateStatus(uint8_t CurrentStatus
);