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

Macros

#define UART_RX_DMA   DMA1_Stream5
 
#define UART_RX_DMA_CHANNEL   DMA_Channel_4
 
#define UART_TX_DMA   DMA1_Stream6
 
#define UART_TX_DMA_CHANNEL   DMA_Channel_4
 
#define UART_TX_BUFFER_SIZE   4096
 
#define UART_RX_BUFFER_SIZE   512
 
#define UART_USER_RX_QUEUE_SIZE   512
 
#define UART_DMA_TX_IS_BUSY   (DMA_GetCmdStatus(UART_TX_DMA) == ENABLE && DMA_GetCurrDataCounter(UART_TX_DMA) > 0)
 

Functions

void uart_Init (void)
 Initializes the UART module. More...
 
void uart_Step (void)
 Copies the received bytes into the user-accessible queue. Reads all the available bytes in the DMA RX buffer, and copies them to the user-accessible queue. More...
 
cb_CircularBufferuart_GetRxQueue (void)
 Gets the user-accessible queue of the received bytes. More...
 
void uart_StartDma (void)
 Starts the DMA transfer to send bytes to UART peripheral. More...
 
void uart_SendByteAsync (uint8_t data)
 Asynchronously sends the given byte through the UART bus. More...
 
void uart_SendBytesAsync (uint8_t *data, int length)
 Asynchronously sends the given bytes through the UART bus. More...
 
void uart_FlushTx (void)
 Start the DMA to send the bytes waiting in the intermediate buffer. More...
 

Variables

uint8_t uart_txBuffer [2][UART_TX_BUFFER_SIZE]
 
uint8_t uart_currentTxBufferToWriteTo
 
uint16_t uart_txBufferIndex
 
uint16_t uart_nBytesToTransferDma
 
uint8_t uart_rxBuffer [UART_RX_BUFFER_SIZE]
 
uint8_t const * uart_rxBuffTail
 
uint8_t uart_userRxQueue [UART_USER_RX_QUEUE_SIZE]
 
cb_CircularBuffer uart_rxQueue
 

Macro Definition Documentation

◆ UART_DMA_TX_IS_BUSY

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

◆ UART_RX_BUFFER_SIZE

#define UART_RX_BUFFER_SIZE   512

◆ UART_RX_DMA

#define UART_RX_DMA   DMA1_Stream5

◆ UART_RX_DMA_CHANNEL

#define UART_RX_DMA_CHANNEL   DMA_Channel_4

◆ UART_TX_BUFFER_SIZE

#define UART_TX_BUFFER_SIZE   4096

◆ UART_TX_DMA

#define UART_TX_DMA   DMA1_Stream6

◆ UART_TX_DMA_CHANNEL

#define UART_TX_DMA_CHANNEL   DMA_Channel_4

◆ UART_USER_RX_QUEUE_SIZE

#define UART_USER_RX_QUEUE_SIZE   512

Function Documentation

◆ uart_StartDma()

void uart_StartDma ( void  )

Starts the DMA transfer to send bytes to UART peripheral.

Variable Documentation

◆ uart_currentTxBufferToWriteTo

uint8_t uart_currentTxBufferToWriteTo

◆ uart_nBytesToTransferDma

uint16_t uart_nBytesToTransferDma

◆ uart_rxBuffer

uint8_t uart_rxBuffer[UART_RX_BUFFER_SIZE]

◆ uart_rxBuffTail

uint8_t const* uart_rxBuffTail

◆ uart_rxQueue

cb_CircularBuffer uart_rxQueue

◆ uart_txBuffer

uint8_t uart_txBuffer[2][UART_TX_BUFFER_SIZE]

◆ uart_txBufferIndex

uint16_t uart_txBufferIndex

◆ uart_userRxQueue

uint8_t uart_userRxQueue[UART_USER_RX_QUEUE_SIZE]