Clean up MassStorageKeyboard demo.
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 3 Jan 2010 03:48:40 +0000 (03:48 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 3 Jan 2010 03:48:40 +0000 (03:48 +0000)
Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
LUFA/Drivers/USB/Class/Host/HIDParser.h
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/FutureChanges.txt

index 1deda8e..b779ea3 100644 (file)
   this software.\r
 */\r
 \r
   this software.\r
 */\r
 \r
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)\r
+       #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.\r
+#endif\r
+\r
 /** \file\r
  *\r
  *  USB Device Descriptors, for library use when in USB device mode. Descriptors are special \r
 /** \file\r
  *\r
  *  USB Device Descriptors, for library use when in USB device mode. Descriptors are special \r
@@ -129,7 +133,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .MaxPowerConsumption    = USB_CONFIG_POWER_MA(100)\r
                },\r
                \r
                        .MaxPowerConsumption    = USB_CONFIG_POWER_MA(100)\r
                },\r
                \r
-       .Interface = \r
+       .MassStorageInterface = \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
 \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},\r
 \r
@@ -145,7 +149,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .InterfaceStrIndex      = NO_DESCRIPTOR\r
                },\r
 \r
                        .InterfaceStrIndex      = NO_DESCRIPTOR\r
                },\r
 \r
-       .DataInEndpoint = \r
+       .MassStorageDataInEndpoint = \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
 \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
 \r
@@ -155,7 +159,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .PollingIntervalMS      = 0x00\r
                },\r
 \r
                        .PollingIntervalMS      = 0x00\r
                },\r
 \r
-       .DataOutEndpoint = \r
+       .MassStorageDataOutEndpoint = \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
 \r
                {\r
                        .Header                 = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},\r
 \r
@@ -181,8 +185,6 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
                        .InterfaceStrIndex      = NO_DESCRIPTOR\r
                },\r
 \r
                        .InterfaceStrIndex      = NO_DESCRIPTOR\r
                },\r
 \r
-\r
-\r
        .KeyboardHID = \r
                {  \r
                        .Header                 = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},\r
        .KeyboardHID = \r
                {  \r
                        .Header                 = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},\r
index 6904b89..c29d908 100644 (file)
                #include <LUFA/Drivers/USB/Class/MassStorage.h>\r
                #include <LUFA/Drivers/USB/Class/HID.h>\r
 \r
                #include <LUFA/Drivers/USB/Class/MassStorage.h>\r
                #include <LUFA/Drivers/USB/Class/HID.h>\r
 \r
-               #if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)\r
-                       #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.\r
-               #endif\r
-\r
        /* Macros: */\r
                /** Endpoint number of the Keyboard HID reporting IN endpoint. */\r
                #define KEYBOARD_EPNUM               1\r
        /* Macros: */\r
                /** Endpoint number of the Keyboard HID reporting IN endpoint. */\r
                #define KEYBOARD_EPNUM               1\r
                typedef struct\r
                {\r
                        USB_Descriptor_Configuration_Header_t Config;\r
                typedef struct\r
                {\r
                        USB_Descriptor_Configuration_Header_t Config;\r
-                       USB_Descriptor_Interface_t            Interface;\r
-                       USB_Descriptor_Endpoint_t             DataInEndpoint;\r
-                       USB_Descriptor_Endpoint_t             DataOutEndpoint;\r
+                       USB_Descriptor_Interface_t            MassStorageInterface;\r
+                       USB_Descriptor_Endpoint_t             MassStorageDataInEndpoint;\r
+                       USB_Descriptor_Endpoint_t             MassStorageDataOutEndpoint;\r
                        USB_Descriptor_Interface_t            KeyboardInterface;\r
                        USB_HID_Descriptor_t                  KeyboardHID;\r
                USB_Descriptor_Endpoint_t             KeyboardEndpoint;\r
                } USB_Descriptor_Configuration_t;\r
                        USB_Descriptor_Interface_t            KeyboardInterface;\r
                        USB_HID_Descriptor_t                  KeyboardHID;\r
                USB_Descriptor_Endpoint_t             KeyboardEndpoint;\r
                } USB_Descriptor_Configuration_t;\r
-\r
-/*             typedef struct\r
-               {\r
-                       USB_Descriptor_Configuration_Header_t Config;\r
-                       USB_Descriptor_Interface_t            Interface;\r
-                       USB_HID_Descriptor_t                  KeyboardHID;\r
-               USB_Descriptor_Endpoint_t             KeyboardEndpoint;\r
-               } USB_Descriptor_Configuration_keyboard_t;\r
-// */\r
                \r
        /* Function Prototypes: */\r
                uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)\r
                \r
        /* Function Prototypes: */\r
                uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)\r
index 25b51b5..683ab66 100644 (file)
@@ -118,12 +118,6 @@ void SetupHardware(void)
 \r
        /* Clear Dataflash sector protections, if enabled */\r
        DataflashManager_ResetDataflashProtections();\r
 \r
        /* Clear Dataflash sector protections, if enabled */\r
        DataflashManager_ResetDataflashProtections();\r
