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