Minor documentation page updates.
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 4 Jun 2009 02:55:30 +0000 (02:55 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 4 Jun 2009 02:55:30 +0000 (02:55 +0000)
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.

47 files changed:
Bootloaders/CDC/makefile
Bootloaders/DFU/makefile
Bootloaders/TeensyHID/makefile
Demos/Device/AudioInput/AudioInput.c
Demos/Device/AudioInput/AudioInput.h
Demos/Device/AudioInput/Descriptors.c
Demos/Device/AudioOutput/AudioOutput.c
Demos/Device/AudioOutput/AudioOutput.h
Demos/Device/AudioOutput/Descriptors.c
Demos/Device/CDC/CDC.c
Demos/Device/CDC/CDC.h
Demos/Device/DualCDC/DualCDC.c
Demos/Device/DualCDC/DualCDC.h
Demos/Device/GenericHID/GenericHID.c
Demos/Device/GenericHID/GenericHID.h
Demos/Device/Joystick/Joystick.c
Demos/Device/Joystick/Joystick.h
Demos/Device/Keyboard/Keyboard.c
Demos/Device/Keyboard/Keyboard.h
Demos/Device/KeyboardMouse/KeyboardMouse.c
Demos/Device/KeyboardMouse/KeyboardMouse.h
Demos/Device/MIDI/Descriptors.c
Demos/Device/MIDI/MIDI.c
Demos/Device/MIDI/MIDI.h
Demos/Device/MassStorage/MassStorage.c
Demos/Device/MassStorage/MassStorage.h
Demos/Device/Mouse/Mouse.c
Demos/Device/Mouse/Mouse.h
Demos/Device/RNDISEthernet/RNDISEthernet.c
Demos/Device/RNDISEthernet/RNDISEthernet.h
Demos/Device/USBtoSerial/USBtoSerial.c
Demos/Device/USBtoSerial/USBtoSerial.h
LUFA/ChangeLog.txt
LUFA/CompileTimeTokens.txt
LUFA/Drivers/USB/Class/Device/Audio.c
LUFA/Drivers/USB/Class/Device/Audio.h
LUFA/Drivers/USB/Class/Device/CDC.h
LUFA/Drivers/USB/Class/Device/HID.h
LUFA/Drivers/USB/Class/Device/MIDI.h
LUFA/Drivers/USB/Class/Device/MassStorage.c
LUFA/Drivers/USB/Class/Device/MassStorage.h
LUFA/Drivers/USB/Class/Device/RNDIS.h
LUFA/Drivers/USB/HighLevel/Events.h
LUFA/MainPage.txt
LUFA/MigrationInformation.txt
LUFA/VIDAndPIDValues.txt
Projects/Magstripe/Magstripe.c

index e3d8e5c..cf7030d 100644 (file)
@@ -113,7 +113,6 @@ LUFA_PATH = ../..
 # List C source files here. (C dependencies are automatically generated.)\r
 SRC = $(TARGET).c                                                 \\r
          Descriptors.c                                               \\r
-         $(LUFA_PATH)/LUFA/Scheduler/Scheduler.c                     \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c           \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c               \\r
index b3eb1b0..f9f8f65 100644 (file)
@@ -113,7 +113,6 @@ LUFA_PATH = ../..
 # List C source files here. (C dependencies are automatically generated.)\r
 SRC = $(TARGET).c                                                 \\r
          Descriptors.c                                               \\r
-         $(LUFA_PATH)/LUFA/Scheduler/Scheduler.c                     \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c           \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c               \\r
index 68b0160..91d3ada 100644 (file)
@@ -113,7 +113,6 @@ LUFA_PATH = ../..
 # List C source files here. (C dependencies are automatically generated.)\r
 SRC = $(TARGET).c                                                 \\r
          Descriptors.c                                               \\r
-         $(LUFA_PATH)/LUFA/Scheduler/Scheduler.c                     \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c           \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c               \\r
index bcfb04b..31b3159 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  Main source file for the AudioInput demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "AudioInput.h"\r
 \r
+/** LUFA Audio Class driver interface configuration and state information. This structure is\r
+ *  passed to all Audio Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_Audio_t Microphone_Audio_Interface =\r
        {\r
-               .InterfaceNumber      = 0,\r
+               .StreamingInterfaceNumber = 1,\r
 \r
-               .DataINEndpointNumber = AUDIO_STREAM_EPNUM,\r
-               .DataINEndpointSize   = AUDIO_STREAM_EPSIZE,\r
+               .DataINEndpointNumber     = AUDIO_STREAM_EPNUM,\r
+               .DataINEndpointSize       = AUDIO_STREAM_EPSIZE,\r
        };\r
-               \r
+\r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -53,6 +66,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -72,6 +86,9 @@ void SetupHardware(void)
        ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_CHANNEL);\r
 }\r
 \r
+/** Processes the next audio sample by reading the last ADC conversion and writing it to the audio\r
+ *  interface, each time the sample reload timer period elapses to give a constant sample rate.\r
+ */\r
 void ProcessNextSample(void)\r
 {\r
        if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsReadyForNextSample(&Microphone_Audio_Interface))\r
@@ -90,6 +107,7 @@ void ProcessNextSample(void)
        }\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
@@ -100,6 +118,7 @@ void EVENT_USB_Connect(void)
        TCCR0B  = (1 << CS00);   // Fcpu speed\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
        /* Stop the sample reload timer */\r
@@ -108,6 +127,7 @@ void EVENT_USB_Disconnect(void)
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -116,6 +136,7 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_Audio_ProcessControlPacket(&Microphone_Audio_Interface);\r
index e9f56b3..e4dd7fe 100644 (file)
                \r
        /* Macros: */\r
                /** ADC channel number for the microphone input. */\r
-               #define MIC_IN_ADC_CHANNEL               2\r
+               #define MIC_IN_ADC_CHANNEL        2\r
                \r
                /** Maximum ADC sample value for the microphone input. */\r
-               #define SAMPLE_MAX_RANGE                 0xFFFF\r
+               #define SAMPLE_MAX_RANGE          0xFFFF\r
 \r
                /** Maximum ADC range for the microphone input. */\r
-               #define ADC_MAX_RANGE                    0x3FF\r
+               #define ADC_MAX_RANGE             0x3FF\r
 \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
        /* Function Prototypes: */\r
index b8de373..6697cfe 100644 (file)
@@ -201,7 +201,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .BitResolution            = 16,\r
                        .SampleFrequencyType      = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),\r
                \r
-                       .SampleFrequencies        = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}\r
+                       .SampleFrequencies        = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}\r
                },\r
        \r
        .AudioEndpoint = \r
index 0f19356..4ff2e74 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  Main source file for the AudioOutput demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "AudioOutput.h"\r
 \r
