Commit 58a39c66 authored by Dean Camera's avatar Dean Camera
Browse files

Clean up MassStorageKeyboard demo.

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