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.
This commit is contained in:
parent
74b7c07e96
commit
7c5444b89a
24 changed files with 78 additions and 109 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue