Open FFBoard
Open source force feedback firmware
UARTPort Class Reference

#include <UART.h>

Inheritance diagram for UARTPort:
UartHandler

Public Member Functions

 UARTPort (UART_HandleTypeDef &huart)
 
virtual ~UARTPort ()
 
void uartRxComplete (UART_HandleTypeDef *huart)
 
void uartTxComplete (UART_HandleTypeDef *huart)
 
bool transmit (const char *txbuf, uint16_t size, uint32_t timeout=10000)
 
bool transmit_IT (const char *txbuf, uint16_t size)
 
bool receive (char *rxbuf, uint16_t size, uint32_t timeout=10000)
 
bool transmit_DMA (const char *txbuf, uint16_t size)
 
bool receive_DMA (char *rxbuf, uint16_t size)
 
bool receive_IT (char *rxbuf, uint16_t size)
 
bool abortReceive ()
 
bool abortTransmit ()
 
bool takeSemaphore (bool txsem=true, uint32_t blocktime=portMAX_DELAY)
 
bool giveSemaphore (bool txsem=true)
 
bool isTaken ()
 
bool reconfigurePort (UART_InitTypeDef &config)
 
UART_InitTypeDef & getConfig ()
 
bool isReserved ()
 
bool reservePort (UARTDevice *device)
 
bool freePort (UARTDevice *device)
 
uint32_t getErrors ()
 
bool registerInterrupt ()
 
UART_HandleTypeDef * getHuart ()
 
- Public Member Functions inherited from UartHandler
 UartHandler ()
 
virtual ~UartHandler ()
 

Private Attributes

cpp_freertos::BinarySemaphore semaphore = cpp_freertos::BinarySemaphore(true)
 
cpp_freertos::BinarySemaphore rxsemaphore = cpp_freertos::BinarySemaphore(true)
 
bool isTakenFlag = false
 
UART_HandleTypeDef & huart
 
UARTDevicedevice = nullptr
 
volatile char uart_buf [UART_BUF_SIZE] = {0}
 
bool waitingForSingleBytes = false
 
uint16_t lastPos = 0
 
char * rxbuf_t = nullptr
 

Additional Inherited Members

- Static Public Member Functions inherited from UartHandler
static std::vector< UartHandler * > & getUARTHandlers ()
 

Detailed Description

Definition at line 26 of file UART.h.

Constructor & Destructor Documentation

◆ UARTPort()

UARTPort::UARTPort ( UART_HandleTypeDef &  huart)

Definition at line 27 of file UART.cpp.

◆ ~UARTPort()

UARTPort::~UARTPort ( )
virtual

Definition at line 31 of file UART.cpp.

Member Function Documentation

◆ abortReceive()

bool UARTPort::abortReceive ( )

Definition at line 116 of file UART.cpp.

◆ abortTransmit()

bool UARTPort::abortTransmit ( )

Definition at line 129 of file UART.cpp.

◆ freePort()

bool UARTPort::freePort ( UARTDevice device)

Definition at line 137 of file UART.cpp.

◆ getConfig()

UART_InitTypeDef & UARTPort::getConfig ( )

Definition at line 49 of file UART.cpp.

◆ getErrors()

uint32_t UARTPort::getErrors ( )

Definition at line 177 of file UART.cpp.

◆ getHuart()

UART_HandleTypeDef * UARTPort::getHuart ( )

Definition at line 125 of file UART.cpp.

◆ giveSemaphore()

bool UARTPort::giveSemaphore ( bool  txsem = true)

Definition at line 159 of file UART.cpp.

◆ isReserved()

bool UARTPort::isReserved ( )
inline

Definition at line 51 of file UART.h.

◆ isTaken()

bool UARTPort::isTaken ( )

Definition at line 173 of file UART.cpp.

◆ receive()

bool UARTPort::receive ( char *  rxbuf,
uint16_t  size,
uint32_t  timeout = 10000 
)

Definition at line 85 of file UART.cpp.

◆ receive_DMA()

bool UARTPort::receive_DMA ( char *  rxbuf,
uint16_t  size 
)

Definition at line 94 of file UART.cpp.

◆ receive_IT()

bool UARTPort::receive_IT ( char *  rxbuf,
uint16_t  size 
)

Definition at line 101 of file UART.cpp.

◆ reconfigurePort()

bool UARTPort::reconfigurePort ( UART_InitTypeDef &  config)

Definition at line 35 of file UART.cpp.

◆ registerInterrupt()

bool UARTPort::registerInterrupt ( )

Begins to wait on a single UART_BUF_SIZE sized transfer

Definition at line 56 of file UART.cpp.

◆ reservePort()

bool UARTPort::reservePort ( UARTDevice device)

Definition at line 108 of file UART.cpp.

◆ takeSemaphore()

bool UARTPort::takeSemaphore ( bool  txsem = true,
uint32_t  blocktime = portMAX_DELAY 
)

Definition at line 145 of file UART.cpp.

◆ transmit()

bool UARTPort::transmit ( const char *  txbuf,
uint16_t  size,
uint32_t  timeout = 10000 
)

Definition at line 69 of file UART.cpp.

◆ transmit_DMA()

bool UARTPort::transmit_DMA ( const char *  txbuf,
uint16_t  size 
)

Definition at line 62 of file UART.cpp.

◆ transmit_IT()

bool UARTPort::transmit_IT ( const char *  txbuf,
uint16_t  size 
)

Definition at line 78 of file UART.cpp.

◆ uartRxComplete()

void UARTPort::uartRxComplete ( UART_HandleTypeDef *  huart)
virtual

Reimplemented from UartHandler.

Definition at line 182 of file UART.cpp.

◆ uartTxComplete()

void UARTPort::uartTxComplete ( UART_HandleTypeDef *  huart)
virtual

Reimplemented from UartHandler.

Definition at line 200 of file UART.cpp.

Member Data Documentation

◆ device

UARTDevice* UARTPort::device = nullptr
private

Definition at line 66 of file UART.h.

◆ huart

UART_HandleTypeDef& UARTPort::huart
private

Definition at line 65 of file UART.h.

◆ isTakenFlag

bool UARTPort::isTakenFlag = false
private

Definition at line 64 of file UART.h.

◆ lastPos

uint16_t UARTPort::lastPos = 0
private

Definition at line 69 of file UART.h.

◆ rxbuf_t

char* UARTPort::rxbuf_t = nullptr
private

Definition at line 70 of file UART.h.

◆ rxsemaphore

cpp_freertos::BinarySemaphore UARTPort::rxsemaphore = cpp_freertos::BinarySemaphore(true)
private

Definition at line 63 of file UART.h.

◆ semaphore

cpp_freertos::BinarySemaphore UARTPort::semaphore = cpp_freertos::BinarySemaphore(true)
private

Definition at line 62 of file UART.h.

◆ uart_buf

volatile char UARTPort::uart_buf[UART_BUF_SIZE] = {0}
private

Definition at line 67 of file UART.h.

◆ waitingForSingleBytes

bool UARTPort::waitingForSingleBytes = false
private

Definition at line 68 of file UART.h.


The documentation for this class was generated from the following files: