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/Common/ButtLoadTag.h> // PROGMEM tags readable by the ButtLoad project
49 #include <LUFA/Drivers/USB/USB.h> // USB Functionality
50 #include <LUFA/Drivers/Board/Joystick.h> // Joystick driver
51 #include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
52 #include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
55 /** CDC Class specific request to get the current virtual serial port configuration settings. */
56 #define REQ_GetLineEncoding 0x21
58 /** CDC Class specific request to set the current virtual serial port configuration settings. */
59 #define REQ_SetLineEncoding 0x20
61 /** CDC Class specific request to set the current virtual serial port handshake line states. */
62 #define REQ_SetControlLineState 0x22
65 /** Indicates that this module will catch the USB_Connect event when thrown by the library. */
66 HANDLES_EVENT(USB_Connect
);
68 /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
69 HANDLES_EVENT(USB_Disconnect
);
71 /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
72 HANDLES_EVENT(USB_ConfigurationChanged
);
74 /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
75 HANDLES_EVENT(USB_UnhandledControlPacket
);
78 /** Type define for the virtual serial port line encoding settings, for storing the current USART configuration
79 * as set by the host via a class specific request.
83 uint32_t BaudRateBPS
; /**< Baud rate of the virtual serial port, in bits per second */
84 uint8_t CharFormat
; /**< Character format of the virtual serial port, a value from the
85 * CDCDevice_CDC_LineCodingFormats_t enum
87 uint8_t ParityType
; /**< Parity setting of the virtual serial port, a value from the
88 * CDCDevice_LineCodingParity_t enum
90 uint8_t DataBits
; /**< Bits of data per charater of the virtual serial port */
94 /** Enum for the possible line encoding formats of a virtual serial port. */
95 enum CDCDevice_CDC_LineCodingFormats_t
97 OneStopBit
= 0, /**< Each frame contains one stop bit */
98 OneAndAHalfStopBits
= 1, /**< Each frame contains one and a half stop bits */
99 TwoStopBits
= 2, /**< Each frame contains two stop bits */
102 /** Enum for the possible line encoding parity settings of a virtual serial port. */
103 enum CDCDevice_LineCodingParity_t
105 Parity_None
= 0, /**< No parity bit mode on each frame */
106 Parity_Odd
= 1, /**< Odd parity bit mode on each frame */
107 Parity_Even
= 2, /**< Even parity bit mode on each frame */
108 Parity_Mark
= 3, /**< Mark parity bit mode on each frame */
109 Parity_Space
= 4, /**< Space parity bit mode on each frame */
112 /** Enum for the possible status codes for passing to the UpdateStatus() function. */
113 enum DualCDC_StatusCodes_t
115 Status_USBNotReady
= 0, /**< USB is not ready (disconnected from a USB host) */
116 Status_USBEnumerating
= 1, /**< USB interface is enumerating */
117 Status_USBReady
= 2, /**< USB interface is connected and ready */
124 /* Function Prototypes: */
125 void UpdateStatus(uint8_t CurrentStatus
);