diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-06-02 10:54:32 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-06-02 10:54:32 +0000 |
commit | 7c5444b89a49df7cb671b0b041567990d2a3012e (patch) | |
tree | 481a5b56d9f360773112b00761aa430d8121d976 /LUFA/Drivers/USB/Class | |
parent | 74b7c07e96562158de294f92baed4c83b4fce970 (diff) | |
download | lufa-7c5444b89a49df7cb671b0b041567990d2a3012e.tar.gz lufa-7c5444b89a49df7cb671b0b041567990d2a3012e.tar.bz2 lufa-7c5444b89a49df7cb671b0b041567990d2a3012e.zip |
Removed new Start of Frame event from the library; performance suffered far too much and it was only useful in one of the standard classes (HID). Altered HID demos to use the previous method of tracking millisecond periods via a hardware timer rather than the SOF events.
Fixed MIDI class driver blocking on unread events to the host.
Diffstat (limited to 'LUFA/Drivers/USB/Class')
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/HID.c | 26 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/HID.h | 3 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/MIDI.c | 28 |
3 files changed, 10 insertions, 47 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c index fbc5e3a5c..5f8ccfbae 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.c +++ b/LUFA/Drivers/USB/Class/Device/HID.c @@ -45,7 +45,7 @@ void USB_HID_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo) {
Endpoint_ClearSETUP();
- uint8_t ReportINData[HIDInterfaceInfo->ReportBufferSize];
+ uint8_t ReportINData[HIDInterfaceInfo->ReportINBufferSize];
uint16_t ReportINSize;
memset(ReportINData, 0, sizeof(ReportINData));
@@ -146,12 +146,6 @@ bool USB_HID_ConfigureEndpoints(USB_ClassInfo_HID_t* HIDInterfaceInfo) return true;
}
-
-void USB_HID_RegisterStartOfFrame(USB_ClassInfo_HID_t* HIDInterfaceInfo)
-{
- if (HIDInterfaceInfo->IdleMSRemaining)
- HIDInterfaceInfo->IdleMSRemaining--;
-}
void USB_HID_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo)
{
@@ -166,7 +160,7 @@ void USB_HID_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo) if (HIDInterfaceInfo->IdleCount && !(HIDInterfaceInfo->IdleMSRemaining))
HIDInterfaceInfo->IdleMSRemaining = HIDInterfaceInfo->IdleCount;
- uint8_t ReportINData[HIDInterfaceInfo->ReportBufferSize];
+ uint8_t ReportINData[HIDInterfaceInfo->ReportINBufferSize];
uint16_t ReportINSize;
memset(ReportINData, 0, sizeof(ReportINData));
@@ -174,13 +168,7 @@ void USB_HID_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo) ReportINSize = CALLBACK_USB_HID_CreateNextHIDReport(HIDInterfaceInfo, ReportINData);
if (ReportINSize)
- {
- Endpoint_Write_Stream_LE(ReportINData, ReportINSize
- #if !defined(NO_STREAM_CALLBACKS)
- , NO_STREAM_CALLBACK
- #endif
- );
- }
+ Endpoint_Write_Stream_LE(ReportINData, ReportINSize, NO_STREAM_CALLBACK);
Endpoint_ClearIN();
}
@@ -195,13 +183,7 @@ void USB_HID_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo) uint8_t ReportOUTData[ReportOUTSize];
if (ReportOUTSize)
- {
- Endpoint_Read_Stream_LE(ReportOUTData, ReportOUTSize
- #if !defined(NO_STREAM_CALLBACKS)
- , NO_STREAM_CALLBACK
- #endif
- );
- }
+ Endpoint_Read_Stream_LE(ReportOUTData, ReportOUTSize, NO_STREAM_CALLBACK);
CALLBACK_USB_HID_ProcessReceivedHIDReport(HIDInterfaceInfo, ReportOUTData, ReportOUTSize);
diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h index 8fdeb064a..4501fcb1c 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.h +++ b/LUFA/Drivers/USB/Class/Device/HID.h @@ -96,7 +96,7 @@ uint8_t ReportOUTEndpointNumber; /**< Endpoint number of the HID interface's OUT report endpoint, if used */
uint16_t ReportOUTEndpointSize; /**< Size in bytes of the HID interface's OUT report endpoint, if used */
- uint8_t ReportBufferSize;
+ uint8_t ReportINBufferSize;
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode */
uint16_t IdleCount; /**< Report idle period, in ms, set by the host */
@@ -106,7 +106,6 @@ /* Function Prototypes: */
bool USB_HID_ConfigureEndpoints(USB_ClassInfo_HID_t* HIDInterfaceInfo);
void USB_HID_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo);
- void USB_HID_RegisterStartOfFrame(USB_ClassInfo_HID_t* HIDInterfaceInfo);
void USB_HID_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.c b/LUFA/Drivers/USB/Class/Device/MIDI.c index 9b4cd4b04..42c06904b 100644 --- a/LUFA/Drivers/USB/Class/Device/MIDI.c +++ b/LUFA/Drivers/USB/Class/Device/MIDI.c @@ -55,36 +55,18 @@ bool USB_MIDI_ConfigureEndpoints(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo) return true;
}
-void USB_MIDI_SendNoteChange(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, const uint8_t Pitch, const bool OnOff,
- const uint8_t CableID, const uint8_t Channel)
-{
- if (!(USB_IsConnected))
- return;
-
- Endpoint_SelectEndpoint(MIDIInterfaceInfo->DataINEndpointNumber);
- while (!(Endpoint_IsReadWriteAllowed()));
-
- uint8_t Command = ((OnOff)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
-
- Endpoint_Write_Byte((CableID << 4) | (Command >> 4));
-
- Endpoint_Write_Byte(Command | Channel);
- Endpoint_Write_Byte(Pitch);
- Endpoint_Write_Byte(MIDI_STANDARD_VELOCITY);
-
- Endpoint_ClearIN();
-}
-
void USB_MIDI_SendEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event)
{
if (!(USB_IsConnected))
return;
Endpoint_SelectEndpoint(MIDIInterfaceInfo->DataINEndpointNumber);
- while (!(Endpoint_IsReadWriteAllowed()));
- Endpoint_Write_Stream_LE(Event, sizeof(USB_MIDI_EventPacket_t), NO_STREAM_CALLBACK);
- Endpoint_ClearIN();
+ if (Endpoint_IsReadWriteAllowed());
+ {
+ Endpoint_Write_Stream_LE(Event, sizeof(USB_MIDI_EventPacket_t), NO_STREAM_CALLBACK);
+ Endpoint_ClearIN();
+ }
}
bool USB_MIDI_ReceiveEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB_MIDI_EventPacket_t* Event)
|