+/** LUFA Audio Class driver interface configuration and state information. This structure is\r
+ *  passed to all Audio Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_Audio_t Speaker_Audio_Interface =\r
        {\r
-               .InterfaceNumber       = 0,\r
+               .StreamingInterfaceNumber = 1,\r
 \r
-               .DataOUTEndpointNumber = AUDIO_STREAM_EPNUM,\r
-               .DataOUTEndpointSize   = AUDIO_STREAM_EPSIZE,\r
+               .DataOUTEndpointNumber    = AUDIO_STREAM_EPNUM,\r
+               .DataOUTEndpointSize      = AUDIO_STREAM_EPSIZE,\r
        };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -53,6 +66,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -67,6 +81,9 @@ void SetupHardware(void)
        USB_Init();\r
 }\r
 \r
+/** Processes the next audio sample by reading the last ADC conversion and writing it to the audio\r
+ *  interface, each time the sample reload timer period elapses to give a constant sample rate.\r
+ */\r
 void ProcessNextSample(void)\r
 {\r
        if ((TIFR0 & (1 << OCF0A)) && USB_Audio_IsSampleReceived(&Speaker_Audio_Interface))\r
@@ -82,10 +99,10 @@ void ProcessNextSample(void)
                int8_t  LeftSample_8Bit   = (LeftSample_16Bit  >> 8);\r
                int8_t  RightSample_8Bit  = (RightSample_16Bit >> 8);\r
                        \r
-#if defined(AUDIO_OUT_MONO)\r
                /* Mix the two channels together to produce a mono, 8-bit sample */\r
                int8_t  MixedSample_8Bit  = (((int16_t)LeftSample_8Bit + (int16_t)RightSample_8Bit) >> 1);\r
 \r
+#if defined(AUDIO_OUT_MONO)\r
                /* Load the sample into the PWM timer channel */\r
                OCRxA = ((uint8_t)MixedSample_8Bit ^ (1 << 7));\r
 #elif defined(AUDIO_OUT_STEREO)\r
@@ -93,42 +110,32 @@ void ProcessNextSample(void)
                OCRxA = ((uint8_t)LeftSample_8Bit  ^ (1 << 7));\r
                OCRxB = ((uint8_t)RightSample_8Bit ^ (1 << 7));\r
 #elif defined(AUDIO_OUT_PORTC)\r
-               /* Mix the two channels together to produce a mono, 8-bit sample */\r
-               int8_t  MixedSample_8Bit  = (((int16_t)LeftSample_8Bit + (int16_t)RightSample_8Bit) >> 1);\r
-\r
                PORTC = MixedSample_8Bit;\r
 #else\r
                uint8_t LEDMask = LEDS_NO_LEDS;\r
 \r
-               /* Make left channel positive (absolute) */\r
-               if (LeftSample_8Bit < 0)\r
-                 LeftSample_8Bit = -LeftSample_8Bit;\r
-\r
-               /* Make right channel positive (absolute) */\r
-               if (RightSample_8Bit < 0)\r
-                 RightSample_8Bit = -RightSample_8Bit;\r
+               /* Make mixed sample value positive (absolute) */\r
+               if (MixedSample_8Bit < 0)\r
+                 MixedSample_8Bit = -MixedSample_8Bit;\r
 \r
-               /* Set first LED based on sample value */\r
-               if (LeftSample_8Bit < ((128 / 8) * 1))\r
-                 LEDMask |= LEDS_LED2;\r
-               else if (LeftSample_8Bit < ((128 / 8) * 3))\r
-                 LEDMask |= (LEDS_LED1 | LEDS_LED2);\r
-               else\r
+               if (MixedSample_8Bit > ((128 / 8) * 1))\r
                  LEDMask |= LEDS_LED1;\r
+                 \r
+               if (MixedSample_8Bit > ((128 / 8) * 2))\r
+                 LEDMask |= LEDS_LED2;\r
+                 \r
+               if (MixedSample_8Bit > ((128 / 8) * 3))\r
+                 LEDMask |= LEDS_LED3;\r
 \r
-               /* Set second LED based on sample value */\r
-               if (RightSample_8Bit < ((128 / 8) * 1))\r
+               if (MixedSample_8Bit > ((128 / 8) * 4))\r
                  LEDMask |= LEDS_LED4;\r
-               else if (RightSample_8Bit < ((128 / 8) * 3))\r
-                 LEDMask |= (LEDS_LED3 | LEDS_LED4);\r
-               else\r
-                 LEDMask |= LEDS_LED3;\r
-                 \r
+\r
                LEDs_SetAllLEDs(LEDMask);\r
 #endif\r
        }\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
@@ -157,16 +164,16 @@ void EVENT_USB_Connect(void)
 #endif \r
 }\r
 \r
-/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
- *  the status LEDs, disables the sample update and PWM output timers and stops the USB and Audio management tasks.\r
- */\r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 \r
-       /* Stop the timers */\r
+       /* Stop the sample reload timer */\r
        TCCR0B = 0;\r
+\r
 #if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO))\r
+       /* Stop the PWM generation timer */\r
        TCCRxB = 0;\r
 #endif         \r
 \r
@@ -182,6 +189,7 @@ void EVENT_USB_Disconnect(void)
 #endif\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -190,6 +198,7 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_Audio_ProcessControlPacket(&Speaker_Audio_Interface);\r
index 7d112db..e8435e3 100644 (file)
                #endif\r
                \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
        /* Function Prototypes: */\r
index 92d7e0d..0039c2b 100644 (file)
@@ -201,7 +201,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .BitResolution            = 16,\r
 \r
                        .SampleFrequencyType      = (sizeof(ConfigurationDescriptor.AudioFormat.SampleFrequencies) / sizeof(AudioSampleFreq_t)),                \r
-                       .SampleFrequencies        = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}\r
+                       .SampleFrequencies        = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}\r
                },\r
        \r
        .AudioEndpoint = \r
index e6bc1a4..6f15393 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  Main source file for the CDC demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
\r
 #include "CDC.h"\r
 \r
+/** LUFA CDC Class driver interface configuration and state information. This structure is\r
+ *  passed to all CDC Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface =\r
        {\r
                .ControlInterfaceNumber     = 0,\r
@@ -44,6 +54,9 @@ USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface =
                .NotificationEndpointSize   = CDC_NOTIFICATION_EPSIZE,\r
        };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -63,6 +76,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -78,11 +92,12 @@ void SetupHardware(void)
        USB_Init();\r
 }\r
 \r
+/** Checks for changes in the position of the board joystick, sending strings to the host upon each change. */\r
 void CheckJoystickMovement(void)\r
 {\r
        uint8_t     JoyStatus_LCL = Joystick_GetStatus();\r
        char*       ReportString  = NULL;\r
-       static bool ActionSent = false;\r
+       static bool ActionSent    = false;\r
        \r
        char* JoystickStrings[] =\r
                {\r
@@ -114,16 +129,19 @@ void CheckJoystickMovement(void)
        }\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -132,6 +150,7 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_CDC_ProcessControlPacket(&VirtualSerial_CDC_Interface);\r
index dc40334..23072d6 100644 (file)
                #include <LUFA/Drivers/USB/Class/Device/CDC.h>\r
 \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
        /* Function Prototypes: */\r
index 26947f4..216902c 100644 (file)
   arising out of or in connection with the use or performance of\r
   this software.\r
 */\r
\r
+\r
+/** \file\r
+ *\r
+ *  Main source file for the DualCDC demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "DualCDC.h"\r
 \r
+/** LUFA CDC Class driver interface configuration and state information. This structure is\r
+ *  passed to all CDC Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another. This is for the first CDC interface,\r
+ *  which sends strings to the host for each joystick movement.\r
+ */\r
 USB_ClassInfo_CDC_t VirtualSerial1_CDC_Interface =\r
        {\r
                .ControlInterfaceNumber     = 0,\r
@@ -44,9 +55,14 @@ USB_ClassInfo_CDC_t VirtualSerial1_CDC_Interface =
                .NotificationEndpointSize   = CDC_NOTIFICATION_EPSIZE,\r
        };\r
 \r
+/** LUFA CDC Class driver interface configuration and state information. This structure is\r
+ *  passed to all CDC Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another. This is for the second CDC interface,\r
+ *  which echos back all received data from the host.\r
+ */\r
 USB_ClassInfo_CDC_t VirtualSerial2_CDC_Interface =\r
        {\r
-               .ControlInterfaceNumber     = 0,\r
+               .ControlInterfaceNumber     = 2,\r
 \r
                .DataINEndpointNumber       = CDC2_TX_EPNUM,\r
                .DataINEndpointSize         = CDC_TXRX_EPSIZE,\r
@@ -58,6 +74,9 @@ USB_ClassInfo_CDC_t VirtualSerial2_CDC_Interface =
                .NotificationEndpointSize   = CDC_NOTIFICATION_EPSIZE,\r
        };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -68,10 +87,12 @@ int main(void)
        {\r
                CheckJoystickMovement();\r
 \r
+               /* Discard all received data on the first CDC interface */\r
                uint16_t BytesToDiscard = USB_CDC_BytesReceived(&VirtualSerial1_CDC_Interface);\r
                while (BytesToDiscard--)\r
                  USB_CDC_ReceiveByte(&VirtualSerial1_CDC_Interface);\r
 \r
+               /* Echo all received data on the second CDC interface */\r
                uint16_t BytesToEcho = USB_CDC_BytesReceived(&VirtualSerial2_CDC_Interface);\r
                while (BytesToEcho--)\r
                  USB_CDC_SendByte(&VirtualSerial2_CDC_Interface, USB_CDC_ReceiveByte(&VirtualSerial2_CDC_Interface));\r
@@ -82,6 +103,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -97,6 +119,9 @@ void SetupHardware(void)
        USB_Init();\r
 }\r
 \r
+/** Checks for changes in the position of the board joystick, sending strings to the host upon each change\r
+ *  through the first of the CDC interfaces.\r
+ */\r
 void CheckJoystickMovement(void)\r
 {\r
        uint8_t     JoyStatus_LCL = Joystick_GetStatus();\r
@@ -133,16 +158,19 @@ void CheckJoystickMovement(void)
        }\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -154,6 +182,7 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_CDC_ProcessControlPacket(&VirtualSerial1_CDC_Interface);\r
index fc782ee..93b785d 100644 (file)
                #include <LUFA/Drivers/USB/Class/Device/CDC.h>\r
 \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
        /* Function Prototypes: */\r
index 9c8023a..b933e45 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  Main source file for the GenericHID demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "GenericHID.h"\r
 \r
+/** LUFA HID Class driver interface configuration and state information. This structure is\r
+ *  passed to all HID Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_HID_t Generic_HID_Interface =\r
        {\r
                .InterfaceNumber         = 0,\r
@@ -45,6 +55,9 @@ USB_ClassInfo_HID_t Generic_HID_Interface =
                .UsingReportProtocol     = true,\r
        };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -58,6 +71,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -78,16 +92,19 @@ void SetupHardware(void)
        TIMSK0 = (1 << OCIE0A);\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -96,17 +113,26 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_HID_ProcessControlPacket(&Generic_HID_Interface);\r
 }\r
 \r
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
 ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
 {\r
        if (Generic_HID_Interface.IdleMSRemaining)\r
          Generic_HID_Interface.IdleMSRemaining--;\r
 }\r
 \r
+/** HID class driver callback function for the creation of HID reports to the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report should be stored\r
+ *\r
+ *  \return Number of bytes written in the report (or zero if no report is to be sent\r
+ */\r
 uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)\r
 {\r
        // Create generic HID report here\r
@@ -114,6 +140,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
        return 0;\r
 }\r
 \r
