usb_serial: Cleaned up a bit more in debug_uart_send_aux_serial_data()

This commit is contained in:
dragonmux 2022-08-21 15:30:46 +01:00 committed by Piotr Esden-Tempski
parent d0915a1312
commit 39f1604ef0
3 changed files with 8 additions and 8 deletions

View File

@ -304,9 +304,9 @@ void aux_serial_update_receive_buffer_fullness(void)
aux_serial_receive_write_index %= AUX_UART_BUFFER_SIZE;
}
bool aux_serial_receive_has_data(void)
bool aux_serial_receive_buffer_empty(void)
{
return aux_serial_receive_write_index != aux_serial_receive_read_index;
return aux_serial_receive_write_index == aux_serial_receive_read_index;
}
void aux_serial_drain_receive_buffer(void)

View File

@ -42,7 +42,7 @@ void aux_serial_send(size_t len);
#if defined(STM32F0) || defined(STM32F1) || defined(STM32F3) || defined(STM32F4)
void aux_serial_update_receive_buffer_fullness(void);
bool aux_serial_receive_has_data(void);
bool aux_serial_receive_buffer_empty(void);
void aux_serial_drain_receive_buffer(void);
#ifdef ENABLE_DEBUG
void aux_serial_stage_debug_buffer(void);

View File

@ -223,9 +223,9 @@ uint32_t debug_serial_fifo_send(const char *const fifo, const uint32_t fifo_begi
}
#ifdef ENABLE_DEBUG
static bool debug_serial_fifo_has_data(void)
static bool debug_serial_fifo_buffer_empty(void)
{
return usb_dbg_in != usb_dbg_out;
return usb_dbg_in == usb_dbg_out;
}
#endif
@ -240,11 +240,11 @@ static void debug_uart_send_aux_serial_data(void)
/* Forcibly empty fifo if no USB endpoint.
* If fifo empty, nothing further to do. */
if (usb_get_config() != 1 || (!aux_serial_receive_has_data()
if (usb_get_config() != 1 || (aux_serial_receive_buffer_empty()
#ifdef ENABLE_DEBUG
&& !debug_serial_fifo_has_data())
&& debug_serial_fifo_buffer_empty()
#endif
) {
)) {
#ifdef ENABLE_DEBUG
usb_dbg_out = usb_dbg_in;
#endif