aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/ClassDriver
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-01-03 03:48:40 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-01-03 03:48:40 +0000
commit58a39c6666cd9b085e402d5edc49d58fb759a9a3 (patch)
tree2a9e1015f8aa8cce034de6b3bd726492b36e70ac /Demos/Device/ClassDriver
parent7f9f97c792dee6875fbca9806422bdd7d6c5a657 (diff)
downloadlufa-58a39c6666cd9b085e402d5edc49d58fb759a9a3.tar.gz
lufa-58a39c6666cd9b085e402d5edc49d58fb759a9a3.tar.bz2
lufa-58a39c6666cd9b085e402d5edc49d58fb759a9a3.zip
Clean up MassStorageKeyboard demo.
Diffstat (limited to 'Demos/Device/ClassDriver')
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c12
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h19
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c15
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h1
4 files changed, 17 insertions, 30 deletions
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
index 1deda8e02..b779ea342 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
@@ -29,6 +29,10 @@
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
*
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
@@ -129,7 +133,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
- .Interface =
+ .MassStorageInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
@@ -145,7 +149,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .DataInEndpoint =
+ .MassStorageDataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -155,7 +159,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .DataOutEndpoint =
+ .MassStorageDataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -181,8 +185,6 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
-
.KeyboardHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_t), .Type = DTYPE_HID},
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
index 6904b898a..c29d9086d 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
@@ -44,10 +44,6 @@
#include <LUFA/Drivers/USB/Class/MassStorage.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: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPNUM 1
@@ -72,22 +68,13 @@
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
- USB_Descriptor_Interface_t Interface;
- USB_Descriptor_Endpoint_t DataInEndpoint;
- USB_Descriptor_Endpoint_t DataOutEndpoint;
+ USB_Descriptor_Interface_t MassStorageInterface;
+ USB_Descriptor_Endpoint_t MassStorageDataInEndpoint;
+ USB_Descriptor_Endpoint_t MassStorageDataOutEndpoint;
USB_Descriptor_Interface_t KeyboardInterface;
USB_HID_Descriptor_t KeyboardHID;
USB_Descriptor_Endpoint_t KeyboardEndpoint;
} 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: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
index 25b51b57b..683ab66f7 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
@@ -118,12 +118,6 @@ void SetupHardware(void)
/* Clear Dataflash sector protections, if enabled */
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. */
@@ -145,8 +139,11 @@ void EVENT_USB_Device_ConfigurationChanged(void)
if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ USB_Device_EnableSOFEvents();
}
/** 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
return CommandSuccess;
}
-/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+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.
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
index ce2114581..41b899a31 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
@@ -87,6 +87,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);