+/** HID class driver callback function for the processing of HID reports from the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report has been stored\r
+ *  \param ReportSize  Size in bytes of the received HID report\r
+ */\r
 void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)\r
 {\r
        // Process received generic HID report here\r
index 94a09af..b68dc4c 100644 (file)
                #include <LUFA/Drivers/USB/Class/Device/HID.h>\r
 \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
 \r
        /* Function Prototypes: */\r
index d5c2073..66cb808 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  Main source file for the Joystick demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "Joystick.h"\r
 \r
+/** LUFA HID Class driver interface configuration and state information. This structure is\r
+ *  passed to all HID Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_HID_t Joystick_HID_Interface =\r
        {\r
                .InterfaceNumber         = 0,\r
@@ -42,6 +52,9 @@ USB_ClassInfo_HID_t Joystick_HID_Interface =
                .UsingReportProtocol     = true,\r
        };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -55,6 +68,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -77,16 +91,19 @@ void SetupHardware(void)
        TIMSK0 = (1 << OCIE0A);\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -95,17 +112,26 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_HID_ProcessControlPacket(&Joystick_HID_Interface);\r
 }\r
 \r
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
 ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
 {\r
        if (Joystick_HID_Interface.IdleMSRemaining)\r
          Joystick_HID_Interface.IdleMSRemaining--;\r
 }\r
 \r
+/** HID class driver callback function for the creation of HID reports to the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report should be stored\r
+ *\r
+ *  \return Number of bytes written in the report (or zero if no report is to be sent\r
+ */\r
 uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)\r
 {\r
        USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;\r
@@ -132,6 +158,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
        return sizeof(USB_JoystickReport_Data_t);\r
 }\r
 \r
+/** HID class driver callback function for the processing of HID reports from the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report has been stored\r
+ *  \param ReportSize  Size in bytes of the received HID report\r
+ */\r
 void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)\r
 {\r
        // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports\r
index 164c58e..9db357b 100644 (file)
                } USB_JoystickReport_Data_t;\r
                        \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
 \r
        /* Function Prototypes: */\r
index d506657..923dd71 100644 (file)
   arising out of or in connection with the use or performance of\r
   this software.\r
 */\r
\r
+\r
+/** \file\r
+ *\r
+ *  Main source file for the Keyboard demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "Keyboard.h"\r
 \r
+/** LUFA HID Class driver interface configuration and state information. This structure is\r
+ *  passed to all HID Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_HID_t Keyboard_HID_Interface =\r
     {\r
         .InterfaceNumber         = 0,\r
@@ -46,6 +56,9 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
         .IdleCount               = 500,\r
     };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
     SetupHardware();\r
@@ -59,6 +72,7 @@ int main(void)
     }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware()\r
 {\r
     /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -81,16 +95,19 @@ void SetupHardware()
        TIMSK0 = (1 << OCIE0A);\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
     LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
     LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
     LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -99,17 +116,26 @@ void EVENT_USB_ConfigurationChanged(void)
       LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
     USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);\r
 }\r
 \r
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
 ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
 {\r
        if (Keyboard_HID_Interface.IdleMSRemaining)\r
          Keyboard_HID_Interface.IdleMSRemaining--;\r
 }\r
 \r
+/** HID class driver callback function for the creation of HID reports to the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report should be stored\r
+ *\r
+ *  \return Number of bytes written in the report (or zero if no report is to be sent\r
+ */\r
 uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)\r
 {\r
     USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;\r
@@ -136,6 +162,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
     return sizeof(USB_KeyboardReport_Data_t);\r
 }\r
 \r
+/** HID class driver callback function for the processing of HID reports from the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report has been stored\r
+ *  \param ReportSize  Size in bytes of the received HID report\r
+ */\r
 void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)\r
 {\r
     uint8_t  LEDMask   = LEDS_NO_LEDS;\r
index 9cfc9ab..e04ae9e 100644 (file)
                } USB_KeyboardReport_Data_t;\r
                        \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
        /* Function Prototypes: */\r
index 71a8375..e68a247 100644 (file)
   arising out of or in connection with the use or performance of\r
   this software.\r
 */\r
\r
+\r
+/** \file\r
+ *\r
+ *  Main source file for the KeyboardMouse demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "KeyboardMouse.h"\r
 \r
+/** LUFA HID Class driver interface configuration and state information. This structure is\r
+ *  passed to all HID Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another. This is for the keyboard HID\r
+ *  interface within the device.\r
+ */\r
 USB_ClassInfo_HID_t Keyboard_HID_Interface =\r
        {\r
                .InterfaceNumber         = 0,\r
@@ -46,6 +57,11 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
                .IdleCount               = 500,\r
        };\r
        \r
+/** LUFA HID Class driver interface configuration and state information. This structure is\r
+ *  passed to all HID Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another. This is for the mouse HID\r
+ *  interface within the device.\r
+ */\r
 USB_ClassInfo_HID_t Mouse_HID_Interface =\r
        {\r
                .InterfaceNumber         = 0,\r
@@ -58,7 +74,10 @@ USB_ClassInfo_HID_t Mouse_HID_Interface =
                .ReportOUTEndpointNumber = 0,\r
                .ReportOUTEndpointSize   = 0,\r
        };\r
-       \r
+\r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -73,6 +92,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware()\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -94,16 +114,19 @@ void SetupHardware()
        TIMSK0 = (1 << OCIE0A);\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
