aux_serial: Moved the transmit buffer swap function declaration into aux_serial.h and implemented a function to get the current buffer
This commit is contained in:
parent
25ac055602
commit
af93aba0da
|
@ -93,4 +93,9 @@ void aux_serial_switch_transmit_buffers(void)
|
||||||
buf_tx_act_sz = 0;
|
buf_tx_act_sz = 0;
|
||||||
buf_tx_act_idx ^= 1;
|
buf_tx_act_idx ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *aux_serial_current_transmit_buffer(void)
|
||||||
|
{
|
||||||
|
return buf_tx + (buf_tx_act_idx * TX_BUF_SIZE);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,4 +26,9 @@
|
||||||
void aux_serial_init(void);
|
void aux_serial_init(void);
|
||||||
void aux_serial_set_encoding(struct usb_cdc_line_coding *coding);
|
void aux_serial_set_encoding(struct usb_cdc_line_coding *coding);
|
||||||
|
|
||||||
|
#if defined(STM32F0) || defined(STM32F1) || defined(STM32F3) || defined(STM32F4)
|
||||||
|
void aux_serial_switch_transmit_buffers(void);
|
||||||
|
char *aux_serial_current_transmit_buffer(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /*AUX_SERIAL_H*/
|
#endif /*AUX_SERIAL_H*/
|
||||||
|
|
|
@ -317,7 +317,7 @@ static void debug_uart_receive_callback(usbd_device *dev, uint8_t ep)
|
||||||
usbd_ep_nak_set(dev, CDCACM_UART_ENDPOINT, 1);
|
usbd_ep_nak_set(dev, CDCACM_UART_ENDPOINT, 1);
|
||||||
|
|
||||||
/* Read new packet directly into TX buffer */
|
/* Read new packet directly into TX buffer */
|
||||||
char *const tx_buf_ptr = &buf_tx[buf_tx_act_idx * TX_BUF_SIZE];
|
char *const tx_buf_ptr = aux_serial_current_transmit_buffer();
|
||||||
const uint16_t len = usbd_ep_read_packet(dev, CDCACM_UART_ENDPOINT, tx_buf_ptr + buf_tx_act_sz, CDCACM_PACKET_SIZE);
|
const uint16_t len = usbd_ep_read_packet(dev, CDCACM_UART_ENDPOINT, tx_buf_ptr + buf_tx_act_sz, CDCACM_PACKET_SIZE);
|
||||||
|
|
||||||
#if defined(BLACKMAGIC)
|
#if defined(BLACKMAGIC)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
||||||
void usbuart_set_led_state(uint8_t ledn, bool state);
|
void usbuart_set_led_state(uint8_t ledn, bool state);
|
||||||
void aux_serial_switch_transmit_buffers(void);
|
|
||||||
void debug_uart_run(void);
|
void debug_uart_run(void);
|
||||||
|
|
||||||
#define TX_LED_ACT (1 << 0)
|
#define TX_LED_ACT (1 << 0)
|
||||||
|
|
Loading…
Reference in New Issue