aux_serial: Begun moving globals into their proper private TU scopes

This commit is contained in:
dragonmux 2022-08-19 10:39:34 +01:00 committed by Piotr Esden-Tempski
parent af93aba0da
commit bc256a9201
4 changed files with 16 additions and 9 deletions

View File

@ -34,6 +34,15 @@
#include "usb.h"
#include "aux_serial.h"
#if defined(STM32F0) || defined(STM32F1) || defined(STM32F3) || defined(STM32F4)
/* TX double buffer */
char buf_tx[TX_BUF_SIZE * 2];
/* Active buffer part idx */
uint8_t buf_tx_act_idx;
#elif defined(LM4F)
char buf_tx[FIFO_SIZE];
#endif
void aux_serial_set_encoding(struct usb_cdc_line_coding *coding)
{
usart_set_baudrate(USBUSART, coding->dwDTERate);
@ -98,4 +107,10 @@ char *aux_serial_current_transmit_buffer(void)
{
return buf_tx + (buf_tx_act_idx * TX_BUF_SIZE);
}
#elif defined(LM4F)
char *aux_serial_current_transmit_buffer(void)
{
return buf_tx;
}
#endif

View File

@ -25,10 +25,10 @@
void aux_serial_init(void);
void aux_serial_set_encoding(struct usb_cdc_line_coding *coding);
char *aux_serial_current_transmit_buffer(void);
#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*/

View File

@ -36,10 +36,6 @@ void debug_uart_run(void);
#define RX_FIFO_SIZE (USART_DMA_BUF_SIZE)
#define TX_BUF_SIZE (USART_DMA_BUF_SIZE)
/* TX double buffer */
extern char buf_tx[TX_BUF_SIZE * 2];
/* Active buffer part idx */
extern uint8_t buf_tx_act_idx;
/* Active buffer part used capacity */
extern uint8_t buf_tx_act_sz;
/* TX transfer complete */

View File

@ -49,10 +49,6 @@
#define DMA_CGIF DMA_IFCR_CGIF_BIT
#endif
/* TX double buffer */
char buf_tx[TX_BUF_SIZE * 2];
/* Active buffer part idx */
uint8_t buf_tx_act_idx;
/* Active buffer part used capacity */
uint8_t buf_tx_act_sz;
/* TX transfer complete */