-       LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
+    LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
-       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+    LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -115,12 +138,14 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);\r
        USB_HID_ProcessControlPacket(&Mouse_HID_Interface);\r
 }\r
 \r
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
 ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
 {\r
        if (Keyboard_HID_Interface.IdleMSRemaining)\r
@@ -130,6 +155,13 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
          Mouse_HID_Interface.IdleMSRemaining--;\r
 }\r
 \r
+/** HID class driver callback function for the creation of HID reports to the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report should be stored\r
+ *\r
+ *  \return Number of bytes written in the report (or zero if no report is to be sent\r
+ */\r
 uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)\r
 {\r
        uint8_t JoyStatus_LCL    = Joystick_GetStatus();\r
@@ -183,6 +215,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
        }\r
 }\r
 \r
+/** HID class driver callback function for the processing of HID reports from the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report has been stored\r
+ *  \param ReportSize  Size in bytes of the received HID report\r
+ */\r
 void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)\r
 {\r
        if (HIDInterfaceInfo == &Keyboard_HID_Interface)\r
index c18c6e1..9afe764 100644 (file)
                #include <LUFA/Drivers/USB/Class/Device/HID.h>\r
 \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
        /* Type Defines: */\r
index 2007858..6973a4c 100644 (file)
@@ -145,7 +145,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .Header                   = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface},\r
                        .Subtype                  = DSUBTYPE_InputJack,\r
                        \r
-                       .JackType                 = JACKTYPE_EMBEDDED,\r
+                       .JackType                 = MIDI_JACKTYPE_EMBEDDED,\r
                        .JackID                   = 0x01,\r
                        \r
                        .JackStrIndex             = NO_DESCRIPTOR\r
@@ -156,7 +156,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .Header                   = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_AudioInterface},\r
                        .Subtype                  = DSUBTYPE_InputJack,\r
                        \r
-                       .JackType                 = JACKTYPE_EXTERNAL,\r
+                       .JackType                 = MIDI_JACKTYPE_EXTERNAL,\r
                        .JackID                   = 0x02,\r
                        \r
                        .JackStrIndex             = NO_DESCRIPTOR\r
@@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .Header                   = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface},\r
                        .Subtype                  = DSUBTYPE_OutputJack,\r
                        \r
-                       .JackType                 = JACKTYPE_EMBEDDED,\r
+                       .JackType                 = MIDI_JACKTYPE_EMBEDDED,\r
                        .JackID                   = 0x03,\r
 \r
                        .NumberOfPins             = 1,\r
@@ -182,7 +182,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .Header                   = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_AudioInterface},\r
                        .Subtype                  = DSUBTYPE_OutputJack,\r
                        \r
-                       .JackType                 = JACKTYPE_EXTERNAL,\r
+                       .JackType                 = MIDI_JACKTYPE_EXTERNAL,\r
                        .JackID                   = 0x04,\r
 \r
                        .NumberOfPins             = 1,\r
index 1fee347..4fef047 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  Main source file for the MIDI demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "MIDI.h"\r
 \r
+/** LUFA MIDI Class driver interface configuration and state information. This structure is\r
+ *  passed to all MIDI Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_MIDI_t Keyboard_MIDI_Interface =\r
        {\r
-               .InterfaceNumber       = 0,\r
+               .StreamingInterfaceNumber = 1,\r
 \r
-               .DataINEndpointNumber  = MIDI_STREAM_IN_EPNUM,\r
-               .DataINEndpointSize    = MIDI_STREAM_EPSIZE,\r
+               .DataINEndpointNumber     = MIDI_STREAM_IN_EPNUM,\r
+               .DataINEndpointSize       = MIDI_STREAM_EPSIZE,\r
 \r
-               .DataOUTEndpointNumber = MIDI_STREAM_OUT_EPNUM,\r
-               .DataOUTEndpointSize   = MIDI_STREAM_EPSIZE,\r
+               .DataOUTEndpointNumber    = MIDI_STREAM_OUT_EPNUM,\r
+               .DataOUTEndpointSize      = MIDI_STREAM_EPSIZE,\r
        };\r
-       \r
+\r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -55,6 +68,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -71,6 +85,7 @@ void SetupHardware(void)
        USB_Init();\r
 }\r
 \r
+/** Checks for changes in the position of the board joystick, sending MIDI events to the host upon each change. */\r
 void CheckJoystickMovement(void)\r
 {\r
        static uint8_t PrevJoystickStatus;\r
@@ -133,16 +148,19 @@ void CheckJoystickMovement(void)
        PrevJoystickStatus = JoystickStatus;\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
index 10d8d33..913b318 100644 (file)
                #include <LUFA/Drivers/USB/Class/Device/MIDI.h>\r
 \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
        /* Function Prototypes: */\r
index 8e2b9f4..5dbc4a2 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  Main source file for the MassStorage demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "MassStorage.h"\r
 \r
+/** LUFA Mass Storage Class driver interface configuration and state information. This structure is\r
+ *  passed to all Mass Storage Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_MS_t Disk_MS_Interface =\r
        {\r
                .InterfaceNumber        = 0,\r
@@ -43,6 +53,9 @@ USB_ClassInfo_MS_t Disk_MS_Interface =
                .TotalLUNs              = TOTAL_LUNS,\r
        };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -56,6 +69,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -74,16 +88,19 @@ void SetupHardware(void)
        DataflashManager_ResetDataflashProtections();\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -92,11 +109,16 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_MS_ProcessControlPacket(&Disk_MS_Interface);\r
 }\r
 \r
+/** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.\r
+ *\r
+ *  \param MSInterfaceInfo  Pointer to the Mass Storage class interface configuration structure being referenced\r
+ */\r
 bool CALLBACK_USB_MS_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo)\r
 {\r
        bool CommandSuccess;\r
index a50edac..50a7725 100644 (file)
                #include <LUFA/Drivers/USB/Class/Device/MassStorage.h>
 \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
-               #define LEDMASK_USB_BUSY          LEDS_LED2\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
+               #define LEDMASK_USB_BUSY         (LEDS_LED2)\r
                \r
+               /** Total number of logical drives within the device - must be non-zero. */\r
                #define TOTAL_LUNS                2\r
                \r
                /** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */\r
index 01ead00..1bc62da 100644 (file)
   arising out of or in connection with the use or performance of\r
   this software.\r
 */\r
\r
+\r
+/** \file\r
+ *\r
+ *  Main source file for the Mouse demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "Mouse.h"\r
 \r
+/** LUFA HID Class driver interface configuration and state information. This structure is\r
+ *  passed to all HID Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_HID_t Mouse_HID_Interface =\r
        {\r
                .InterfaceNumber         = 0,\r
@@ -40,6 +50,9 @@ USB_ClassInfo_HID_t Mouse_HID_Interface =
                .ReportINBufferSize      = sizeof(USB_MouseReport_Data_t),\r
        };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {      \r
        SetupHardware();\r
@@ -53,6 +66,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -75,16 +89,19 @@ void SetupHardware(void)
        TIMSK0 = (1 << OCIE0A);\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
-       LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
+    LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
-       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+    LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -93,17 +110,26 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_HID_ProcessControlPacket(&Mouse_HID_Interface);\r
 }\r
 \r
+/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
 ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
 {\r
        if (Mouse_HID_Interface.IdleMSRemaining)\r
          Mouse_HID_Interface.IdleMSRemaining--;\r
 }\r
 \r
+/** HID class driver callback function for the creation of HID reports to the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report should be stored\r
+ *\r
+ *  \return Number of bytes written in the report (or zero if no report is to be sent\r
+ */\r
 uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)\r
 {\r
        USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;\r
@@ -130,6 +156,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
        return sizeof(USB_MouseReport_Data_t);\r
 }\r
 \r
+/** HID class driver callback function for the processing of HID reports from the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
+ *  \param ReportData  Pointer to a buffer where the created report has been stored\r
+ *  \param ReportSize  Size in bytes of the received HID report\r
+ */\r
 void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)\r
 {\r
        // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports\r
index 9134e67..62d6d83 100644 (file)
                } USB_MouseReport_Data_t;\r
                \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                        \r
        /* Function Prototypes: */\r
