HRI board firmware  v2.1
Microcontroller firmware of the board used during the HRI labs.
Macros | Functions | Variables
ext_uart.c File Reference
#include "ext_uart.h"
#include "../lib/utils.h"

Macros

#define EXUART_RX_Pin   GPIO_Pin_7
 
#define EXUART_RX_PinSource   GPIO_PinSource7
 
#define EXUART_RX_Port   GPIOB
 
#define EXUART_TX_Pin   GPIO_Pin_6
 
#define EXUART_TX_PinSource   GPIO_PinSource6
 
#define EXUART_TX_Port   GPIOB
 
#define EXUART_PERIPH   USART1
 
#define RX_DMA   DMA2_Stream2
 
#define RX_DMA_CHANNEL   DMA_Channel_4
 
#define TX_DMA   DMA2_Stream7
 
#define TX_DMA_CHANNEL   DMA_Channel_4
 
#define TX_BUFFER_SIZE   512
 
#define RX_BUFFER_SIZE   1024
 
#define USER_RX_QUEUE_SIZE   2048
 
#define UART_DMA_TX_IS_BUSY   (DMA_GetCmdStatus(TX_DMA) == ENABLE && DMA_GetCurrDataCounter(TX_DMA) > 0)
 

Functions

void exuart_FlushTx (void)
 Start the DMA to send the bytes waiting in the intermediate buffer. More...
 
void exuart_Init (uint32_t baudRate)
 Initializes the UART module. More...
 
uint16_t exuart_ReceivedBytesCount (void)
 Gets the number of bytes received and ready to read. More...
 
uint8_t exuart_GetByte (void)
 Gets the next received byte. More...
 
void exuart_StartDma (void)
 Starts the DMA transfer to send bytes to UART peripheral. More...
 
void exuart_SendByteAsync (uint8_t data)
 Asynchronously sends the given byte through the UART bus. More...
 
void exuart_SendBytesAsync (uint8_t *data, int length)
 Asynchronously sends the given bytes through the UART bus. More...
 

Variables

uint8_t exuart_txBuffer [2][TX_BUFFER_SIZE]
 
uint8_t exuart_currentTxBufferToWriteTo
 
uint16_t exuart_txBufferIndex
 
uint16_t exuart_nBytesToTransferDma
 
uint8_t exuart_rxBuffer [RX_BUFFER_SIZE]
 
uint8_t const * exuart_rxBuffTail
 
uint8_t exuart_userRxQueue [USER_RX_QUEUE_SIZE]
 
cb_CircularBuffer exuart_rxQueue
 

Macro Definition Documentation

◆ EXUART_PERIPH

#define EXUART_PERIPH   USART1

◆ EXUART_RX_Pin

#define EXUART_RX_Pin   GPIO_Pin_7

◆ EXUART_RX_PinSource

#define EXUART_RX_PinSource   GPIO_PinSource7

◆ EXUART_RX_Port

#define EXUART_RX_Port   GPIOB

◆ EXUART_TX_Pin

#define EXUART_TX_Pin   GPIO_Pin_6

◆ EXUART_TX_PinSource

#define EXUART_TX_PinSource   GPIO_PinSource6

◆ EXUART_TX_Port

#define EXUART_TX_Port   GPIOB

◆ RX_BUFFER_SIZE

#define RX_BUFFER_SIZE   1024

◆ RX_DMA

#define RX_DMA   DMA2_Stream2

◆ RX_DMA_CHANNEL

#define RX_DMA_CHANNEL   DMA_Channel_4

◆ TX_BUFFER_SIZE

#define TX_BUFFER_SIZE   512

◆ TX_DMA

#define TX_DMA   DMA2_Stream7

◆ TX_DMA_CHANNEL

#define TX_DMA_CHANNEL   DMA_Channel_4

◆ UART_DMA_TX_IS_BUSY

#define UART_DMA_TX_IS_BUSY   (DMA_GetCmdStatus(TX_DMA) == ENABLE && DMA_GetCurrDataCounter(TX_DMA) > 0)

◆ USER_RX_QUEUE_SIZE

#define USER_RX_QUEUE_SIZE   2048

Function Documentation

◆ exuart_FlushTx()

void exuart_FlushTx ( void  )

Start the DMA to send the bytes waiting in the intermediate buffer.

◆ exuart_StartDma()

void exuart_StartDma ( void  )

Starts the DMA transfer to send bytes to UART peripheral.

Variable Documentation

◆ exuart_currentTxBufferToWriteTo

uint8_t exuart_currentTxBufferToWriteTo

◆ exuart_nBytesToTransferDma

uint16_t exuart_nBytesToTransferDma

◆ exuart_rxBuffer

uint8_t exuart_rxBuffer[RX_BUFFER_SIZE]

◆ exuart_rxBuffTail

uint8_t const* exuart_rxBuffTail

◆ exuart_rxQueue

cb_CircularBuffer exuart_rxQueue

◆ exuart_txBuffer

uint8_t exuart_txBuffer[2][TX_BUFFER_SIZE]

◆ exuart_txBufferIndex

uint16_t exuart_txBufferIndex

◆ exuart_userRxQueue

uint8_t exuart_userRxQueue[USER_RX_QUEUE_SIZE]