mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-17 13:12:08 +00:00
Ensure that the CDC class drivers return 0 if the number of unread bytes is queried and the bank has become empty.
This commit is contained in:
parent
c3db72afdc
commit
cde2afc50e
@ -68,7 +68,7 @@ BOARD =
|
|||||||
# does not *change* the processor frequency - it should merely be updated to
|
# does not *change* the processor frequency - it should merely be updated to
|
||||||
# reflect the processor speed set externally so that the code can use accurate
|
# reflect the processor speed set externally so that the code can use accurate
|
||||||
# software delays.
|
# software delays.
|
||||||
F_CPU = 8000000
|
F_CPU = 16000000
|
||||||
|
|
||||||
|
|
||||||
# Input clock frequency.
|
# Input clock frequency.
|
||||||
|
@ -195,9 +195,14 @@ uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterface
|
|||||||
if (Endpoint_IsOUTReceived())
|
if (Endpoint_IsOUTReceived())
|
||||||
{
|
{
|
||||||
if (!(Endpoint_BytesInEndpoint()))
|
if (!(Endpoint_BytesInEndpoint()))
|
||||||
Endpoint_ClearOUT();
|
{
|
||||||
|
Endpoint_ClearOUT();
|
||||||
return Endpoint_BytesInEndpoint();
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Endpoint_BytesInEndpoint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -315,12 +315,16 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
|
|||||||
if (Pipe_IsINReceived())
|
if (Pipe_IsINReceived())
|
||||||
{
|
{
|
||||||
if (!(Pipe_BytesInPipe()))
|
if (!(Pipe_BytesInPipe()))
|
||||||
Pipe_ClearIN();
|
{
|
||||||
|
Pipe_ClearIN();
|
||||||
BytesInPipe = Pipe_BytesInPipe();
|
Pipe_Freeze();
|
||||||
Pipe_Freeze();
|
return 0;
|
||||||
|
}
|
||||||
return BytesInPipe;
|
else
|
||||||
|
{
|
||||||
|
Pipe_Freeze();
|
||||||
|
return Pipe_BytesInPipe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user