index 3246cd8..7c85719 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  Main source file for the RNDISEthernet demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "RNDISEthernet.h"\r
 \r
+/** LUFA RNDIS Class driver interface configuration and state information. This structure is\r
+ *  passed to all RNDIS Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_RNDIS_t Ethernet_RNDIS_Interface =\r
        {\r
                .ControlInterfaceNumber     = 0,\r
@@ -46,13 +56,19 @@ USB_ClassInfo_RNDIS_t Ethernet_RNDIS_Interface =
                .AdapterVendorDescription   = "LUFA RNDIS Demo Adapter",\r
                .AdapterMACAddress          = {ADAPTER_MAC_ADDRESS},\r
        };\r
-       \r
+\r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
 \r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
        \r
+       TCP_Init();\r
+       Webserver_Init();\r
+\r
        printf_P(PSTR("\r\n\r\n****** RNDIS Demo running. ******\r\n"));\r
 \r
        for (;;)\r
@@ -71,6 +87,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -84,22 +101,21 @@ void SetupHardware(void)
        LEDs_Init();\r
        SerialStream_Init(9600, false);\r
        USB_Init();\r
-\r
-       /* Initialize TCP and Webserver modules */\r
-       TCP_Init();\r
-       Webserver_Init();\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
-       LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
+    LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
-       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+    LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -108,6 +124,7 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_RNDIS_ProcessControlPacket(&Ethernet_RNDIS_Interface);\r
index f0247ce..f0ba75a 100644 (file)
                #include <LUFA/Drivers/USB/Class/Device/RNDIS.h>\r
 \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
-               #define LEDMASK_USB_BUSY          LEDS_LED2\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is busy. */\r
+               #define LEDMASK_USB_BUSY         (LEDS_LED2)\r
                \r
        /* Function Prototypes: */\r
                void SetupHardware(void);\r
index 7c89278..85826c2 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *\r
+ *  Main source file for the USBtoSerial demo. This file contains the main tasks of\r
+ *  the demo and is responsible for the initial application hardware configuration.\r
+ */\r
+\r
 #include "USBtoSerial.h"\r
 \r
+/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */\r
 RingBuff_t Rx_Buffer;\r
+\r
+/** Circular buffer to hold data from the serial port before it is sent to the host. */\r
 RingBuff_t Tx_Buffer;\r
 \r
+/** LUFA CDC Class driver interface configuration and state information. This structure is\r
+ *  passed to all CDC Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface =\r
        {\r
                .ControlInterfaceNumber     = 0,\r
@@ -47,6 +60,9 @@ USB_ClassInfo_CDC_t VirtualSerial_CDC_Interface =
                .NotificationEndpointSize   = CDC_NOTIFICATION_EPSIZE,\r
        };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -77,6 +93,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -92,16 +109,19 @@ void SetupHardware(void)
        USB_Init();\r
 }\r
 \r
+/** Event handler for the library USB Connection event. */\r
 void EVENT_USB_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
+/** Event handler for the library USB Disconnection event. */\r
 void EVENT_USB_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
@@ -110,27 +130,35 @@ void EVENT_USB_ConfigurationChanged(void)
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_CDC_ProcessControlPacket(&VirtualSerial_CDC_Interface);\r
 }\r
 \r
+/** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer\r
+ *  for later transmission to the host.\r
+ */\r
 ISR(USART1_RX_vect, ISR_BLOCK)\r
 {\r
        if (USB_IsConnected)\r
          Buffer_StoreElement(&Tx_Buffer, UDR1);\r
 }\r
 \r
