Go to the source code of this file.
◆ serial_rx_callback_f
typedef void(* serial_rx_callback_f) (uint8_t *ch, size_t n) |
User callback for character received event
Definition at line 15 of file usart.h.
◆ Usart_enableReceiver()
Enable UART receiver Set callback handler for character RX event Enables interrupt source and event, and the input pin.
- Precondition
- Usart_init called.
- Note
- This function should be called after Usart_init and before calling Usart_setEnabled.
- Parameters
-
callback | Callback function for a character rx event Can be NULL, which clears the callback and disables IRQ
|
- Returns
- none
◆ Usart_flush()
void Usart_flush |
( |
void |
| ) |
|
Soft flush (dump data to I/O) UART TX buffer.
◆ Usart_getMTUSize()
uint32_t Usart_getMTUSize |
( |
void |
| ) |
|
Returns the maximum transmission unit in bytes for the USART (= maximum length of a single message)
◆ Usart_init()
Initialize all USART blocks Enables peripheral clocks and disables peripherals for the duration of the initialization procedure. Clears all internal variables: Callback handlers Transfer busy flags After the initialization procedure is complete, it enables all peripherals, but leaves peripheral clocks disabled.
- Parameters
-
baudrate | Baudrate to be used |
flow_control | Flow control to be used |
- Returns
- True if successful, false otherwise
◆ Usart_receiverOff()
void Usart_receiverOff |
( |
void |
| ) |
|
◆ Usart_receiverOn()
void Usart_receiverOn |
( |
void |
| ) |
|
Enable USART Receiver.
- Precondition
- Usart_setEnabled is called.
◆ Usart_sendBuffer()
uint32_t Usart_sendBuffer |
( |
const void * |
buf, |
|
|
uint32_t |
len |
|
) |
| |
Send a buffer to USART.
- Parameters
-
- Note
- This method will either send the whole buffer or nothing at all
- Returns
- Number of bytes written (zero or len)
◆ Usart_setEnabled()
void Usart_setEnabled |
( |
bool |
enabled | ) |
|
Enable or disable USART Enables or disables USART clock and configures GPIO pins.
- Precondition
- Usart_enableReceiver is called.
- Parameters
-
enabled | True, if USART should be enabled |
◆ Usart_setFlowControl()
Set USART flow control mode.
- Precondition
- USART is not enabled
- Parameters
-
flow | Desired flow control mode |
- Returns
- True, if the baud rate was updated successfully
◆ uart_flow_control_e
Enumerator |
---|
UART_FLOW_CONTROL_NONE | |
UART_FLOW_CONTROL_HW | |
Definition at line 17 of file usart.h.