usb_serial: Begun bringin more commonality to debug_uart_receive_callback

This commit is contained in:
dragonmux 2022-08-19 11:02:19 +01:00 committed by Piotr Esden-Tempski
parent a5c07c188f
commit b94476841f
1 changed files with 7 additions and 6 deletions

View File

@ -311,14 +311,17 @@ static void debug_uart_send_callback(usbd_device *dev, uint8_t ep)
#ifndef ENABLE_RTT
static void debug_uart_receive_callback(usbd_device *dev, uint8_t ep)
{
char *const transmit_buffer = aux_serial_current_transmit_buffer();
char *const transmit_buffer = aux_serial_current_transmit_buffer()
#if defined(STM32F0) || defined(STM32F1) || defined(STM32F3) || defined(STM32F4)
+ buf_tx_act_sz
#endif
;
const uint16_t len = usbd_ep_read_packet(dev, ep, transmit_buffer, CDCACM_PACKET_SIZE);
#if defined(STM32F0) || defined(STM32F1) || defined(STM32F3) || defined(STM32F4)
usbd_ep_nak_set(dev, ep, 1);
/* Read new packet directly into TX buffer */
const uint16_t len = usbd_ep_read_packet(dev, ep, transmit_buffer + buf_tx_act_sz, CDCACM_PACKET_SIZE);
#if defined(BLACKMAGIC)
/* Don't bother if uart is disabled.
* This will be the case on mini while we're being debugged.
@ -350,8 +353,6 @@ static void debug_uart_receive_callback(usbd_device *dev, uint8_t ep)
if (TX_BUF_SIZE - buf_tx_act_sz >= CDCACM_PACKET_SIZE)
usbd_ep_nak_set(dev, ep, 0);
#elif defined(LM4F)
const uint16_t len = usbd_ep_read_packet(dev, ep, transmit_buffer, CDCACM_PACKET_SIZE);
for(uint16_t i = 0; i < len; i++)
uart_send_blocking(USBUART, transmit_buffer[i]);
#endif