+/** Event handler for the CDC Class driver Line Encoding Changed event.\r
+ *\r
+ *  \param CDCInterfaceInfo  Pointer to the CDC class interface configuration structure being referenced\r
+ */\r
 void EVENT_USB_CDC_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo)\r
 {\r
        uint8_t ConfigMask = 0;\r
 \r
-       if (CDCInterfaceInfo->LineEncoding.ParityType == Parity_Odd)\r
+       if (CDCInterfaceInfo->LineEncoding.ParityType == CDC_PARITY_Odd)\r
          ConfigMask = ((1 << UPM11) | (1 << UPM10));\r
-       else if (CDCInterfaceInfo->LineEncoding.ParityType == Parity_Even)\r
+       else if (CDCInterfaceInfo->LineEncoding.ParityType == CDC_PARITY_Even)\r
          ConfigMask = (1 << UPM11);\r
 \r
-       if (CDCInterfaceInfo->LineEncoding.CharFormat == TwoStopBits)\r
+       if (CDCInterfaceInfo->LineEncoding.CharFormat == CDC_LINEENCODING_TwoStopBits)\r
          ConfigMask |= (1 << USBS1);\r
 \r
        if (CDCInterfaceInfo->LineEncoding.DataBits == 6)\r
index bc8d983..9660381 100644 (file)
                #include <LUFA/Drivers/USB/Class/Device/CDC.h>\r
 \r
        /* Macros: */\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
                #define LEDMASK_USB_NOTREADY      LEDS_LED1\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
                #define LEDMASK_USB_ENUMERATING  (LEDS_LED2 | LEDS_LED3)\r
+\r
+               /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
                #define LEDMASK_USB_READY        (LEDS_LED2 | LEDS_LED4)\r
+\r
+               /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
        /* Function Prototypes: */\r
index 67f88b9..529cac4 100644 (file)
@@ -6,10 +6,10 @@
    \r
 ========== TODO: ===========\r
        - Document new class drivers\r
-       - Re-document all demos now that they have changed\r
        - Add standardized descriptor names to class driver structures, controlled by USE_NONSTANDARD_DESCRIPTOR_NAMES\r
-       - Add C++ compatibility to class drivers\r
        - Disable JTAG in demos\r
+       - Convert Host mode demos to class drivers\r
+       - Remake AVRStudio projects to reflect file structure changes\r
 ============================\r
 \r
  /** \page Page_ChangeLog Project Changelog\r
index 718fa8f..dcb5816 100644 (file)
  *  this token is defined, all ANSI control codes in the application code from the TerminalCodes.h header are removed from\r
  *  the source code at compile time.\r
  *\r
- *  <b>NUM_BLOCKS</b> - ( \ref Group_MemoryAllocator ) \n\r
- *  Sets the number of allocable blocks in the pseudo-heap of the dynamic memory allocation driver. This should be\r
- *  defined as a constant larger than zero.\r
- *\r
- *  <b>BLOCK_SIZE</b> - ( \ref Group_MemoryAllocator ) \n\r
- *  Sets the size of each allocable block in the pseudo-heap of the dynamic memory allocation driver. This should be\r
- *  defined as a constant larger than zero.\r
- *\r
- *  <b>NUM_HANDLES</b> - ( \ref Group_MemoryAllocator ) \n\r
- *  Sets the maximum number of managed memory handles which can be handed out by the dynamic memory allocation driver\r
- *  simultaneously, before a handle (and its associated allocated memory) must be freed.\r
- *\r
- *\r
  *  \section Sec_SummaryUSBClassTokens USB Class Driver Related Tokens\r
  *  This section describes compile tokens which affect USB class-specific drivers in the LUFA library.\r
  *\r
index d9162ff..acd9f69 100644 (file)
@@ -35,7 +35,7 @@ void USB_Audio_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
        if (!(Endpoint_IsSETUPReceived()))\r
          return;\r
          \r
-       if (USB_ControlRequest.wIndex != AudioInterfaceInfo->InterfaceNumber)\r
+       if (USB_ControlRequest.wIndex != AudioInterfaceInfo->StreamingInterfaceNumber)\r
          return;\r
 \r
        switch (USB_ControlRequest.bRequest)\r
index 0ea7486..f92b9ab 100644 (file)
 \r
                #include <string.h>\r
 \r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
        /* Macros: */\r
                /** Descriptor header constant to indicate a Audio class interface descriptor. */\r
                #define DTYPE_AudioInterface         0x24\r
                 *\r
                 *  \param freq  Required audio sampling frequency in HZ\r
                 */\r
-               #define SAMPLE_FREQ(freq)  {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}\r
+               #define AUDIO_SAMPLE_FREQ(freq)  {LowWord: ((uint32_t)freq & 0x00FFFF), HighByte: (((uint32_t)freq >> 16) & 0x0000FF)}\r
                \r
                /** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint\r
                 *  accepts only filled endpoint packets of audio samples.\r
 \r
                typedef struct\r
                {\r
-                       uint8_t  InterfaceNumber;\r
+                       uint8_t  StreamingInterfaceNumber;\r
 \r
                        uint8_t  DataINEndpointNumber;\r
                        uint16_t DataINEndpointSize;\r
                void     USB_Audio_WriteSample24(int32_t Sample);\r
                bool     USB_Audio_IsSampleReceived(USB_ClassInfo_Audio_t* AudioInterfaceInfo);\r
                bool     USB_Audio_IsReadyForNextSample(USB_ClassInfo_Audio_t* AudioInterfaceInfo);\r
+\r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+               \r
 #endif\r
index bbe1c98..b1d7c6d 100644 (file)
 \r
                #include <string.h>\r
 \r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
        /* Macros: */\r
                /** CDC Class specific request to get the current virtual serial port configuration settings. */\r
-               #define REQ_GetLineEncoding          0x21\r
+               #define REQ_GetLineEncoding              0x21\r
 \r
                /** CDC Class specific request to set the current virtual serial port configuration settings. */\r
-               #define REQ_SetLineEncoding          0x20\r
+               #define REQ_SetLineEncoding              0x20\r
 \r
                /** CDC Class specific request to set the current virtual serial port handshake line states. */\r
-               #define REQ_SetControlLineState      0x22\r
+               #define REQ_SetControlLineState          0x22\r
                \r
                /** Notification type constant for a change in the virtual serial port handshake line states, for\r
                 *  use with a USB_Notification_Header_t notification structure when sent to the host via the CDC \r
                 *  notification endpoint.\r
                 */\r
-               #define NOTIF_SerialState            0x20\r
+               #define NOTIF_SerialState                0x20\r
 \r
                /** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request\r
                 *  from the host, to indicate that the DTR line state should be high.\r
                 */\r
-               #define CONTROL_LINE_OUT_DTR         (1 << 0)\r
+               #define CDC_CONTROL_LINE_OUT_DTR         (1 << 0)\r
 \r
                /** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request\r
                 *  from the host, to indicate that theRTS line state should be high.\r
                 */\r
-               #define CONTROL_LINE_OUT_RTS         (1 << 1)\r
+               #define CDC_CONTROL_LINE_OUT_RTS         (1 << 1)\r
                \r
                /** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification\r
                 *  from the device to the host, to indicate that the DCD line state is currently high.\r
                 */\r
-               #define CONTROL_LINE_IN_DCD          (1 << 0)\r
+               #define CDC_CONTROL_LINE_IN_DCD          (1 << 0)\r
 \r
                /** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification\r
                 *  from the device to the host, to indicate that the DSR line state is currently high.\r
                 */\r
-               #define CONTROL_LINE_IN_DSR          (1 << 1)\r
+               #define CDC_CONTROL_LINE_IN_DSR          (1 << 1)\r
 \r
                /** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification\r
                 *  from the device to the host, to indicate that the BREAK line state is currently high.\r
                 */\r
-               #define CONTROL_LINE_IN_BREAK        (1 << 2)\r
+               #define CDC_CONTROL_LINE_IN_BREAK        (1 << 2)\r
 \r
                /** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification\r
                 *  from the device to the host, to indicate that the RING line state is currently high.\r
                 */\r
-               #define CONTROL_LINE_IN_RING         (1 << 3)\r
+               #define CDC_CONTROL_LINE_IN_RING         (1 << 3)\r
 \r
                /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,\r
                 *  to indicate that a framing error has occurred on the virtual serial port.\r
                 */\r
-               #define CONTROL_LINE_IN_FRAMEERROR   (1 << 4)\r
+               #define CDC_CONTROL_LINE_IN_FRAMEERROR   (1 << 4)\r
 \r
                /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,\r
                 *  to indicate that a parity error has occurred on the virtual serial port.\r
                 */\r
-               #define CONTROL_LINE_IN_PARITYERROR  (1 << 5)\r
+               #define CDC_CONTROL_LINE_IN_PARITYERROR  (1 << 5)\r
 \r
                /** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,\r
                 *  to indicate that a data overrun error has occurred on the virtual serial port.\r
                 */\r
-               #define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)\r
+               #define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6)\r
                \r
                /** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a\r
                 *  uniform structure but variable sized data payloads, thus cannot be represented accurately by\r
                /** Enum for the possible line encoding formats of a virtual serial port. */\r
                enum CDCDevice_CDC_LineCodingFormats_t\r
                {\r
-                       OneStopBit          = 0, /**< Each frame contains one stop bit */\r
-                       OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */\r
-                       TwoStopBits         = 2, /**< Each frame contains two stop bits */\r
+                       CDC_LINEENCODING_OneStopBit          = 0, /**< Each frame contains one stop bit */\r
+                       CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */\r
+                       CDC_LINEENCODING_TwoStopBits         = 2, /**< Each frame contains two stop bits */\r
                };\r
                \r
                /** Enum for the possible line encoding parity settings of a virtual serial port. */\r
                enum CDCDevice_LineCodingParity_t\r
                {\r
-                       Parity_None         = 0, /**< No parity bit mode on each frame */\r
-                       Parity_Odd          = 1, /**< Odd parity bit mode on each frame */\r
-                       Parity_Even         = 2, /**< Even parity bit mode on each frame */\r
-                       Parity_Mark         = 3, /**< Mark parity bit mode on each frame */\r
-                       Parity_Space        = 4, /**< Space parity bit mode on each frame */\r
+                       CDC_PARITY_None    = 0, /**< No parity bit mode on each frame */\r
+                       CDC_PARITY_Odd     = 1, /**< Odd parity bit mode on each frame */\r
+                       CDC_PARITY_Even    = 2, /**< Even parity bit mode on each frame */\r
+                       CDC_PARITY_Mark    = 3, /**< Mark parity bit mode on each frame */\r
+                       CDC_PARITY_Space   = 4, /**< Space parity bit mode on each frame */\r
                };\r
 \r
        /* Type Defines: */\r
                        void EVENT_USB_CDC_ControLineStateChanged(void) ATTR_WEAK ATTR_ALIAS(USB_CDC_Event_Stub);; \r
                #endif\r
        \r
-               void     USB_CDC_USBTask(USB_ClassInfo_CDC_t* CDCInterfaceInfo);\r
                bool     USB_CDC_ConfigureEndpoints(USB_ClassInfo_CDC_t* CDCInterfaceInfo);\r
                void     USB_CDC_ProcessControlPacket(USB_ClassInfo_CDC_t* CDCInterfaceInfo);\r
                void     USB_CDC_USBTask(USB_ClassInfo_CDC_t* CDCInterfaceInfo);\r
                uint16_t USB_CDC_BytesReceived(USB_ClassInfo_CDC_t* CDCInterfaceInfo);\r
                uint8_t  USB_CDC_ReceiveByte(USB_ClassInfo_CDC_t* CDCInterfaceInfo);\r
                void USB_CDC_SendSerialLineStateChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo, uint16_t LineStateMask);\r
+\r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
                \r
 #endif\r
index 4501fcb..9a2f803 100644 (file)
 \r
                #include <string.h>\r
 \r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
        /* Macros: */\r
                /** HID Class Specific Request to get the current HID report from the device. */\r
                #define REQ_GetReport      0x01\r
                uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);\r
                void     CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize);\r
 \r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+               \r
 #endif\r
index 1782393..890d3bb 100644 (file)
 \r
                #include <string.h>\r
 \r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
        /* Macros: */\r
                /** Audio class descriptor subtype value for a Audio class specific MIDI input jack descriptor. */\r
                #define DSUBTYPE_InputJack          0x02\r
                #define DSUBTYPE_OutputJack         0x03\r
                \r
                /** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */\r
-               #define JACKTYPE_EMBEDDED           0x01\r
+               #define MIDI_JACKTYPE_EMBEDDED      0x01\r
 \r
                /** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */\r
-               #define JACKTYPE_EXTERNAL           0x02\r
+               #define MIDI_JACKTYPE_EXTERNAL      0x02\r
 \r
                /** MIDI command for a note on (activation) event */\r
                #define MIDI_COMMAND_NOTE_ON        0x09\r
 \r
                typedef struct\r
                {\r
-                       uint8_t  InterfaceNumber;\r
+                       uint8_t  StreamingInterfaceNumber;\r
 \r
                        uint8_t  DataINEndpointNumber;\r
                        uint16_t DataINEndpointSize;\r
                void USB_MIDI_SendEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);\r
                bool USB_MIDI_ReceiveEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event);\r
 \r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+               \r
 #endif\r
index 1c41f60..62c5f04 100644 (file)
@@ -102,16 +102,16 @@ void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo)
        {\r
                if (USB_MS_ReadInCommandBlock(MSInterfaceInfo))\r
                {\r
-                       if (MSInterfaceInfo->CommandBlock.Flags & COMMAND_DIRECTION_DATA_IN)\r
+                       if (MSInterfaceInfo->CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)\r
                          Endpoint_SelectEndpoint(MSInterfaceInfo->DataINEndpointNumber);\r
                          \r
                        MSInterfaceInfo->CommandStatus.Status              = CALLBACK_USB_MS_SCSICommandReceived(MSInterfaceInfo) ?\r
-                                                                             Command_Pass : Command_Fail;\r
-                       MSInterfaceInfo->CommandStatus.Signature           = CSW_SIGNATURE;\r
+                                                                             SCSI_Command_Pass : SCSI_Command_Fail;\r
+                       MSInterfaceInfo->CommandStatus.Signature           = MS_CSW_SIGNATURE;\r
                        MSInterfaceInfo->CommandStatus.Tag                 = MSInterfaceInfo->CommandBlock.Tag;\r
                        MSInterfaceInfo->CommandStatus.DataTransferResidue = MSInterfaceInfo->CommandBlock.DataTransferLength;\r
 \r
-                       if ((MSInterfaceInfo->CommandStatus.Status == Command_Fail) && (MSInterfaceInfo->CommandStatus.DataTransferResidue))\r
+                       if ((MSInterfaceInfo->CommandStatus.Status == SCSI_Command_Fail) && (MSInterfaceInfo->CommandStatus.DataTransferResidue))\r
                          Endpoint_StallTransaction();\r
                        \r
                        USB_MS_ReturnCommandStatus(MSInterfaceInfo);\r
@@ -138,12 +138,12 @@ static bool USB_MS_ReadInCommandBlock(USB_ClassInfo_MS_t* MSInterfaceInfo)
 \r
        CallbackMSInterfaceInfo = MSInterfaceInfo;\r
        Endpoint_Read_Stream_LE(&MSInterfaceInfo->CommandBlock,\r
-                               (sizeof(CommandBlockWrapper_t) - MAX_SCSI_COMMAND_LENGTH),\r
+                               (sizeof(CommandBlockWrapper_t) - 16),\r
                                StreamCallback_AbortOnMassStoreReset);\r
 \r
-       if ((MSInterfaceInfo->CommandBlock.Signature         != CBW_SIGNATURE)              ||\r
+       if ((MSInterfaceInfo->CommandBlock.Signature         != MS_CBW_SIGNATURE)           ||\r
            (MSInterfaceInfo->CommandBlock.LUN               >= MSInterfaceInfo->TotalLUNs) ||\r
-               (MSInterfaceInfo->CommandBlock.SCSICommandLength >  MAX_SCSI_COMMAND_LENGTH))\r
+               (MSInterfaceInfo->CommandBlock.SCSICommandLength >  16))\r
        {\r
                Endpoint_StallTransaction();\r
                Endpoint_SelectEndpoint(MSInterfaceInfo->DataINEndpointNumber);\r
index c1874b2..cf2b574 100644 (file)
 \r
                #include <string.h>\r
 \r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
        /* Macros: */\r
                /** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */\r
                #define REQ_MassStorageReset       0xFF\r
 \r
                /** Mass Storage Class specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */\r
                #define REQ_GetMaxLUN              0xFE\r
-\r
-               /** Maximum length of a SCSI command which can be issued by the device or host in a Mass Storage bulk wrapper. */\r
-               #define MAX_SCSI_COMMAND_LENGTH    16\r
                \r
                /** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */\r
-               #define CBW_SIGNATURE              0x43425355UL\r
+               #define MS_CBW_SIGNATURE           0x43425355UL\r
 \r
                /** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */\r
-               #define CSW_SIGNATURE              0x53425355UL\r
+               #define MS_CSW_SIGNATURE           0x53425355UL\r
                \r
                /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */\r
-               #define COMMAND_DIRECTION_DATA_OUT (0 << 7)\r
+               #define MS_COMMAND_DIR_DATA_OUT    (0 << 7)\r
 \r
                /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */\r
-               #define COMMAND_DIRECTION_DATA_IN  (1 << 7)\r
+               #define MS_COMMAND_DIR_DATA_IN     (1 << 7)\r
 \r
        /* Type defines: */\r
                /** Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */\r
@@ -68,7 +70,7 @@
                        uint8_t  Flags; /**< Command block flags, indicating command data direction */\r
                        uint8_t  LUN; /**< Logical Unit number this command is issued to */\r
                        uint8_t  SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */\r
-                       uint8_t  SCSICommandData[MAX_SCSI_COMMAND_LENGTH]; /**< Issued SCSI command in the Command Block */\r
+                       uint8_t  SCSICommandData[16]; /**< Issued SCSI command in the Command Block */\r
                } CommandBlockWrapper_t;\r
                \r
                /** Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */\r
@@ -84,9 +86,9 @@
                /** Enum for the possible command status wrapper return status codes. */\r
                enum MassStorage_CommandStatusCodes_t\r
                {\r
-                       Command_Pass = 0, /**< Command completed with no error */\r
-                       Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */\r
-                       Phase_Error  = 2  /**< Command failed due to being invalid in the current phase */\r
+                       SCSI_Command_Pass = 0, /**< Command completed with no error */\r
+                       SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */\r
+                       SCSI_Phase_Error  = 2  /**< Command failed due to being invalid in the current phase */\r
                };\r
                \r
        /* Type Defines: */\r
                        static uint8_t StreamCallback_AbortOnMassStoreReset(void);\r
                #endif\r
        \r
-               void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo);\r
                bool USB_MS_ConfigureEndpoints(USB_ClassInfo_MS_t* MSInterfaceInfo);\r
                void USB_MS_ProcessControlPacket(USB_ClassInfo_MS_t* MSInterfaceInfo);\r
+               void USB_MS_USBTask(USB_ClassInfo_MS_t* MSInterfaceInfo);\r
                \r
                bool CALLBACK_USB_MS_SCSICommandReceived(USB_ClassInfo_MS_t* MSInterfaceInfo);\r
                \r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+               \r
 #endif\r
index 708f57d..09d48c3 100644 (file)
                #include "../../USB.h"\r
                #include "RNDISConstants.h"\r
                \r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
        /* Macros: */\r
                /** Implemented RNDIS Version Major */\r
                #define REMOTE_NDIS_VERSION_MAJOR             0x01\r
                                                             void* SetData, uint16_t SetSize);  \r
                #endif\r
 \r
-               void USB_RNDIS_USBTask(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);\r
                bool USB_RNDIS_ConfigureEndpoints(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);\r
                void USB_RNDIS_ProcessControlPacket(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);\r
+               void USB_RNDIS_USBTask(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);\r
+               \r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
                \r
 #endif\r
