Skip to content

Commit

Permalink
Backup inuntended change impacting F7
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveCEvans committed Jul 26, 2022
1 parent aa833b2 commit 62e0de0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/vcp_hal/usbd_cdc_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,17 @@ uint32_t CDC_Receive_BytesAvailable(void)

uint32_t CDC_Send_FreeBytes(void)
{
// return the bytes free in the circular buffer
/*
return the bytes free in the circular buffer
functionally equivalent to:
(APP_Rx_ptr_out > APP_Rx_ptr_in ? APP_Rx_ptr_out - APP_Rx_ptr_in : APP_RX_DATA_SIZE - APP_Rx_ptr_in + APP_Rx_ptr_in)
but without the impact of the condition check.
*/
uint32_t freeBytes;

ATOMIC_BLOCK(NVIC_BUILD_PRIORITY(6, 0)) {
freeBytes = APP_RX_DATA_SIZE - rxAvailable;
freeBytes = ((UserTxBufPtrOut - UserTxBufPtrIn) + (-((int)(UserTxBufPtrOut <= UserTxBufPtrIn)) & APP_TX_DATA_SIZE)) - 1;
}

return freeBytes;
Expand Down

0 comments on commit 62e0de0

Please sign in to comment.