Uart Peripheral
- Author
- shensley
- Date
- March 2020
#include <uart.h>
|
| UartHandler () |
|
| UartHandler (const UartHandler &other)=default |
|
UartHandler & | operator= (const UartHandler &other)=default |
|
Result | Init (const Config &config) |
|
const Config & | GetConfig () const |
|
Result | BlockingTransmit (uint8_t *buff, size_t size, uint32_t timeout=100) |
|
Result | BlockingReceive (uint8_t *buffer, uint16_t size, uint32_t timeout=100) |
|
Result | DmaTransmit (uint8_t *buff, size_t size, UartHandler::StartCallbackFunctionPtr start_callback, UartHandler::EndCallbackFunctionPtr end_callback, void *callback_context) |
|
Result | DmaReceive (uint8_t *buff, size_t size, UartHandler::StartCallbackFunctionPtr start_callback, UartHandler::EndCallbackFunctionPtr end_callback, void *callback_context) |
|
int | CheckError () |
|
Result | DmaReceiveFifo () |
|
Result | FlushFifo () |
|
uint8_t | PopFifo () |
|
size_t | ReadableFifo () |
|
int | PollReceive (uint8_t *buff, size_t size, uint32_t timeout) |
|
Result | PollTx (uint8_t *buff, size_t size) |
|
Result | StartRx () |
|
bool | RxActive () |
|
Result | FlushRx () |
|
uint8_t | PopRx () |
|
size_t | Readable () |
|
◆ EndCallbackFunctionPtr
typedef void(* daisy::UartHandler::EndCallbackFunctionPtr) (void *context, Result result) |
A callback to be executed after a dma transfer is completed.
◆ StartCallbackFunctionPtr
typedef void(* daisy::UartHandler::StartCallbackFunctionPtr) (void *context) |
A callback to be executed right before a dma transfer is started.
◆ DmaDirection
◆ Result
Return values for Uart functions.
◆ UartHandler() [1/2]
daisy::UartHandler::UartHandler |
( |
| ) |
|
|
inline |
◆ UartHandler() [2/2]
daisy::UartHandler::UartHandler |
( |
const UartHandler & |
other | ) |
|
|
default |
◆ BlockingReceive()
Result daisy::UartHandler::BlockingReceive |
( |
uint8_t * |
buffer, |
|
|
uint16_t |
size, |
|
|
uint32_t |
timeout = 100 |
|
) |
| |
Polling Receive
- Parameters
-
buffer | input buffer |
size | buffer size |
timeout | How long to timeout for in milliseconds |
- Returns
- Whether the receive was successful or not
◆ BlockingTransmit()
Result daisy::UartHandler::BlockingTransmit |
( |
uint8_t * |
buff, |
|
|
size_t |
size, |
|
|
uint32_t |
timeout = 100 |
|
) |
| |
Blocking transmit
- Parameters
-
buff | input buffer |
size | buffer size |
timeout | how long in milliseconds the function will wait before returning without successful communication |
◆ CheckError()
int daisy::UartHandler::CheckError |
( |
| ) |
|
- Returns
- the result of HAL_UART_GetError() to the user.
◆ DmaReceive()
DMA-based receive
- Parameters
-
*buff | input buffer |
size | buffer size |
start_callback | A callback to execute when the transfer starts, or NULL. The callback is called from an interrupt, so keep it fast. |
end_callback | A callback to execute when the transfer finishes, or NULL. The callback is called from an interrupt, so keep it fast. |
callback_context | A pointer that will be passed back to you in the callbacks.
|
- Returns
- Whether the receive was successful or not
◆ DmaReceiveFifo()
Result daisy::UartHandler::DmaReceiveFifo |
( |
| ) |
|
Start the DMA Receive with a double buffered FIFO
- Returns
- OK or ERR
◆ DmaTransmit()
DMA-based transmit
- Parameters
-
*buff | input buffer |
size | buffer size |
start_callback | A callback to execute when the transfer starts, or NULL. The callback is called from an interrupt, so keep it fast. |
end_callback | A callback to execute when the transfer finishes, or NULL. The callback is called from an interrupt, so keep it fast. |
callback_context | A pointer that will be passed back to you in the callbacks.
|
- Returns
- Whether the transmit was successful or not
◆ FlushFifo()
Result daisy::UartHandler::FlushFifo |
( |
| ) |
|
Flush all of the data from the fifo
- Returns
- OK or ERR
◆ FlushRx()
Result daisy::UartHandler::FlushRx |
( |
| ) |
|
Will be deprecated soon! Wrapper for FlushFifo
◆ GetConfig()
const Config & daisy::UartHandler::GetConfig |
( |
| ) |
const |
Returns the current config.
◆ Init()
Initializes the UART Peripheral
◆ operator=()
◆ PollReceive()
int daisy::UartHandler::PollReceive |
( |
uint8_t * |
buff, |
|
|
size_t |
size, |
|
|
uint32_t |
timeout |
|
) |
| |
Will be deprecated soon! Wrapper for BlockingTransmit
◆ PollTx()
Result daisy::UartHandler::PollTx |
( |
uint8_t * |
buff, |
|
|
size_t |
size |
|
) |
| |
Will be deprecated soon! Wrapper for BlockingTransmit
◆ PopFifo()
uint8_t daisy::UartHandler::PopFifo |
( |
| ) |
|
Get the top item off of the FIFO
- Returns
- Top item from the FIFO
◆ PopRx()
uint8_t daisy::UartHandler::PopRx |
( |
| ) |
|
Will be deprecated soon! Wrapper PopFifo
◆ Readable()
size_t daisy::UartHandler::Readable |
( |
| ) |
|
Will be deprecated soon! Wrapper for ReadableFifo
◆ ReadableFifo()
size_t daisy::UartHandler::ReadableFifo |
( |
| ) |
|
How much data is in the FIFO
- Returns
- number of elements ready to pop from FIFO
◆ RxActive()
bool daisy::UartHandler::RxActive |
( |
| ) |
|
|
inline |
Will be deprecated soon!
- Returns
- true. New DMA will always restart itself.
◆ StartRx()
Result daisy::UartHandler::StartRx |
( |
| ) |
|
Will be deprecated soon! Wrapper for DmaReceiveFifo
The documentation for this class was generated from the following file: