Commit a67bd74e authored by Dean Camera's avatar Dean Camera
Browse files

Minor documentation page updates.

Redocumented all device demos, now that they have changed over to the new USB class drivers.

Added C linkage to class drivers for C++ support.

Added prefixes to most of the class driver constants to prevent name clashes.
parent 7c5444b8
...@@ -113,7 +113,6 @@ LUFA_PATH = ../.. ...@@ -113,7 +113,6 @@ LUFA_PATH = ../..
# List C source files here. (C dependencies are automatically generated.) # List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \ SRC = $(TARGET).c \
Descriptors.c \ Descriptors.c \
$(LUFA_PATH)/LUFA/Scheduler/Scheduler.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
......
...@@ -113,7 +113,6 @@ LUFA_PATH = ../.. ...@@ -113,7 +113,6 @@ LUFA_PATH = ../..
# List C source files here. (C dependencies are automatically generated.) # List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \ SRC = $(TARGET).c \
Descriptors.c \ Descriptors.c \
$(LUFA_PATH)/LUFA/Scheduler/Scheduler.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
......
...@@ -113,7 +113,6 @@ LUFA_PATH = ../.. ...@@ -113,7 +113,6 @@ LUFA_PATH = ../..
# List C source files here. (C dependencies are automatically generated.) # List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \ SRC = $(TARGET).c \
Descriptors.c \ Descriptors.c \
$(LUFA_PATH)/LUFA/Scheduler/Scheduler.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \ $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
......
...@@ -28,16 +28,29 @@ ...@@ -28,16 +28,29 @@
this software. this software.
*/ */
/** \file
*
* Main source file for the AudioInput demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "AudioInput.h" #include "AudioInput.h"
/** LUFA Audio Class driver interface configuration and state information. This structure is
* passed to all Audio Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_Audio_t Microphone_Audio_Interface = USB_ClassInfo_Audio_t Microphone_Audio_Interface =
{ {
.InterfaceNumber = 0, .StreamingInterfaceNumber = 1,
.DataINEndpointNumber = AUDIO_STREAM_EPNUM, .DataINEndpointNumber = AUDIO_STREAM_EPNUM,
.DataINEndpointSize = AUDIO_STREAM_EPSIZE, .DataINEndpointSize = AUDIO_STREAM_EPSIZE,
}; };
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void) int main(void)
{ {
SetupHardware(); SetupHardware();
...@@ -53,6 +66,7 @@ int main(void) ...@@ -53,6 +66,7 @@ int main(void)
} }
} }
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void) void SetupHardware(void)
{ {
/* Disable watchdog if enabled by bootloader/fuses */ /* Disable watchdog if enabled by bootloader/fuses */
...@@ -72,6 +86,9 @@ void SetupHardware(void) ...@@ -72,6 +86,9 @@ void SetupHardware(void)
ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_CHANNEL); ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_CHANNEL);
} }
/** Processes the next audio sample by reading the last ADC conversion and writing it to the audio
* interface, each time the sample reload timer period elapses to give a constant sample rate.
*/
void ProcessNextSample(void) void ProcessNextSample(void)
{ {
if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsReadyForNextSample(&Microphone_Audio_Interface)) if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsReadyForNextSample(&Microphone_Audio_Interface))
...@@ -90,6 +107,7 @@ void ProcessNextSample(void) ...@@ -90,6 +107,7 @@ void ProcessNextSample(void)
} }
} }
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
...@@ -100,6 +118,7 @@ void EVENT_USB_Connect(void) ...@@ -100,6 +118,7 @@ void EVENT_USB_Connect(void)
TCCR0B = (1 << CS00); // Fcpu speed TCCR0B = (1 << CS00); // Fcpu speed
} }
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Disconnect(void)
{ {
/* Stop the sample reload timer */ /* Stop the sample reload timer */
...@@ -108,6 +127,7 @@ void EVENT_USB_Disconnect(void) ...@@ -108,6 +127,7 @@ void EVENT_USB_Disconnect(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
...@@ -116,6 +136,7 @@ void EVENT_USB_ConfigurationChanged(void) ...@@ -116,6 +136,7 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_UnhandledControlPacket(void)
{ {
USB_Audio_ProcessControlPacket(&Microphone_Audio_Interface); USB_Audio_ProcessControlPacket(&Microphone_Audio_Interface);
......
...@@ -52,18 +52,25 @@ ...@@ -52,18 +52,25 @@
/* Macros: */ /* Macros: */
/** ADC channel number for the microphone input. */ /** ADC channel number for the microphone input. */
#define MIC_IN_ADC_CHANNEL 2 #define MIC_IN_ADC_CHANNEL 2
/** Maximum ADC sample value for the microphone input. */ /** Maximum ADC sample value for the microphone input. */
#define SAMPLE_MAX_RANGE 0xFFFF #define SAMPLE_MAX_RANGE 0xFFFF
/** Maximum ADC range for the microphone input. */ /** Maximum ADC range for the microphone input. */
#define ADC_MAX_RANGE 0x3FF #define ADC_MAX_RANGE 0x3FF
/* Macros: */ /* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1 #define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */ /* Function Prototypes: */
......
...@@ -201,7 +201,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = ...@@ -201,7 +201,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.BitResolution = 16, .BitResolution = 16,
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)), .SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),
.SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)} .SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
}, },
.AudioEndpoint = .AudioEndpoint =
......
...@@ -28,16 +28,29 @@ ...@@ -28,16 +28,29 @@
this software. this software.
*/ */
/** \file
*
* Main source file for the AudioOutput demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "AudioOutput.h" #include "AudioOutput.h"
/** LUFA Audio Class driver interface configuration and state information. This structure is
* passed to all Audio Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_Audio_t Speaker_Audio_Interface = USB_ClassInfo_Audio_t Speaker_Audio_Interface =
{ {
.InterfaceNumber = 0, .StreamingInterfaceNumber = 1,
.DataOUTEndpointNumber = AUDIO_STREAM_EPNUM, .DataOUTEndpointNumber = AUDIO_STREAM_EPNUM,
.DataOUTEndpointSize = AUDIO_STREAM_EPSIZE, .DataOUTEndpointSize = AUDIO_STREAM_EPSIZE,
}; };
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void) int main(void)
{ {
SetupHardware(); SetupHardware();
...@@ -53,6 +66,7 @@ int main(void) ...@@ -53,6 +66,7 @@ int main(void)
} }
} }
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void) void SetupHardware(void)
{ {
/* Disable watchdog if enabled by bootloader/fuses */ /* Disable watchdog if enabled by bootloader/fuses */
...@@ -67,6 +81,9 @@ void SetupHardware(void) ...@@ -67,6 +81,9 @@ void SetupHardware(void)
USB_Init(); USB_Init();
} }
/** Processes the next audio sample by reading the last ADC conversion and writing it to the audio
* interface, each time the sample reload timer period elapses to give a constant sample rate.
*/
void ProcessNextSample(void) void ProcessNextSample(void)
{ {
if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsSampleReceived(&Speaker_Audio_Interface)) if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsSampleReceived(&Speaker_Audio_Interface))
...@@ -82,10 +99,10 @@ void ProcessNextSample(void) ...@@ -82,10 +99,10 @@ void ProcessNextSample(void)
int8_t LeftSample_8Bit = (LeftSample_16Bit >> 8); int8_t LeftSample_8Bit = (LeftSample_16Bit >> 8);
int8_t RightSample_8Bit = (RightSample_16Bit >> 8); int8_t RightSample_8Bit = (RightSample_16Bit >> 8);
#if defined(AUDIO_OUT_MONO)
/* Mix the two channels together to produce a mono, 8-bit sample */ /* Mix the two channels together to produce a mono, 8-bit sample */
int8_t MixedSample_8Bit = (((int16_t)LeftSample_8Bit + (int16_t)RightSample_8Bit) >> 1); int8_t MixedSample_8Bit = (((int16_t)LeftSample_8Bit + (int16_t)RightSample_8Bit) >> 1);
#if defined(AUDIO_OUT_MONO)
/* Load the sample into the PWM timer channel */ /* Load the sample into the PWM timer channel */
OCRxA = ((uint8_t)MixedSample_8Bit ^ (1 << 7)); OCRxA = ((uint8_t)MixedSample_8Bit ^ (1 << 7));
#elif defined(AUDIO_OUT_STEREO) #elif defined(AUDIO_OUT_STEREO)
...@@ -93,42 +110,32 @@ void ProcessNextSample(void) ...@@ -93,42 +110,32 @@ void ProcessNextSample(void)
OCRxA = ((uint8_t)LeftSample_8Bit ^ (1 << 7)); OCRxA = ((uint8_t)LeftSample_8Bit ^ (1 << 7));
OCRxB = ((uint8_t)RightSample_8Bit ^ (1 << 7)); OCRxB = ((uint8_t)RightSample_8Bit ^ (1 << 7));
#elif defined(AUDIO_OUT_PORTC) #elif defined(AUDIO_OUT_PORTC)
/* Mix the two channels together to produce a mono, 8-bit sample */
int8_t MixedSample_8Bit = (((int16_t)LeftSample_8Bit + (int16_t)RightSample_8Bit) >> 1);
PORTC = MixedSample_8Bit; PORTC = MixedSample_8Bit;
#else #else
uint8_t LEDMask = LEDS_NO_LEDS; uint8_t LEDMask = LEDS_NO_LEDS;
/* Make left channel positive (absolute) */ /* Make mixed sample value positive (absolute) */
if (LeftSample_8Bit < 0) if (MixedSample_8Bit < 0)
LeftSample_8Bit = -LeftSample_8Bit; MixedSample_8Bit = -MixedSample_8Bit;
/* Make right channel positive (absolute) */
if (RightSample_8Bit < 0)
RightSample_8Bit = -RightSample_8Bit;
/* Set first LED based on sample value */ if (MixedSample_8Bit > ((128 / 8) * 1))
if (LeftSample_8Bit < ((128 / 8) * 1))
LEDMask |= LEDS_LED2;
else if (LeftSample_8Bit < ((128 / 8) * 3))
LEDMask |= (LEDS_LED1 | LEDS_LED2);
else
LEDMask |= LEDS_LED1; LEDMask |= LEDS_LED1;
if (MixedSample_8Bit > ((128 / 8) * 2))
LEDMask |= LEDS_LED2;
if (MixedSample_8Bit > ((128 / 8) * 3))
LEDMask |= LEDS_LED3;
/* Set second LED based on sample value */ if (MixedSample_8Bit > ((128 / 8) * 4))
if (RightSample_8Bit < ((128 / 8) * 1))
LEDMask |= LEDS_LED4; LEDMask |= LEDS_LED4;
else if (RightSample_8Bit < ((128 / 8) * 3))
LEDMask |= (LEDS_LED3 | LEDS_LED4);
else
LEDMask |= LEDS_LED3;
LEDs_SetAllLEDs(LEDMask); LEDs_SetAllLEDs(LEDMask);
#endif #endif
} }
} }
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
...@@ -157,16 +164,16 @@ void EVENT_USB_Connect(void) ...@@ -157,16 +164,16 @@ void EVENT_USB_Connect(void)
#endif #endif
} }
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via /** Event handler for the library USB Disconnection event. */
* the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks.
*/
void EVENT_USB_Disconnect(void) void EVENT_USB_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
/* Stop the timers */ /* Stop the sample reload timer */
TCCR0B = 0; TCCR0B = 0;
#if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO)) #if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO))
/* Stop the PWM generation timer */
TCCRxB = 0; TCCRxB = 0;
#endif #endif
...@@ -182,6 +189,7 @@ void EVENT_USB_Disconnect(void) ...@@ -182,6 +189,7 @@ void EVENT_USB_Disconnect(void)
#endif #endif
} }
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
...@@ -190,6 +198,7 @@ void EVENT_USB_ConfigurationChanged(void) ...@@ -190,6 +198,7 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_UnhandledControlPacket(void)
{ {
USB_Audio_ProcessControlPacket(&Speaker_Audio_Interface); USB_Audio_ProcessControlPacket(&Speaker_Audio_Interface);
......
...@@ -99,9 +99,16 @@ ...@@ -99,9 +99,16 @@
#endif #endif
/* Macros: */ /* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1 #define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */ /* Function Prototypes: */
......
...@@ -201,7 +201,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = ...@@ -201,7 +201,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.BitResolution = 16, .BitResolution = 16,
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)), .SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),
.SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)} .SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
}, },
.AudioEndpoint = .AudioEndpoint =
......
...@@ -28,8 +28,18 @@ ...@@ -28,8 +28,18 @@
this software. this software.
*/ */
/** \file
*
* Main source file for the CDC demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "CDC.h" #include "CDC.h"
/** 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_t VirtualSerial_CDC_Interface = USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface =
{ {
.ControlInterfaceNumber = 0, .ControlInterfaceNumber = 0,
...@@ -44,6 +54,9 @@ USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface = ...@@ -44,6 +54,9 @@ USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface =
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
}; };
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void) int main(void)
{ {
SetupHardware(); SetupHardware();
...@@ -63,6 +76,7 @@ int main(void) ...@@ -63,6 +76,7 @@ int main(void)
} }
} }
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void) void SetupHardware(void)
{ {
/* Disable watchdog if enabled by bootloader/fuses */ /* Disable watchdog if enabled by bootloader/fuses */
...@@ -78,11 +92,12 @@ void SetupHardware(void) ...@@ -78,11 +92,12 @@ void SetupHardware(void)
USB_Init(); USB_Init();
} }
/** Checks for changes in the position of the board joystick, sending strings to the host upon each change. */
void CheckJoystickMovement(void) void CheckJoystickMovement(void)
{ {
uint8_t JoyStatus_LCL = Joystick_GetStatus(); uint8_t JoyStatus_LCL = Joystick_GetStatus();
char* ReportString = NULL; char* ReportString = NULL;
static bool ActionSent = false; static bool ActionSent = false;
char* JoystickStrings[] = char* JoystickStrings[] =
{ {
...@@ -114,16 +129,19 @@ void CheckJoystickMovement(void) ...@@ -114,16 +129,19 @@ void CheckJoystickMovement(void)
} }
} }
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void) void EVENT_USB_Connect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
} }
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void) void EVENT_USB_Disconnect(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} }
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void) void EVENT_USB_ConfigurationChanged(void)
{ {
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
...@@ -132,6 +150,7 @@ void EVENT_USB_ConfigurationChanged(void) ...@@ -132,6 +150,7 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR); LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
} }
/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void) void EVENT_USB_UnhandledControlPacket(void)
{ {
USB_CDC_ProcessControlPacket(&VirtualSerial_CDC_Interface); USB_CDC_ProcessControlPacket(&VirtualSerial_CDC_Interface);
......
...@@ -51,9 +51,16 @@ ...@@ -51,9 +51,16 @@
#include <LUFA/Drivers/USB/Class/Device/CDC.h> #include <LUFA/Drivers/USB/Class/Device/CDC.h>
/* Macros: */ /* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1 #define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */ /* Function Prototypes: */
......
...@@ -27,9 +27,20 @@ ...@@ -27,9 +27,20 @@
arising out of or in connection with the use or performance of arising out of or in connection with the use or performance of
this software. this software.
*/ */
/** \file
*
* Main source file for the DualCDC demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "DualCDC.h" #include "DualCDC.h"