-\r
-       /* Millisecond timer initialization, with output compare interrupt enabled for the HID idle timing */\r
-       OCR0A  = ((F_CPU / 64) / 1000);\r
-       TCCR0A = (1 << WGM01);\r
-       TCCR0B = ((1 << CS01) | (1 << CS00));\r
-       TIMSK0 = (1 << OCIE0A);\r
 }\r
 \r
 /** Event handler for the library USB Connection event. */\r
 }\r
 \r
 /** Event handler for the library USB Connection event. */\r
@@ -145,8 +139,11 @@ void EVENT_USB_Device_ConfigurationChanged(void)
 \r
        if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))\r
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 \r
        if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))\r
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+\r
        if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface)))\r
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
        if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface)))\r
          LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+\r
+       USB_Device_EnableSOFEvents();\r
 }\r
 \r
 /** Event handler for the library USB Unhandled Control Request event. */\r
 }\r
 \r
 /** Event handler for the library USB Unhandled Control Request event. */\r
@@ -171,10 +168,10 @@ bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfa
        return CommandSuccess;\r
 }\r
 \r
        return CommandSuccess;\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
+/** Event handler for the USB device Start Of Frame event. */\r
+void EVENT_USB_Device_StartOfFrame(void)\r
 {\r
 {\r
-       HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);\r
+    HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);\r
 }\r
 \r
 /** HID class driver callback function for the creation of HID reports to the host.\r
 }\r
 \r
 /** HID class driver callback function for the creation of HID reports to the host.\r
index ce21145..41b899a 100644 (file)
@@ -87,6 +87,7 @@
                void EVENT_USB_Device_Disconnect(void);\r
                void EVENT_USB_Device_ConfigurationChanged(void);\r
                void EVENT_USB_Device_UnhandledControlRequest(void);\r
                void EVENT_USB_Device_Disconnect(void);\r
                void EVENT_USB_Device_ConfigurationChanged(void);\r
                void EVENT_USB_Device_UnhandledControlRequest(void);\r
+               void EVENT_USB_Device_StartOfFrame(void);\r
 \r
                bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);\r
 \r
 \r
                bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);\r
 \r
index c03f9f1..53601ec 100644 (file)
                        typedef struct\r
                        {\r
                                uint16_t                     BitOffset;      /**< Bit offset in the IN, OUT or FEATURE report of the item. */\r
                        typedef struct\r
                        {\r
                                uint16_t                     BitOffset;      /**< Bit offset in the IN, OUT or FEATURE report of the item. */\r
-                               uint8_t                      ItemType;       /**< Report item type, a value in HID_Types_t. */\r
+                               uint8_t                      ItemType;       /**< Report item type, a value in HID_ReportItemTypes_t. */\r
                                uint16_t                     ItemFlags;      /**< Item data flags, such as constant/variable, etc. */\r
                                uint8_t                      ReportID;       /**< Report ID this item belongs to, or 0x00 if device has only one report */\r
                                HID_CollectionPath_t*        CollectionPath; /**< Collection path of the item. */\r
                                uint16_t                     ItemFlags;      /**< Item data flags, such as constant/variable, etc. */\r
                                uint8_t                      ReportID;       /**< Report ID this item belongs to, or 0x00 if device has only one report */\r
                                HID_CollectionPath_t*        CollectionPath; /**< Collection path of the item. */\r
index a64428e..eea1f2b 100644 (file)
@@ -20,6 +20,8 @@
   *  - Renamed the AVRISP project folder to AVRISP-MKII to reduce confusion\r
   *  - Renamed the RESET_LINE_* makefile tokens in the AVRISP MKII Project to AUX_LINE_*, as they are not always used for target\r
   *    reset\r
   *  - Renamed the AVRISP project folder to AVRISP-MKII to reduce confusion\r
   *  - Renamed the RESET_LINE_* makefile tokens in the AVRISP MKII Project to AUX_LINE_*, as they are not always used for target\r
   *    reset\r
+  *  - Changed over the MassStorageKeyboard Class driver device demo to use Start of Frame events rather than a timer to keep track\r
+  *    of elapsed milliseconds\r
   *\r
   *  <b>Fixed:</b>\r
   *  - Fixed AVRISP project not able to enter programming mode when ISP protocol is used\r
   *\r
   *  <b>Fixed:</b>\r
   *  - Fixed AVRISP project not able to enter programming mode when ISP protocol is used\r
index 3267afc..38cbf0c 100644 (file)
@@ -27,6 +27,7 @@
   *  - Demos/Projects\r
   *      -# Multiple-Report HID device\r
   *      -# Device/Host USB bridge\r
   *  - Demos/Projects\r
   *      -# Multiple-Report HID device\r
   *      -# Device/Host USB bridge\r
+  *      -# Alternative (USB-IF endorsed) USB-Ethernet Classes\r
   *      -# Finish BluetoothHost demo\r
   *      -# Finish MIDI class Bootloader\r
   *      -# Finish SideShow demo\r
   *      -# Finish BluetoothHost demo\r
   *      -# Finish MIDI class Bootloader\r
   *      -# Finish SideShow demo\r