Updated ep_buffer to match 3610's xua_buffer_lite

This commit is contained in:
Angel Cascarino
2022-01-12 14:47:40 +00:00
parent 64cbd072f4
commit 6b0688d23e

View File

@@ -373,15 +373,13 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
#endif
#if( 0 < HID_CONTROLS )
UserHIDInit();
while (!hidIsReportDescriptorPrepared())
;
/* Get the a report - we don't really care which it is, so long as there's some data we can grab. */
int hidReportLength = (int) UserHIDGetData(hidGetNextValidReportId(0), g_hidData);
XUD_SetReady_In(ep_hid, g_hidData, hidReportLength);
UserHIDInit();
unsigned hid_ready_flag = 0U;
unsigned hid_ready_id = 0U;
#endif
@@ -896,22 +894,13 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
#if( 0 < HID_CONTROLS )
/* HID Report Data */
case (hidIsChangePending(0U) || !HidIsSetIdleSilenced(0U)) => XUD_SetData_Select(c_hid, ep_hid, result):
{
case XUD_SetData_Select(c_hid, ep_hid, result):
hid_ready_flag = 0U;
unsigned reportTime;
tmr :> reportTime;
for(unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); ++id) {
if(0U == id || (hidIsChangePending(id) || !HidIsSetIdleSilenced(id))) {
hidCaptureReportTime(id, reportTime);
int hidDataLength = (int) UserHIDGetData(id, g_hidData);
XUD_SetReady_In(ep_hid, g_hidData, hidDataLength);
hidCalcNextReportTime(id);
hidClearChangePending(id);
break;
}
}
}
hidCaptureReportTime(hid_ready_id, reportTime);
hidCalcNextReportTime(hid_ready_id);
hidClearChangePending(hid_ready_id);
break;
#endif
@@ -1115,6 +1104,26 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
break;
}
break;
default:
#if ( 0 < HID_CONTROLS )
if (!hid_ready_flag)
{
for (unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); id++)
{
if ( hidIsChangePending(id) || !HidIsSetIdleSilenced(id) )
{
int hidDataLength = (int) UserHIDGetData(id, g_hidData);
XUD_SetReady_In(ep_hid, g_hidData, hidDataLength);
hid_ready_id = id;
hid_ready_flag = 1U;
break;
}
}
}
#endif
break;
//::
#endif