mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-06-28 03:52:08 +00:00
Additional fixes to the MIDI host driver due to not unfreezing/re-freezing pipes correctly (thanks to Michael Brown).
This commit is contained in:
parent
f2ae4dc255
commit
82162c710c
@ -167,6 +167,7 @@ void MIDIHost_Task(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Pipe_SelectPipe(MIDI_DATA_IN_PIPE);
|
Pipe_SelectPipe(MIDI_DATA_IN_PIPE);
|
||||||
|
Pipe_Unfreeze();
|
||||||
|
|
||||||
if (Pipe_IsINReceived())
|
if (Pipe_IsINReceived())
|
||||||
{
|
{
|
||||||
@ -188,7 +189,10 @@ void MIDIHost_Task(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pipe_Freeze();
|
||||||
|
|
||||||
Pipe_SelectPipe(MIDI_DATA_OUT_PIPE);
|
Pipe_SelectPipe(MIDI_DATA_OUT_PIPE);
|
||||||
|
Pipe_Unfreeze();
|
||||||
|
|
||||||
if (Pipe_IsOUTReady())
|
if (Pipe_IsOUTReady())
|
||||||
{
|
{
|
||||||
@ -251,6 +255,8 @@ void MIDIHost_Task(void)
|
|||||||
Pipe_ClearOUT();
|
Pipe_ClearOUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pipe_Freeze();
|
||||||
|
|
||||||
/* Save previous joystick value for next joystick change detection */
|
/* Save previous joystick value for next joystick change detection */
|
||||||
PrevJoystickStatus = JoystickStatus;
|
PrevJoystickStatus = JoystickStatus;
|
||||||
}
|
}
|
||||||
|
@ -156,15 +156,21 @@ uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo)
|
|||||||
uint8_t ErrorCode;
|
uint8_t ErrorCode;
|
||||||
|
|
||||||
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address);
|
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address);
|
||||||
|
Pipe_Unfreeze();
|
||||||
|
|
||||||
if (Pipe_BytesInPipe())
|
if (Pipe_BytesInPipe())
|
||||||
{
|
{
|
||||||
Pipe_ClearOUT();
|
Pipe_ClearOUT();
|
||||||
|
|
||||||
if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError)
|
if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError)
|
||||||
return ErrorCode;
|
{
|
||||||
|
Pipe_Freeze();
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pipe_Freeze();
|
||||||
|
|
||||||
return PIPE_READYWAIT_NoError;
|
return PIPE_READYWAIT_NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,13 +183,19 @@ uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
|
|||||||
uint8_t ErrorCode;
|
uint8_t ErrorCode;
|
||||||
|
|
||||||
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address);
|
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address);
|
||||||
|
Pipe_Unfreeze();
|
||||||
|
|
||||||
if ((ErrorCode = Pipe_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != PIPE_RWSTREAM_NoError)
|
if ((ErrorCode = Pipe_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != PIPE_RWSTREAM_NoError)
|
||||||
return ErrorCode;
|
{
|
||||||
|
Pipe_Freeze();
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(Pipe_IsReadWriteAllowed()))
|
if (!(Pipe_IsReadWriteAllowed()))
|
||||||
Pipe_ClearOUT();
|
Pipe_ClearOUT();
|
||||||
|
|
||||||
|
Pipe_Freeze();
|
||||||
|
|
||||||
return PIPE_RWSTREAM_NoError;
|
return PIPE_RWSTREAM_NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user