aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bootloaders/CDC/makefile1
-rw-r--r--Bootloaders/DFU/makefile1
-rw-r--r--Bootloaders/TeensyHID/makefile1
-rw-r--r--Demos/Device/AudioInput/AudioInput.c29
-rw-r--r--Demos/Device/AudioInput/AudioInput.h13
-rw-r--r--Demos/Device/AudioInput/Descriptors.c2
-rw-r--r--Demos/Device/AudioOutput/AudioOutput.c71
-rw-r--r--Demos/Device/AudioOutput/AudioOutput.h7
-rw-r--r--Demos/Device/AudioOutput/Descriptors.c2
-rw-r--r--Demos/Device/CDC/CDC.c21
-rw-r--r--Demos/Device/CDC/CDC.h7
-rw-r--r--Demos/Device/DualCDC/DualCDC.c33
-rw-r--r--Demos/Device/DualCDC/DualCDC.h7
-rw-r--r--Demos/Device/GenericHID/GenericHID.c32
-rw-r--r--Demos/Device/GenericHID/GenericHID.h7
-rw-r--r--Demos/Device/Joystick/Joystick.c32
-rw-r--r--Demos/Device/Joystick/Joystick.h7
-rw-r--r--Demos/Device/Keyboard/Keyboard.c34
-rw-r--r--Demos/Device/Keyboard/Keyboard.h7
-rw-r--r--Demos/Device/KeyboardMouse/KeyboardMouse.c46
-rw-r--r--Demos/Device/KeyboardMouse/KeyboardMouse.h7
-rw-r--r--Demos/Device/MIDI/Descriptors.c8
-rw-r--r--Demos/Device/MIDI/MIDI.c30
-rw-r--r--Demos/Device/MIDI/MIDI.h7
-rw-r--r--Demos/Device/MassStorage/MassStorage.c22
-rw-r--r--Demos/Device/MassStorage/MassStorage.h12
-rw-r--r--Demos/Device/Mouse/Mouse.c38
-rw-r--r--Demos/Device/Mouse/Mouse.h7
-rw-r--r--Demos/Device/RNDISEthernet/RNDISEthernet.c31
-rw-r--r--Demos/Device/RNDISEthernet/RNDISEthernet.h11
-rw-r--r--Demos/Device/USBtoSerial/USBtoSerial.c34
-rw-r--r--Demos/Device/USBtoSerial/USBtoSerial.h7
-rw-r--r--LUFA/ChangeLog.txt4
-rw-r--r--LUFA/CompileTimeTokens.txt13
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.c2
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.h15
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.h53
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.h10
-rw-r--r--LUFA/Drivers/USB/Class/Device/MIDI.h16
-rw-r--r--LUFA/Drivers/USB/Class/Device/MassStorage.c14
-rw-r--r--LUFA/Drivers/USB/Class/Device/MassStorage.h31
-rw-r--r--LUFA/Drivers/USB/Class/Device/RNDIS.h12
-rw-r--r--LUFA/Drivers/USB/HighLevel/Events.h4
-rw-r--r--LUFA/MainPage.txt12
-rw-r--r--LUFA/MigrationInformation.txt4
-rw-r--r--LUFA/VIDAndPIDValues.txt4
-rw-r--r--Projects/Magstripe/Magstripe.c36
47 files changed, 652 insertions, 152 deletions
diff --git a/Bootloaders/CDC/makefile b/Bootloaders/CDC/makefile
index e3d8e5c51..cf7030d45 100644
--- a/Bootloaders/CDC/makefile
+++ b/Bootloaders/CDC/makefile
@@ -113,7 +113,6 @@ LUFA_PATH = ../..
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
Descriptors.c \
- $(LUFA_PATH)/LUFA/Scheduler/Scheduler.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
diff --git a/Bootloaders/DFU/makefile b/Bootloaders/DFU/makefile
index b3eb1b0a1..f9f8f6563 100644
--- a/Bootloaders/DFU/makefile
+++ b/Bootloaders/DFU/makefile
@@ -113,7 +113,6 @@ LUFA_PATH = ../..
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
Descriptors.c \
- $(LUFA_PATH)/LUFA/Scheduler/Scheduler.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
diff --git a/Bootloaders/TeensyHID/makefile b/Bootloaders/TeensyHID/makefile
index 68b016022..91d3ada0a 100644
--- a/Bootloaders/TeensyHID/makefile
+++ b/Bootloaders/TeensyHID/makefile
@@ -113,7 +113,6 @@ LUFA_PATH = ../..
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
Descriptors.c \
- $(LUFA_PATH)/LUFA/Scheduler/Scheduler.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
diff --git a/Demos/Device/AudioInput/AudioInput.c b/Demos/Device/AudioInput/AudioInput.c
index bcfb04be1..31b3159e0 100644
--- a/Demos/Device/AudioInput/AudioInput.c
+++ b/Demos/Device/AudioInput/AudioInput.c
@@ -28,16 +28,29 @@
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"
+/** 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 =
{
- .InterfaceNumber = 0,
+ .StreamingInterfaceNumber = 1,
- .DataINEndpointNumber = AUDIO_STREAM_EPNUM,
- .DataINEndpointSize = AUDIO_STREAM_EPSIZE,
+ .DataINEndpointNumber = AUDIO_STREAM_EPNUM,
+ .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)
{
SetupHardware();
@@ -53,6 +66,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -72,6 +86,9 @@ void SetupHardware(void)
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)
{
if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsReadyForNextSample(&Microphone_Audio_Interface))
@@ -90,6 +107,7 @@ void ProcessNextSample(void)
}
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@@ -100,6 +118,7 @@ void EVENT_USB_Connect(void)
TCCR0B = (1 << CS00); // Fcpu speed
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
/* Stop the sample reload timer */
@@ -108,6 +127,7 @@ void EVENT_USB_Disconnect(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -116,6 +136,7 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_Audio_ProcessControlPacket(&Microphone_Audio_Interface);
diff --git a/Demos/Device/AudioInput/AudioInput.h b/Demos/Device/AudioInput/AudioInput.h
index e9f56b30a..e4dd7fe66 100644
--- a/Demos/Device/AudioInput/AudioInput.h
+++ b/Demos/Device/AudioInput/AudioInput.h
@@ -52,18 +52,25 @@
/* Macros: */
/** 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. */
- #define SAMPLE_MAX_RANGE 0xFFFF
+ #define SAMPLE_MAX_RANGE 0xFFFF
/** Maximum ADC range for the microphone input. */
- #define ADC_MAX_RANGE 0x3FF
+ #define ADC_MAX_RANGE 0x3FF
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/Demos/Device/AudioInput/Descriptors.c b/Demos/Device/AudioInput/Descriptors.c
index b8de373d6..6697cfe1d 100644
--- a/Demos/Device/AudioInput/Descriptors.c
+++ b/Demos/Device/AudioInput/Descriptors.c
@@ -201,7 +201,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.BitResolution = 16,
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),
- .SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
+ .SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
.AudioEndpoint =
diff --git a/Demos/Device/AudioOutput/AudioOutput.c b/Demos/Device/AudioOutput/AudioOutput.c
index 0f193567a..4ff2e7453 100644
--- a/Demos/Device/AudioOutput/AudioOutput.c
+++ b/Demos/Device/AudioOutput/AudioOutput.c
@@ -28,16 +28,29 @@
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"
+/** 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 =
{
- .InterfaceNumber = 0,
+ .StreamingInterfaceNumber = 1,
- .DataOUTEndpointNumber = AUDIO_STREAM_EPNUM,
- .DataOUTEndpointSize = AUDIO_STREAM_EPSIZE,
+ .DataOUTEndpointNumber = AUDIO_STREAM_EPNUM,
+ .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)
{
SetupHardware();
@@ -53,6 +66,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -67,6 +81,9 @@ void SetupHardware(void)
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)
{
if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsSampleReceived(&Speaker_Audio_Interface))
@@ -82,10 +99,10 @@ void ProcessNextSample(void)
int8_t LeftSample_8Bit = (LeftSample_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 */
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 */
OCRxA = ((uint8_t)MixedSample_8Bit ^ (1 << 7));
#elif defined(AUDIO_OUT_STEREO)
@@ -93,42 +110,32 @@ void ProcessNextSample(void)
OCRxA = ((uint8_t)LeftSample_8Bit ^ (1 << 7));
OCRxB = ((uint8_t)RightSample_8Bit ^ (1 << 7));
#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;
#else
uint8_t LEDMask = LEDS_NO_LEDS;
- /* Make left channel positive (absolute) */
- if (LeftSample_8Bit < 0)
- LeftSample_8Bit = -LeftSample_8Bit;
-
- /* Make right channel positive (absolute) */
- if (RightSample_8Bit < 0)
- RightSample_8Bit = -RightSample_8Bit;
+ /* Make mixed sample value positive (absolute) */
+ if (MixedSample_8Bit < 0)
+ MixedSample_8Bit = -MixedSample_8Bit;
- /* Set first LED based on sample value */
- if (LeftSample_8Bit < ((128 / 8) * 1))
- LEDMask |= LEDS_LED2;
- else if (LeftSample_8Bit < ((128 / 8) * 3))
- LEDMask |= (LEDS_LED1 | LEDS_LED2);
- else
+ if (MixedSample_8Bit > ((128 / 8) * 1))
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 (RightSample_8Bit < ((128 / 8) * 1))
+ if (MixedSample_8Bit > ((128 / 8) * 4))
LEDMask |= LEDS_LED4;
- else if (RightSample_8Bit < ((128 / 8) * 3))
- LEDMask |= (LEDS_LED3 | LEDS_LED4);
- else
- LEDMask |= LEDS_LED3;
-
+
LEDs_SetAllLEDs(LEDMask);
#endif
}
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
@@ -157,16 +164,16 @@ void EVENT_USB_Connect(void)
#endif
}
-/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
- * the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks.
- */
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
- /* Stop the timers */
+ /* Stop the sample reload timer */
TCCR0B = 0;
+
#if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO))
+ /* Stop the PWM generation timer */
TCCRxB = 0;
#endif
@@ -182,6 +189,7 @@ void EVENT_USB_Disconnect(void)
#endif
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -190,6 +198,7 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_Audio_ProcessControlPacket(&Speaker_Audio_Interface);
diff --git a/Demos/Device/AudioOutput/AudioOutput.h b/Demos/Device/AudioOutput/AudioOutput.h
index 7d112db88..e8435e3ad 100644
--- a/Demos/Device/AudioOutput/AudioOutput.h
+++ b/Demos/Device/AudioOutput/AudioOutput.h
@@ -99,9 +99,16 @@
#endif
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/Demos/Device/AudioOutput/Descriptors.c b/Demos/Device/AudioOutput/Descriptors.c
index 92d7e0d57..0039c2ba8 100644
--- a/Demos/Device/AudioOutput/Descriptors.c
+++ b/Demos/Device/AudioOutput/Descriptors.c
@@ -201,7 +201,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.BitResolution = 16,
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),
- .SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
+ .SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
.AudioEndpoint =
diff --git a/Demos/Device/CDC/CDC.c b/Demos/Device/CDC/CDC.c
index e6bc1a455..6f1539334 100644
--- a/Demos/Device/CDC/CDC.c
+++ b/Demos/Device/CDC/CDC.c
@@ -28,8 +28,18 @@
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"
+/** 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 =
{
.ControlInterfaceNumber = 0,
@@ -44,6 +54,9 @@ USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface =
.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)
{
SetupHardware();
@@ -63,6 +76,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -78,11 +92,12 @@ void SetupHardware(void)
USB_Init();
}
+/** Checks for changes in the position of the board joystick, sending strings to the host upon each change. */
void CheckJoystickMovement(void)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus();
char* ReportString = NULL;
- static bool ActionSent = false;
+ static bool ActionSent = false;
char* JoystickStrings[] =
{
@@ -114,16 +129,19 @@ void CheckJoystickMovement(void)
}
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -132,6 +150,7 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_CDC_ProcessControlPacket(&VirtualSerial_CDC_Interface);
diff --git a/Demos/Device/CDC/CDC.h b/Demos/Device/CDC/CDC.h
index dc4033448..23072d683 100644
--- a/Demos/Device/CDC/CDC.h
+++ b/Demos/Device/CDC/CDC.h
@@ -51,9 +51,16 @@
#include <LUFA/Drivers/USB/Class/Device/CDC.h>
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/Demos/Device/DualCDC/DualCDC.c b/Demos/Device/DualCDC/DualCDC.c
index 26947f433..216902c67 100644
--- a/Demos/Device/DualCDC/DualCDC.c
+++ b/Demos/Device/DualCDC/DualCDC.c
@@ -27,9 +27,20 @@
arising out of or in connection with the use or performance of
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"
+/** 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. This is for the first CDC interface,
+ * which sends strings to the host for each joystick movement.
+ */
USB_ClassInfo_CDC_t VirtualSerial1_CDC_Interface =
{
.ControlInterfaceNumber = 0,
@@ -44,9 +55,14 @@ USB_ClassInfo_CDC_t VirtualSerial1_CDC_Interface =
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
};
+/** 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. This is for the second CDC interface,
+ * which echos back all received data from the host.
+ */
USB_ClassInfo_CDC_t VirtualSerial2_CDC_Interface =
{
- .ControlInterfaceNumber = 0,
+ .ControlInterfaceNumber = 2,
.DataINEndpointNumber = CDC2_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
@@ -58,6 +74,9 @@ USB_ClassInfo_CDC_t VirtualSerial2_CDC_Interface =
.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)
{
SetupHardware();
@@ -68,10 +87,12 @@ int main(void)
{
CheckJoystickMovement();
+ /* Discard all received data on the first CDC interface */
uint16_t BytesToDiscard = USB_CDC_BytesReceived(&VirtualSerial1_CDC_Interface);
while (BytesToDiscard--)
USB_CDC_ReceiveByte(&VirtualSerial1_CDC_Interface);
+ /* Echo all received data on the second CDC interface */
uint16_t BytesToEcho = USB_CDC_BytesReceived(&VirtualSerial2_CDC_Interface);
while (BytesToEcho--)
USB_CDC_SendByte(&VirtualSerial2_CDC_Interface, USB_CDC_ReceiveByte(&VirtualSerial2_CDC_Interface));
@@ -82,6 +103,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -97,6 +119,9 @@ void SetupHardware(void)
USB_Init();
}
+/** Checks for changes in the position of the board joystick, sending strings to the host upon each change
+ * through the first of the CDC interfaces.
+ */
void CheckJoystickMovement(void)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus();
@@ -133,16 +158,19 @@ void CheckJoystickMovement(void)
}
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -154,6 +182,7 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_CDC_ProcessControlPacket(&VirtualSerial1_CDC_Interface);
diff --git a/Demos/Device/DualCDC/DualCDC.h b/Demos/Device/DualCDC/DualCDC.h
index fc782ee5a..93b785d31 100644
--- a/Demos/Device/DualCDC/DualCDC.h
+++ b/Demos/Device/DualCDC/DualCDC.h
@@ -51,9 +51,16 @@
#include <LUFA/Drivers/USB/Class/Device/CDC.h>
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/Demos/Device/GenericHID/GenericHID.c b/Demos/Device/GenericHID/GenericHID.c
index 9c8023a5c..b933e4506 100644
--- a/Demos/Device/GenericHID/GenericHID.c
+++ b/Demos/Device/GenericHID/GenericHID.c
@@ -28,8 +28,18 @@
this software.
*/
+/** \file
+ *
+ * Main source file for the GenericHID demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "GenericHID.h"
+/** LUFA HID Class driver interface configuration and state information. This structure is
+ * passed to all HID Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
USB_ClassInfo_HID_t Generic_HID_Interface =
{
.InterfaceNumber = 0,
@@ -45,6 +55,9 @@ USB_ClassInfo_HID_t Generic_HID_Interface =
.UsingReportProtocol = true,
};
+/** 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)
{
SetupHardware();
@@ -58,6 +71,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -78,16 +92,19 @@ void SetupHardware(void)
TIMSK0 = (1 << OCIE0A);
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -96,17 +113,26 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Generic_HID_Interface);
}
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
if (Generic_HID_Interface.IdleMSRemaining)
Generic_HID_Interface.IdleMSRemaining--;
}
+/** HID class driver callback function for the creation of HID reports to the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report should be stored
+ *
+ * \return Number of bytes written in the report (or zero if no report is to be sent
+ */
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
{
// Create generic HID report here
@@ -114,6 +140,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
return 0;
}
+/** HID class driver callback function for the processing of HID reports from the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report has been stored
+ * \param ReportSize Size in bytes of the received HID report
+ */
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)
{
// Process received generic HID report here
diff --git a/Demos/Device/GenericHID/GenericHID.h b/Demos/Device/GenericHID/GenericHID.h
index 94a09af93..b68dc4c24 100644
--- a/Demos/Device/GenericHID/GenericHID.h
+++ b/Demos/Device/GenericHID/GenericHID.h
@@ -52,9 +52,16 @@
#include <LUFA/Drivers/USB/Class/Device/HID.h>
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/Demos/Device/Joystick/Joystick.c b/Demos/Device/Joystick/Joystick.c
index d5c20737d..66cb808d0 100644
--- a/Demos/Device/Joystick/Joystick.c
+++ b/Demos/Device/Joystick/Joystick.c
@@ -28,8 +28,18 @@
this software.
*/
+/** \file
+ *
+ * Main source file for the Joystick demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "Joystick.h"
+/** LUFA HID Class driver interface configuration and state information. This structure is
+ * passed to all HID Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
USB_ClassInfo_HID_t Joystick_HID_Interface =
{
.InterfaceNumber = 0,
@@ -42,6 +52,9 @@ USB_ClassInfo_HID_t Joystick_HID_Interface =
.UsingReportProtocol = true,
};
+/** 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)
{
SetupHardware();
@@ -55,6 +68,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -77,16 +91,19 @@ void SetupHardware(void)
TIMSK0 = (1 << OCIE0A);
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -95,17 +112,26 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Joystick_HID_Interface);
}
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
if (Joystick_HID_Interface.IdleMSRemaining)
Joystick_HID_Interface.IdleMSRemaining--;
}
+/** HID class driver callback function for the creation of HID reports to the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report should be stored
+ *
+ * \return Number of bytes written in the report (or zero if no report is to be sent
+ */
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
{
USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;
@@ -132,6 +158,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
return sizeof(USB_JoystickReport_Data_t);
}
+/** HID class driver callback function for the processing of HID reports from the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report has been stored
+ * \param ReportSize Size in bytes of the received HID report
+ */
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
diff --git a/Demos/Device/Joystick/Joystick.h b/Demos/Device/Joystick/Joystick.h
index 164c58ea2..9db357b40 100644
--- a/Demos/Device/Joystick/Joystick.h
+++ b/Demos/Device/Joystick/Joystick.h
@@ -63,9 +63,16 @@
} USB_JoystickReport_Data_t;
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/Demos/Device/Keyboard/Keyboard.c b/Demos/Device/Keyboard/Keyboard.c
index d506657a6..923dd7176 100644
--- a/Demos/Device/Keyboard/Keyboard.c
+++ b/Demos/Device/Keyboard/Keyboard.c
@@ -28,9 +28,19 @@
arising out of or in connection with the use or performance of
this software.
*/
-
+
+/** \file
+ *
+ * Main source file for the Keyboard demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "Keyboard.h"
+/** LUFA HID Class driver interface configuration and state information. This structure is
+ * passed to all HID Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
USB_ClassInfo_HID_t Keyboard_HID_Interface =
{
.InterfaceNumber = 0,
@@ -46,6 +56,9 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
.IdleCount = 500,
};
+/** 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)
{
SetupHardware();
@@ -59,6 +72,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware()
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -81,16 +95,19 @@ void SetupHardware()
TIMSK0 = (1 << OCIE0A);
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -99,17 +116,26 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);
}
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
if (Keyboard_HID_Interface.IdleMSRemaining)
Keyboard_HID_Interface.IdleMSRemaining--;
}
+/** HID class driver callback function for the creation of HID reports to the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report should be stored
+ *
+ * \return Number of bytes written in the report (or zero if no report is to be sent
+ */
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
{
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
@@ -136,6 +162,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
return sizeof(USB_KeyboardReport_Data_t);
}
+/** HID class driver callback function for the processing of HID reports from the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report has been stored
+ * \param ReportSize Size in bytes of the received HID report
+ */
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)
{
uint8_t LEDMask = LEDS_NO_LEDS;
diff --git a/Demos/Device/Keyboard/Keyboard.h b/Demos/Device/Keyboard/Keyboard.h
index 9cfc9aba4..e04ae9e34 100644
--- a/Demos/Device/Keyboard/Keyboard.h
+++ b/Demos/Device/Keyboard/Keyboard.h
@@ -66,9 +66,16 @@
} USB_KeyboardReport_Data_t;
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/Demos/Device/KeyboardMouse/KeyboardMouse.c b/Demos/Device/KeyboardMouse/KeyboardMouse.c
index 71a8375aa..e68a24793 100644
--- a/Demos/Device/KeyboardMouse/KeyboardMouse.c
+++ b/Demos/Device/KeyboardMouse/KeyboardMouse.c
@@ -28,9 +28,20 @@
arising out of or in connection with the use or performance of
this software.
*/
-
+
+/** \file
+ *
+ * Main source file for the KeyboardMouse demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "KeyboardMouse.h"
+/** LUFA HID Class driver interface configuration and state information. This structure is
+ * passed to all HID Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another. This is for the keyboard HID
+ * interface within the device.
+ */
USB_ClassInfo_HID_t Keyboard_HID_Interface =
{
.InterfaceNumber = 0,
@@ -46,6 +57,11 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
.IdleCount = 500,
};
+/** LUFA HID Class driver interface configuration and state information. This structure is
+ * passed to all HID Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another. This is for the mouse HID
+ * interface within the device.
+ */
USB_ClassInfo_HID_t Mouse_HID_Interface =
{
.InterfaceNumber = 0,
@@ -58,7 +74,10 @@ USB_ClassInfo_HID_t Mouse_HID_Interface =
.ReportOUTEndpointNumber = 0,
.ReportOUTEndpointSize = 0,
};
-
+
+/** 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)
{
SetupHardware();
@@ -73,6 +92,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware()
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -94,16 +114,19 @@ void SetupHardware()
TIMSK0 = (1 << OCIE0A);
}
+/** Event handler for the library USB Connection event. */
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)
{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -115,12 +138,14 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);
USB_HID_ProcessControlPacket(&Mouse_HID_Interface);
}
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
if (Keyboard_HID_Interface.IdleMSRemaining)
@@ -130,6 +155,13 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
Mouse_HID_Interface.IdleMSRemaining--;
}
+/** HID class driver callback function for the creation of HID reports to the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report should be stored
+ *
+ * \return Number of bytes written in the report (or zero if no report is to be sent
+ */
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus();
@@ -183,6 +215,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
}
}
+/** HID class driver callback function for the processing of HID reports from the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report has been stored
+ * \param ReportSize Size in bytes of the received HID report
+ */
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)
{
if (HIDInterfaceInfo == &Keyboard_HID_Interface)
diff --git a/Demos/Device/KeyboardMouse/KeyboardMouse.h b/Demos/Device/KeyboardMouse/KeyboardMouse.h
index c18c6e1af..9afe7646b 100644
--- a/Demos/Device/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/KeyboardMouse/KeyboardMouse.h
@@ -49,9 +49,16 @@
#include <LUFA/Drivers/USB/Class/Device/HID.h>
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Type Defines: */
diff --git a/Demos/Device/MIDI/Descriptors.c b/Demos/Device/MIDI/Descriptors.c
index 2007858dd..6973a4caa 100644
--- a/Demos/Device/MIDI/Descriptors.c
+++ b/Demos/Device/MIDI/Descriptors.c
@@ -145,7 +145,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface},
.Subtype = DSUBTYPE_InputJack,
- .JackType = JACKTYPE_EMBEDDED,
+ .JackType = MIDI_JACKTYPE_EMBEDDED,
.JackID = 0x01,
.JackStrIndex = NO_DESCRIPTOR
@@ -156,7 +156,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface},
.Subtype = DSUBTYPE_InputJack,
- .JackType = JACKTYPE_EXTERNAL,
+ .JackType = MIDI_JACKTYPE_EXTERNAL,
.JackID = 0x02,
.JackStrIndex = NO_DESCRIPTOR
@@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface},
.Subtype = DSUBTYPE_OutputJack,
- .JackType = JACKTYPE_EMBEDDED,
+ .JackType = MIDI_JACKTYPE_EMBEDDED,
.JackID = 0x03,
.NumberOfPins = 1,
@@ -182,7 +182,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface},
.Subtype = DSUBTYPE_OutputJack,
- .JackType = JACKTYPE_EXTERNAL,
+ .JackType = MIDI_JACKTYPE_EXTERNAL,
.JackID = 0x04,
.NumberOfPins = 1,
diff --git a/Demos/Device/MIDI/MIDI.c b/Demos/Device/MIDI/MIDI.c
index 1fee34705..4fef04754 100644
--- a/Demos/Device/MIDI/MIDI.c
+++ b/Demos/Device/MIDI/MIDI.c
@@ -28,19 +28,32 @@
this software.
*/
+/** \file
+ *
+ * Main source file for the MIDI demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "MIDI.h"
+/** LUFA MIDI Class driver interface configuration and state information. This structure is
+ * passed to all MIDI Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
USB_ClassInfo_MIDI_t Keyboard_MIDI_Interface =
{
- .InterfaceNumber = 0,
+ .StreamingInterfaceNumber = 1,
- .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM,
- .DataINEndpointSize = MIDI_STREAM_EPSIZE,
+ .DataINEndpointNumber = MIDI_STREAM_IN_EPNUM,
+ .DataINEndpointSize = MIDI_STREAM_EPSIZE,
- .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,
- .DataOUTEndpointSize = MIDI_STREAM_EPSIZE,
+ .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,
+ .DataOUTEndpointSize = MIDI_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)
{
SetupHardware();
@@ -55,6 +68,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -71,6 +85,7 @@ void SetupHardware(void)
USB_Init();
}
+/** Checks for changes in the position of the board joystick, sending MIDI events to the host upon each change. */
void CheckJoystickMovement(void)
{
static uint8_t PrevJoystickStatus;
@@ -133,16 +148,19 @@ void CheckJoystickMovement(void)
PrevJoystickStatus = JoystickStatus;
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
diff --git a/Demos/Device/MIDI/MIDI.h b/Demos/Device/MIDI/MIDI.h
index 10d8d3366..913b318f7 100644
--- a/Demos/Device/MIDI/MIDI.h
+++ b/Demos/Device/MIDI/MIDI.h
@@ -53,9 +53,16 @@
#include <LUFA/Drivers/USB/Class/Device/MIDI.h>
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/Demos/Device/MassStorage/MassStorage.c b/Demos/Device/MassStorage/MassStorage.c
index 8e2b9f450..5dbc4a2cc 100644
--- a/Demos/Device/MassStorage/MassStorage.c
+++ b/Demos/Device/MassStorage/MassStorage.c
@@ -28,8 +28,18 @@
this software.
*/
+/** \file
+ *
+ * Main source file for the MassStorage demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "MassStorage.h"
+/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
+ * passed to all Mass Storage Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
USB_ClassInfo_MS_t Disk_MS_Interface =
{
.InterfaceNumber = 0,
@@ -43,6 +53,9 @@ USB_ClassInfo_MS_t Disk_MS_Interface =
.TotalLUNs = TOTAL_LUNS,
};
+/** 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)
{
SetupHardware();
@@ -56,6 +69,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -74,16 +88,19 @@ void SetupHardware(void)
DataflashManager_ResetDataflashProtections();
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -92,11 +109,16 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_MS_ProcessControlPacket(&Disk_MS_Interface);
}
+/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
+ *
+ * \param MSInterfaceInfo Pointer to the Mass Storage class interface configuration structure being referenced
+ */
bool CALLBACK_USB_MS_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo)
{
bool CommandSuccess;
diff --git a/Demos/Device/MassStorage/MassStorage.h b/Demos/Device/MassStorage/MassStorage.h
index a50edac99..50a77250d 100644
--- a/Demos/Device/MassStorage/MassStorage.h
+++ b/Demos/Device/MassStorage/MassStorage.h
@@ -54,12 +54,22 @@
#include <LUFA/Drivers/USB/Class/Device/MassStorage.h>
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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_BUSY LEDS_LED2
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
+ #define LEDMASK_USB_BUSY (LEDS_LED2)
+ /** Total number of logical drives within the device - must be non-zero. */
#define TOTAL_LUNS 2
/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */
diff --git a/Demos/Device/Mouse/Mouse.c b/Demos/Device/Mouse/Mouse.c
index 01ead0012..1bc62dac6 100644
--- a/Demos/Device/Mouse/Mouse.c
+++ b/Demos/Device/Mouse/Mouse.c
@@ -27,9 +27,19 @@
arising out of or in connection with the use or performance of
this software.
*/
-
+
+/** \file
+ *
+ * Main source file for the Mouse demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "Mouse.h"
+/** LUFA HID Class driver interface configuration and state information. This structure is
+ * passed to all HID Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
USB_ClassInfo_HID_t Mouse_HID_Interface =
{
.InterfaceNumber = 0,
@@ -40,6 +50,9 @@ USB_ClassInfo_HID_t Mouse_HID_Interface =
.ReportINBufferSize = sizeof(USB_MouseReport_Data_t),
};
+/** 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)
{
SetupHardware();
@@ -53,6 +66,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -75,16 +89,19 @@ void SetupHardware(void)
TIMSK0 = (1 << OCIE0A);
}
+/** Event handler for the library USB Connection event. */
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)
{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -93,17 +110,26 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Mouse_HID_Interface);
}
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
if (Mouse_HID_Interface.IdleMSRemaining)
Mouse_HID_Interface.IdleMSRemaining--;
}
+/** HID class driver callback function for the creation of HID reports to the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report should be stored
+ *
+ * \return Number of bytes written in the report (or zero if no report is to be sent
+ */
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
{
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
@@ -130,6 +156,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
return sizeof(USB_MouseReport_Data_t);
}
+/** HID class driver callback function for the processing of HID reports from the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
+ * \param ReportData Pointer to a buffer where the created report has been stored
+ * \param ReportSize Size in bytes of the received HID report
+ */
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
diff --git a/Demos/Device/Mouse/Mouse.h b/Demos/Device/Mouse/Mouse.h
index 9134e6772..62d6d8323 100644
--- a/Demos/Device/Mouse/Mouse.h
+++ b/Demos/Device/Mouse/Mouse.h
@@ -65,9 +65,16 @@
} USB_MouseReport_Data_t;
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/Demos/Device/RNDISEthernet/RNDISEthernet.c b/Demos/Device/RNDISEthernet/RNDISEthernet.c
index 3246cd8bc..7c857197f 100644
--- a/Demos/Device/RNDISEthernet/RNDISEthernet.c
+++ b/Demos/Device/RNDISEthernet/RNDISEthernet.c
@@ -28,8 +28,18 @@
this software.
*/
+/** \file
+ *
+ * Main source file for the RNDISEthernet demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "RNDISEthernet.h"
+/** LUFA RNDIS Class driver interface configuration and state information. This structure is
+ * passed to all RNDIS Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
USB_ClassInfo_RNDIS_t Ethernet_RNDIS_Interface =
{
.ControlInterfaceNumber = 0,
@@ -46,13 +56,19 @@ USB_ClassInfo_RNDIS_t Ethernet_RNDIS_Interface =
.AdapterVendorDescription = "LUFA RNDIS Demo Adapter",
.AdapterMACAddress = {ADAPTER_MAC_ADDRESS},
};
-
+
+/** 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)
{
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ TCP_Init();
+ Webserver_Init();
+
printf_P(PSTR("\r\n\r\n****** RNDIS Demo running. ******\r\n"));
for (;;)
@@ -71,6 +87,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -84,22 +101,21 @@ void SetupHardware(void)
LEDs_Init();
SerialStream_Init(9600, false);
USB_Init();
-
- /* Initialize TCP and Webserver modules */
- TCP_Init();
- Webserver_Init();
}
+/** Event handler for the library USB Connection event. */
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)
{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -108,6 +124,7 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_RNDIS_ProcessControlPacket(&Ethernet_RNDIS_Interface);
diff --git a/Demos/Device/RNDISEthernet/RNDISEthernet.h b/Demos/Device/RNDISEthernet/RNDISEthernet.h
index f0247ce81..f0ba75a3d 100644
--- a/Demos/Device/RNDISEthernet/RNDISEthernet.h
+++ b/Demos/Device/RNDISEthernet/RNDISEthernet.h
@@ -58,11 +58,20 @@
#include <LUFA/Drivers/USB/Class/Device/RNDIS.h>
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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_BUSY LEDS_LED2
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
+ #define LEDMASK_USB_BUSY (LEDS_LED2)
/* Function Prototypes: */
void SetupHardware(void);
diff --git a/Demos/Device/USBtoSerial/USBtoSerial.c b/Demos/Device/USBtoSerial/USBtoSerial.c
index 7c89278ef..85826c2b3 100644
--- a/Demos/Device/USBtoSerial/USBtoSerial.c
+++ b/Demos/Device/USBtoSerial/USBtoSerial.c
@@ -28,11 +28,24 @@
this software.
*/
+/** \file
+ *
+ * Main source file for the USBtoSerial demo. This file contains the main tasks of
+ * the demo and is responsible for the initial application hardware configuration.
+ */
+
#include "USBtoSerial.h"
+/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */
RingBuff_t Rx_Buffer;
+
+/** Circular buffer to hold data from the serial port before it is sent to the host. */
RingBuff_t Tx_Buffer;
+/** 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 =
{
.ControlInterfaceNumber = 0,
@@ -47,6 +60,9 @@ USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface =
.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)
{
SetupHardware();
@@ -77,6 +93,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -92,16 +109,19 @@ void SetupHardware(void)
USB_Init();
}
+/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
+/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -110,27 +130,35 @@ void EVENT_USB_ConfigurationChanged(void)
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_CDC_ProcessControlPacket(&VirtualSerial_CDC_Interface);
}
+/** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer
+ * for later transmission to the host.
+ */
ISR(USART1_RX_vect, ISR_BLOCK)
{
if (USB_IsConnected)
Buffer_StoreElement(&Tx_Buffer, UDR1);
}
+/** Event handler for the CDC Class driver Line Encoding Changed event.
+ *
+ * \param CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced
+ */
void EVENT_USB_CDC_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
{
uint8_t ConfigMask = 0;
- if (CDCInterfaceInfo->LineEncoding.ParityType == Parity_Odd)
+ if (CDCInterfaceInfo->LineEncoding.ParityType == CDC_PARITY_Odd)
ConfigMask = ((1 << UPM11) | (1 << UPM10));
- else if (CDCInterfaceInfo->LineEncoding.ParityType == Parity_Even)
+ else if (CDCInterfaceInfo->LineEncoding.ParityType == CDC_PARITY_Even)
ConfigMask = (1 << UPM11);
- if (CDCInterfaceInfo->LineEncoding.CharFormat == TwoStopBits)
+ if (CDCInterfaceInfo->LineEncoding.CharFormat == CDC_LINEENCODING_TwoStopBits)
ConfigMask |= (1 << USBS1);
if (CDCInterfaceInfo->LineEncoding.DataBits == 6)
diff --git a/Demos/Device/USBtoSerial/USBtoSerial.h b/Demos/Device/USBtoSerial/USBtoSerial.h
index bc8d98398..9660381bb 100644
--- a/Demos/Device/USBtoSerial/USBtoSerial.h
+++ b/Demos/Device/USBtoSerial/USBtoSerial.h
@@ -54,9 +54,16 @@
#include <LUFA/Drivers/USB/Class/Device/CDC.h>
/* Macros: */
+ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#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)
+
+ /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#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)
/* Function Prototypes: */
diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt
index 67f88b9a3..529cac40c 100644
--- a/LUFA/ChangeLog.txt
+++ b/LUFA/ChangeLog.txt
@@ -6,10 +6,10 @@
========== TODO: ===========
- Document new class drivers
- - Re-document all demos now that they have changed
- Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES
- - Add C++ compatibility to class drivers
- Disable JTAG in demos
+ - Convert Host mode demos to class drivers
+ - Remake AVRStudio projects to reflect file structure changes
============================
/** \page Page_ChangeLog Project Changelog
diff --git a/LUFA/CompileTimeTokens.txt b/LUFA/CompileTimeTokens.txt
index 718fa8f53..dcb5816de 100644
--- a/LUFA/CompileTimeTokens.txt
+++ b/LUFA/CompileTimeTokens.txt
@@ -20,19 +20,6 @@
* this token is defined, all ANSI control codes in the application code from the TerminalCodes.h header are removed from
* the source code at compile time.
*
- * <b>NUM_BLOCKS</b> - ( \ref Group_MemoryAllocator ) \n
- * Sets the number of allocable blocks in the pseudo-heap of the dynamic memory allocation driver. This should be
- * defined as a constant larger than zero.
- *
- * <b>BLOCK_SIZE</b> - ( \ref Group_MemoryAllocator ) \n
- * Sets the size of each allocable block in the pseudo-heap of the dynamic memory allocation driver. This should be
- * defined as a constant larger than zero.
- *
- * <b>NUM_HANDLES</b> - ( \ref Group_MemoryAllocator ) \n
- * Sets the maximum number of managed memory handles which can be handed out by the dynamic memory allocation driver
- * simultaneously, before a handle (and its associated allocated memory) must be freed.
- *
- *
* \section Sec_SummaryUSBClassTokens USB Class Driver Related Tokens
* This section describes compile tokens which affect USB class-specific drivers in the LUFA library.
*
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.c b/LUFA/Drivers/USB/Class/Device/Audio.c
index d9162ff2d..acd9f6956 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.c
+++ b/LUFA/Drivers/USB/Class/Device/Audio.c
@@ -35,7 +35,7 @@ void USB_Audio_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
if (!(Endpoint_IsSETUPReceived()))
return;
- if (USB_ControlRequest.wIndex != AudioInterfaceInfo->InterfaceNumber)
+ if (USB_ControlRequest.wIndex != AudioInterfaceInfo->StreamingInterfaceNumber)
return;
switch (USB_ControlRequest.bRequest)
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.h b/LUFA/Drivers/USB/Class/Device/Audio.h
index 0ea74864a..f92b9ab91 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.h
+++ b/LUFA/Drivers/USB/Class/Device/Audio.h
@@ -36,6 +36,11 @@
#include <string.h>
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Macros: */
/** Descriptor header constant to indicate a Audio class interface descriptor. */
#define DTYPE_AudioInterface 0x24
@@ -120,7 +125,7 @@
*
* \param freq Required audio sampling frequency in HZ
*/
- #define SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}
+ #define AUDIO_SAMPLE_FREQ(freq) {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
* accepts only filled endpoint packets of audio samples.
@@ -277,7 +282,7 @@
typedef struct
{
- uint8_t InterfaceNumber;
+ uint8_t StreamingInterfaceNumber;
uint8_t DataINEndpointNumber;
uint16_t DataINEndpointSize;
@@ -301,4 +306,10 @@
void USB_Audio_WriteSample24(int32_t Sample);
bool USB_Audio_IsSampleReceived(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
bool USB_Audio_IsReadyForNextSample(USB_ClassInfo_Audio_t* AudioInterfaceInfo);
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h
index bbe1c9838..b1d7c6dda 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.h
+++ b/LUFA/Drivers/USB/Class/Device/CDC.h
@@ -36,66 +36,71 @@
#include <string.h>
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Macros: */
/** CDC Class specific request to get the current virtual serial port configuration settings. */
- #define REQ_GetLineEncoding 0x21
+ #define REQ_GetLineEncoding 0x21
/** CDC Class specific request to set the current virtual serial port configuration settings. */
- #define REQ_SetLineEncoding 0x20
+ #define REQ_SetLineEncoding 0x20
/** CDC Class specific request to set the current virtual serial port handshake line states. */
- #define REQ_SetControlLineState 0x22
+ #define REQ_SetControlLineState 0x22
/** Notification type constant for a change in the virtual serial port handshake line states, for
* use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
* notification endpoint.
*/
- #define NOTIF_SerialState 0x20
+ #define NOTIF_SerialState 0x20
/** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that the DTR line state should be high.
*/
- #define CONTROL_LINE_OUT_DTR (1 << 0)
+ #define CDC_CONTROL_LINE_OUT_DTR (1 << 0)
/** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that theRTS line state should be high.
*/
- #define CONTROL_LINE_OUT_RTS (1 << 1)
+ #define CDC_CONTROL_LINE_OUT_RTS (1 << 1)
/** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DCD line state is currently high.
*/
- #define CONTROL_LINE_IN_DCD (1 << 0)
+ #define CDC_CONTROL_LINE_IN_DCD (1 << 0)
/** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DSR line state is currently high.
*/
- #define CONTROL_LINE_IN_DSR (1 << 1)
+ #define CDC_CONTROL_LINE_IN_DSR (1 << 1)
/** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the BREAK line state is currently high.
*/
- #define CONTROL_LINE_IN_BREAK (1 << 2)
+ #define CDC_CONTROL_LINE_IN_BREAK (1 << 2)
/** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the RING line state is currently high.
*/
- #define CONTROL_LINE_IN_RING (1 << 3)
+ #define CDC_CONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a framing error has occurred on the virtual serial port.
*/
- #define CONTROL_LINE_IN_FRAMEERROR (1 << 4)
+ #define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a parity error has occurred on the virtual serial port.
*/
- #define CONTROL_LINE_IN_PARITYERROR (1 << 5)
+ #define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a data overrun error has occurred on the virtual serial port.
*/
- #define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
+ #define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
/** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a
* uniform structure but variable sized data payloads, thus cannot be represented accurately by
@@ -116,19 +121,19 @@
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
{
- OneStopBit = 0, /**< Each frame contains one stop bit */
- OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
- TwoStopBits = 2, /**< Each frame contains two stop bits */
+ CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit */
+ CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
+ CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits */
};
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t
{
- Parity_None = 0, /**< No parity bit mode on each frame */
- Parity_Odd = 1, /**< Odd parity bit mode on each frame */
- Parity_Even = 2, /**< Even parity bit mode on each frame */
- Parity_Mark = 3, /**< Mark parity bit mode on each frame */
- Parity_Space = 4, /**< Space parity bit mode on each frame */
+ CDC_PARITY_None = 0, /**< No parity bit mode on each frame */
+ CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame */
+ CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame */
+ CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame */
+ CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame */
};
/* Type Defines: */
@@ -171,7 +176,6 @@
void EVENT_USB_CDC_ControLineStateChanged(void) ATTR_WEAK ATTR_ALIAS(USB_CDC_Event_Stub);;
#endif
- void USB_CDC_USBTask(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
bool USB_CDC_ConfigureEndpoints(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
void USB_CDC_ProcessControlPacket(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
void USB_CDC_USBTask(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
@@ -184,5 +188,10 @@
uint16_t USB_CDC_BytesReceived(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
uint8_t USB_CDC_ReceiveByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo);
void USB_CDC_SendSerialLineStateChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint16_t LineStateMask);
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
#endif
diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h
index 4501fcb1c..9a2f803a4 100644
--- a/LUFA/Drivers/USB/Class/Device/HID.h
+++ b/LUFA/Drivers/USB/Class/Device/HID.h
@@ -36,6 +36,11 @@
#include <string.h>
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Macros: */
/** HID Class Specific Request to get the current HID report from the device. */
#define REQ_GetReport 0x01
@@ -111,4 +116,9 @@
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize);
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.h b/LUFA/Drivers/USB/Class/Device/MIDI.h
index 17823938c..890d3bb55 100644
--- a/LUFA/Drivers/USB/Class/Device/MIDI.h
+++ b/LUFA/Drivers/USB/Class/Device/MIDI.h
@@ -37,6 +37,11 @@
#include <string.h>
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Macros: */
/** Audio class descriptor subtype value for a Audio class specific MIDI input jack descriptor. */
#define DSUBTYPE_InputJack 0x02
@@ -45,10 +50,10 @@
#define DSUBTYPE_OutputJack 0x03
/** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
- #define JACKTYPE_EMBEDDED 0x01
+ #define MIDI_JACKTYPE_EMBEDDED 0x01
/** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */
- #define JACKTYPE_EXTERNAL 0x02
+ #define MIDI_JACKTYPE_EXTERNAL 0x02
/** MIDI command for a note on (activation) event */
#define MIDI_COMMAND_NOTE_ON 0x09
@@ -137,7 +142,7 @@
typedef struct
{
- uint8_t InterfaceNumber;
+ uint8_t StreamingInterfaceNumber;
uint8_t DataINEndpointNumber;
uint16_t DataINEndpointSize;
@@ -155,4 +160,9 @@
void USB_MIDI_SendEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);
bool USB_MIDI_ReceiveEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.c b/LUFA/Drivers/USB/Class/Device/MassStorage.c
index 1c41f6046..62c5f0407 100644
--- a/LUFA/Drivers/USB/Class/Device/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Device/MassStorage.c
@@ -102,16 +102,16 @@ void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo)
{
if (USB_MS_ReadInCommandBlock(MSInterfaceInfo))
{
- if (MSInterfaceInfo->CommandBlock.Flags & COMMAND_DIRECTION_DATA_IN)
+ if (MSInterfaceInfo->CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
Endpoint_SelectEndpoint(MSInterfaceInfo->DataINEndpointNumber);
MSInterfaceInfo->CommandStatus.Status = CALLBACK_USB_MS_SCSICommandReceived(MSInterfaceInfo) ?
- Command_Pass : Command_Fail;
- MSInterfaceInfo->CommandStatus.Signature = CSW_SIGNATURE;
+ SCSI_Command_Pass : SCSI_Command_Fail;
+ MSInterfaceInfo->CommandStatus.Signature = MS_CSW_SIGNATURE;
MSInterfaceInfo->CommandStatus.Tag = MSInterfaceInfo->CommandBlock.Tag;
MSInterfaceInfo->CommandStatus.DataTransferResidue = MSInterfaceInfo->CommandBlock.DataTransferLength;
- if ((MSInterfaceInfo->CommandStatus.Status == Command_Fail) && (MSInterfaceInfo->CommandStatus.DataTransferResidue))
+ if ((MSInterfaceInfo->CommandStatus.Status == SCSI_Command_Fail) && (MSInterfaceInfo->CommandStatus.DataTransferResidue))
Endpoint_StallTransaction();
USB_MS_ReturnCommandStatus(MSInterfaceInfo);
@@ -138,12 +138,12 @@ static bool USB_MS_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo)
CallbackMSInterfaceInfo = MSInterfaceInfo;
Endpoint_Read_Stream_LE(&MSInterfaceInfo->CommandBlock,
- (sizeof(CommandBlockWrapper_t) - MAX_SCSI_COMMAND_LENGTH),
+ (sizeof(CommandBlockWrapper_t) - 16),
StreamCallback_AbortOnMassStoreReset);
- if ((MSInterfaceInfo->CommandBlock.Signature != CBW_SIGNATURE) ||
+ if ((MSInterfaceInfo->CommandBlock.Signature != MS_CBW_SIGNATURE) ||
(MSInterfaceInfo->CommandBlock.LUN >= MSInterfaceInfo->TotalLUNs) ||
- (MSInterfaceInfo->CommandBlock.SCSICommandLength > MAX_SCSI_COMMAND_LENGTH))
+ (MSInterfaceInfo->CommandBlock.SCSICommandLength > 16))
{
Endpoint_StallTransaction();
Endpoint_SelectEndpoint(MSInterfaceInfo->DataINEndpointNumber);
diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.h b/LUFA/Drivers/USB/Class/Device/MassStorage.h
index c1874b218..cf2b5749a 100644
--- a/LUFA/Drivers/USB/Class/Device/MassStorage.h
+++ b/LUFA/Drivers/USB/Class/Device/MassStorage.h
@@ -36,27 +36,29 @@
#include <string.h>
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Macros: */
/** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */
#define REQ_MassStorageReset 0xFF
/** Mass Storage Class specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */
#define REQ_GetMaxLUN 0xFE
-
- /** Maximum length of a SCSI command which can be issued by the device or host in a Mass Storage bulk wrapper. */
- #define MAX_SCSI_COMMAND_LENGTH 16
/** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
- #define CBW_SIGNATURE 0x43425355UL
+ #define MS_CBW_SIGNATURE 0x43425355UL
/** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */
- #define CSW_SIGNATURE 0x53425355UL
+ #define MS_CSW_SIGNATURE 0x53425355UL
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */
- #define COMMAND_DIRECTION_DATA_OUT (0 << 7)
+ #define MS_COMMAND_DIR_DATA_OUT (0 << 7)
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */
- #define COMMAND_DIRECTION_DATA_IN (1 << 7)
+ #define MS_COMMAND_DIR_DATA_IN (1 << 7)
/* Type defines: */
/** Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
@@ -68,7 +70,7 @@
uint8_t Flags; /**< Command block flags, indicating command data direction */
uint8_t LUN; /**< Logical Unit number this command is issued to */
uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */
- uint8_t SCSICommandData[MAX_SCSI_COMMAND_LENGTH]; /**< Issued SCSI command in the Command Block */
+ uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block */
} CommandBlockWrapper_t;
/** Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
@@ -84,9 +86,9 @@
/** Enum for the possible command status wrapper return status codes. */
enum MassStorage_CommandStatusCodes_t
{
- Command_Pass = 0, /**< Command completed with no error */
- Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */
- Phase_Error = 2 /**< Command failed due to being invalid in the current phase */
+ SCSI_Command_Pass = 0, /**< Command completed with no error */
+ SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */
+ SCSI_Phase_Error = 2 /**< Command failed due to being invalid in the current phase */
};
/* Type Defines: */
@@ -118,10 +120,15 @@
static uint8_t StreamCallback_AbortOnMassStoreReset(void);
#endif
- void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo);
bool USB_MS_ConfigureEndpoints(USB_ClassInfo_MS_t* MSInterfaceInfo);
void USB_MS_ProcessControlPacket(USB_ClassInfo_MS_t* MSInterfaceInfo);
+ void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo);
bool CALLBACK_USB_MS_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo);
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.h b/LUFA/Drivers/USB/Class/Device/RNDIS.h
index 708f57d34..09d48c31e 100644
--- a/LUFA/Drivers/USB/Class/Device/RNDIS.h
+++ b/LUFA/Drivers/USB/Class/Device/RNDIS.h
@@ -37,6 +37,11 @@
#include "../../USB.h"
#include "RNDISConstants.h"
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Macros: */
/** Implemented RNDIS Version Major */
#define REMOTE_NDIS_VERSION_MAJOR 0x01
@@ -252,8 +257,13 @@
void* SetData, uint16_t SetSize);
#endif
- void USB_RNDIS_USBTask(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
bool USB_RNDIS_ConfigureEndpoints(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
void USB_RNDIS_ProcessControlPacket(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
+ void USB_RNDIS_USBTask(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
#endif
diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h
index e6d2beaa7..80ace8720 100644
--- a/LUFA/Drivers/USB/HighLevel/Events.h
+++ b/LUFA/Drivers/USB/HighLevel/Events.h
@@ -165,7 +165,7 @@
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation).
*
- * \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage.
+ * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
*/
void EVENT_USB_DeviceAttached(void);
@@ -178,7 +178,7 @@
* \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
* \ref Group_USBManagement documentation).
*
- * \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage.
+ * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
*/
void EVENT_USB_DeviceUnattached(void);
diff --git a/LUFA/MainPage.txt b/LUFA/MainPage.txt
index 030fdba9d..2ff8b0c65 100644
--- a/LUFA/MainPage.txt
+++ b/LUFA/MainPage.txt
@@ -19,11 +19,11 @@
* - AT90USB1287 (USB Host and Device)
* - AT90USB646 (USB Device Only)
* - AT90USB647 (USB Host and Device)
- * - AT90USB162 (USB Device Only)
* - AT90USB82 (USB Device Only)
+ * - AT90USB162 (USB Device Only)
* - ATMEGA16U4 (USB Device Only)
- * - ATMEGA32U6 (USB Device Only)
* - ATMEGA32U4 (USB Device Only)
+ * - ATMEGA32U6 (USB Device Only)
*
* Currently supported Atmel boards:
* - AT90USBKEY
@@ -95,9 +95,9 @@
*
*
* \section Sec_Donations Donate
- * I am a 20 year old University student studying for a double degree in Computer Science and Electronics
- * Engineering. This leaves little time for any sort of work or leisure. Please consider donating a small amount
- * to myself to support this and my future Open Source projects. You can donate any amount via PayPal on my
- * website, http://www.fourwalledcubicle.com . All donations are greatly appreciated.
+ * I am a 20 year old University student studying for a double degree in Computer Science and Electronics Engineering.
+ * The development and support of this library requires much effort from myself. Please consider donating a small amount
+ * to myself to support this and my future Open Source projects. You can donate any amount via PayPal on my website,
+ * http://www.fourwalledcubicle.com . All donations are greatly appreciated.
*/
diff --git a/LUFA/MigrationInformation.txt b/LUFA/MigrationInformation.txt
index 2ee452c86..eed15c4f4 100644
--- a/LUFA/MigrationInformation.txt
+++ b/LUFA/MigrationInformation.txt
@@ -16,7 +16,6 @@
* - Support for non-control data endpoint interrupts has been dropped due to many issues in the implementation. All existing
* projects using interrupts on non-control endpoints should switch to polling. For control interrupts, the library can
* manage the control endpoint via interrupts automatically by compiling with the INTERRUPT_CONTROL_ENDPOINT token defined.
- * - The Endpoint_ClearEndpointInterrupt() macro has been deleted and references to it should be removed.
* - The DESCRIPTOR_ADDRESS() macro has been removed. User applications should use normal casts to obtain a descriptor's memory
* address.
* - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See
@@ -32,13 +31,12 @@
* <b>Host Mode</b>
* - Support for non-control data pipe interrupts has been dropped due to many issues in the implementation. All existing
* projects using interrupts on non-control pipes should switch to polling.
- * - The Pipe_ClearPipeInterrupt() macro has been deleted and references to it should be removed.
* - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See
* \ref Group_Events for new API details.
* - The STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular
* function signatures of a function accepting no arguments and returning a uint8_t value.
* - The DESCRIPTOR_COMPARATOR() macro has been removed. User applications should replace all instances of the macro with
- * regular function signatures of a function accepting a pointer to the descriptor to test, and returning a uint8_t value.
+ * regular function signatures of a function accepting a void pointer to the descriptor to test, and returning a uint8_t value.
*
*
* \section Sec_Migration090510 Migrating from 090401 to 090510
diff --git a/LUFA/VIDAndPIDValues.txt b/LUFA/VIDAndPIDValues.txt
index 441875c84..296098fc5 100644
--- a/LUFA/VIDAndPIDValues.txt
+++ b/LUFA/VIDAndPIDValues.txt
@@ -48,7 +48,7 @@
* 0x2041
* </td>
* <td>
- * Mouse Demo Application (and derivatives)
+ * Mouse Demo Application
* </td>
* </tr>
*
@@ -60,7 +60,7 @@
* 0x2042
* </td>
* <td>
- * Keyboard Demo Application (and derivatives)
+ * Keyboard Demo Application
* </td>
* </tr>
*
diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c
index 871db28c3..e32397c8b 100644
--- a/Projects/Magstripe/Magstripe.c
+++ b/Projects/Magstripe/Magstripe.c
@@ -29,10 +29,23 @@
this software.
*/
+/** \file
+ *
+ * Main source file for the MagStripe reader program. This file contains the main tasks of
+ * the project and is responsible for the initial application hardware configuration.
+ */
+
#include "Magstripe.h"
+/** Bit buffers to hold the read bits for each of the three magnetic card tracks before they are transmitted
+ * to the host as keyboard presses.
+ */
BitBuffer_t TrackDataBuffers[3];
+/** LUFA HID Class driver interface configuration and state information. This structure is
+ * passed to all HID Class driver functions, so that multiple instances of the same class
+ * within a device can be differentiated from one another.
+ */
USB_ClassInfo_HID_t Keyboard_HID_Interface =
{
.InterfaceNumber = 0,
@@ -43,6 +56,9 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
.ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
};
+/** 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)
{
SetupHardware();
@@ -60,6 +76,7 @@ int main(void)
}
}
+/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
@@ -80,6 +97,9 @@ void SetupHardware(void)
TIMSK0 = (1 << OCIE0A);
}
+/** Determines if a card has been inserted, and if so reads in each track's contents into the bit buffers
+ * until they are read out to the host as a series of keyboard presses.
+ */
void ReadMagstripeData(void)
{
/* Arrays to hold the buffer pointers, clock and data bit masks for the separate card tracks */
@@ -111,22 +131,32 @@ void ReadMagstripeData(void)
}
}
+/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
USB_HID_ConfigureEndpoints(&Keyboard_HID_Interface);
}
+/** Event handler for the library USB Unhandled Control Packet event. */
void EVENT_USB_UnhandledControlPacket(void)
{
USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);
}
+/** Timer 0 CTC ISR, firing once each millisecond to keep track of elapsed idle time in the HID interface. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
if (Keyboard_HID_Interface.IdleMSRemaining)
Keyboard_HID_Interface.IdleMSRemaining--;
}
+/** HID Class driver callback function for the creation of a HID report for the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID interface structure for the HID interface being referenced
+ * \param ReportData Pointer to the preallocated report buffer where the created report should be stored
+ *
+ * \return Number of bytes in the created report
+ */
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
{
static bool IsKeyReleaseReport;
@@ -168,6 +198,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
return sizeof(USB_KeyboardReport_Data_t);
}
+/** HID Class driver callback function for the processing of a received HID report from the host.
+ *
+ * \param HIDInterfaceInfo Pointer to the HID interface structure for the HID interface being referenced
+ * \param ReportData Pointer to the report buffer where the received report is stored
+ * \param ReportSize Size in bytes of the report received from the host
+ */
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports