Wirepas SDK
usart.h
Go to the documentation of this file.
1/* Copyright 2017-2024 Wirepas Ltd. All Rights Reserved.
2 *
3 * See file LICENSE.txt for full license details.
4 *
5 */
6
7#ifndef USART_H_
8#define USART_H_
9
10#include <stdbool.h>
11#include <stdint.h>
12#include <stddef.h>
13
15typedef void (*serial_rx_callback_f)(uint8_t * ch, size_t n);
16
22
38bool Usart_init(uint32_t baudrate, uart_flow_control_e flow_control);
39
49void Usart_setEnabled(bool enabled);
50
57
62
71
81uint32_t Usart_sendBuffer(const void * buf, uint32_t len);
82
99
104uint32_t Usart_getMTUSize(void);
105
109void Usart_flush(void);
110
111#endif /* USART_H_ */
uint32_t Usart_sendBuffer(const void *buf, uint32_t len)
Send a buffer to USART.
void Usart_init(uint32_t baudrate)
Initialize all USART blocks Enables peripheral clocks and disables peripherals for the duration of th...
uint32_t Usart_getMTUSize(void)
Returns the maximum transmission unit in bytes for the USART (= maximum length of a single message)
void Usart_setEnabled(bool enabled)
Enable or disable USART Enables or disables USART clock and configures GPIO pins.
void Usart_receiverOff(void)
Disable USART Receiver.
void Usart_receiverOn(void)
Enable USART Receiver.
bool Usart_setFlowControl(uart_flow_control_e flow)
Set USART flow control mode.
void Usart_flush(void)
Soft flush (dump data to I/O) UART TX buffer.
void(* serial_rx_callback_f)(uint8_t *ch, size_t n)
Definition usart.h:15
uart_flow_control_e
Definition usart.h:18
@ UART_FLOW_CONTROL_HW
Definition usart.h:20
@ UART_FLOW_CONTROL_NONE
Definition usart.h:19
void Usart_enableReceiver(serial_rx_callback_f callback)
Enable UART receiver Set callback handler for character RX event Enables interrupt source and event,...