index e6d2bea..80ace87 100644 (file)
                         *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
                         *        \ref Group_USBManagement documentation).\r
                         *\r
-                        *  \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage.\r
+                        *  \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.\r
                         */\r
                        void EVENT_USB_DeviceAttached(void);\r
 \r
                         *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
                         *        \ref Group_USBManagement documentation).\r
                         *\r
-                        *  \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage.\r
+                        *  \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.\r
                         */\r
                        void EVENT_USB_DeviceUnattached(void);\r
                        \r
index 030fdba..2ff8b0c 100644 (file)
  *   - AT90USB1287 (USB Host and Device)\r
  *   - AT90USB646 (USB Device Only)\r
  *   - AT90USB647 (USB Host and Device)\r
- *   - AT90USB162 (USB Device Only)\r
  *   - AT90USB82 (USB Device Only)\r
+ *   - AT90USB162 (USB Device Only)\r
  *   - ATMEGA16U4 (USB Device Only)\r
- *   - ATMEGA32U6 (USB Device Only)\r
  *   - ATMEGA32U4 (USB Device Only)\r
+ *   - ATMEGA32U6 (USB Device Only)\r
  *\r
  *  Currently supported Atmel boards:\r
  *   - AT90USBKEY\r
@@ -95,9 +95,9 @@
  *\r
  *\r
  *  \section Sec_Donations Donate\r
- *  I am a 20 year old University student studying for a double degree in Computer Science and Electronics\r
- *  Engineering. This leaves little time for any sort of work or leisure. Please consider donating a small amount\r
- *  to myself to support this and my future Open Source projects. You can donate any amount via PayPal on my\r
- *  website, http://www.fourwalledcubicle.com . All donations are greatly appreciated.\r
+ *  I am a 20 year old University student studying for a double degree in Computer Science and Electronics Engineering.\r
+ *  The development and support of this library requires much effort from myself. Please consider donating a small amount\r
+ *  to myself to support this and my future Open Source projects. You can donate any amount via PayPal on my website, \r
+ *  http://www.fourwalledcubicle.com . All donations are greatly appreciated.\r
  */\r
  \r
index 2ee452c..eed15c4 100644 (file)
@@ -16,7 +16,6 @@
  *    - Support for non-control data endpoint interrupts has been dropped due to many issues in the implementation. All existing\r
  *      projects using interrupts on non-control endpoints should switch to polling. For control interrupts, the library can\r
  *      manage the control endpoint via interrupts automatically by compiling with the INTERRUPT_CONTROL_ENDPOINT token defined.\r
- *    - The Endpoint_ClearEndpointInterrupt() macro has been deleted and references to it should be removed.\r
  *    - The DESCRIPTOR_ADDRESS() macro has been removed. User applications should use normal casts to obtain a descriptor's memory\r
  *      address.\r
  *    - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See\r
  *  <b>Host Mode</b>\r
  *    - Support for non-control data pipe interrupts has been dropped due to many issues in the implementation. All existing\r
  *      projects using interrupts on non-control pipes should switch to polling.\r
- *    - The Pipe_ClearPipeInterrupt() macro has been deleted and references to it should be removed.\r
  *    - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See\r
  *      \ref Group_Events for new API details.\r
  *    - The STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular\r
  *      function signatures of a function accepting no arguments and returning a uint8_t value.\r
  *    - The DESCRIPTOR_COMPARATOR() macro has been removed. User applications should replace all instances of the macro with\r
- *      regular function signatures of a function accepting a pointer to the descriptor to test, and returning a uint8_t value.\r
+ *      regular function signatures of a function accepting a void pointer to the descriptor to test, and returning a uint8_t value.\r
  *\r
  *\r
  * \section Sec_Migration090510 Migrating from 090401 to 090510\r
index 441875c..296098f 100644 (file)
@@ -48,7 +48,7 @@
  *     0x2041\r
  *    </td>\r
  *    <td>\r
- *     Mouse Demo Application (and derivatives)\r
+ *     Mouse Demo Application\r
  *    </td>\r
  *   </tr>\r
  *\r
@@ -60,7 +60,7 @@
  *     0x2042\r
  *    </td>\r
  *    <td>\r
- *     Keyboard Demo Application (and derivatives)\r
+ *     Keyboard Demo Application\r
  *    </td>\r
  *   </tr>\r
  *\r
index 871db28..e32397c 100644 (file)
   this software.\r
 */\r
  \r
+/** \file\r
+ *\r
+ *  Main source file for the MagStripe reader program. This file contains the main tasks of\r
+ *  the project and is responsible for the initial application hardware configuration.\r
+ */\r
\r
 #include "Magstripe.h"\r
 \r
+/** Bit buffers to hold the read bits for each of the three magnetic card tracks before they are transmitted\r
+ *  to the host as keyboard presses.\r
+ */\r
 BitBuffer_t TrackDataBuffers[3];\r
 \r
+/** LUFA HID Class driver interface configuration and state information. This structure is\r
+ *  passed to all HID Class driver functions, so that multiple instances of the same class\r
+ *  within a device can be differentiated from one another.\r
+ */\r
 USB_ClassInfo_HID_t Keyboard_HID_Interface =\r
        {\r
                .InterfaceNumber         = 0,\r
@@ -43,6 +56,9 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
                .ReportINBufferSize      = sizeof(USB_KeyboardReport_Data_t),\r
        };\r
 \r
+/** Main program entry point. This routine contains the overall program flow, including initial\r
+ *  setup of all components and the main program loop.\r
+ */\r
 int main(void)\r
 {\r
        SetupHardware();\r
@@ -60,6 +76,7 @@ int main(void)
        }\r
 }\r
 \r
+/** Configures the board hardware and chip peripherals for the demo's functionality. */\r
 void SetupHardware(void)\r
 {\r
        /* Disable watchdog if enabled by bootloader/fuses */\r
@@ -80,6 +97,9 @@ void SetupHardware(void)
        TIMSK0 = (1 << OCIE0A);\r
 }\r
 \r
+/** Determines if a card has been inserted, and if so reads in each track's contents into the bit buffers\r
+ *  until they are read out to the host as a series of keyboard presses.\r
+ */\r
 void ReadMagstripeData(void)\r
 {\r
        /* Arrays to hold the buffer pointers, clock and data bit masks for the separate card tracks */\r
@@ -111,22 +131,32 @@ void ReadMagstripeData(void)
        }\r
 }\r
 \r
+/** Event handler for the library USB Configuration Changed event. */\r
 void EVENT_USB_ConfigurationChanged(void)\r
 {\r
        USB_HID_ConfigureEndpoints(&Keyboard_HID_Interface);\r
 }\r
 \r
+/** Event handler for the library USB Unhandled Control Packet event. */\r
 void EVENT_USB_UnhandledControlPacket(void)\r
 {\r
        USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);\r
 }\r
 \r
+/** Timer 0 CTC ISR, firing once each millisecond to keep track of elapsed idle time in the HID interface. */\r
 ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
 {\r
        if (Keyboard_HID_Interface.IdleMSRemaining)\r
          Keyboard_HID_Interface.IdleMSRemaining--;\r
 }\r
 \r
+/** HID Class driver callback function for the creation of a HID report for the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID interface structure for the HID interface being referenced\r
+ *  \param ReportData  Pointer to the preallocated report buffer where the created report should be stored\r
+ *\r
+ *  \return Number of bytes in the created report\r
+ */\r
 uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)\r
 {\r
        static bool IsKeyReleaseReport;\r
@@ -168,6 +198,12 @@ uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceI
        return sizeof(USB_KeyboardReport_Data_t);\r
 }\r
 \r
+/** HID Class driver callback function for the processing of a received HID report from the host.\r
+ *\r
+ *  \param HIDInterfaceInfo  Pointer to the HID interface structure for the HID interface being referenced\r
+ *  \param ReportData  Pointer to the report buffer where the received report is stored\r
+ *  \param ReportSize  Size in bytes of the report received from the host\r
+ */\r
 void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData, uint16_t ReportSize)\r
 {\r
        // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports\r