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 
15 typedef void (*serial_rx_callback_f)(uint8_t * ch, size_t n);
16 
17 typedef enum
18 {
22 
38 bool Usart_init(uint32_t baudrate, uart_flow_control_e flow_control);
39 
49 void Usart_setEnabled(bool enabled);
50 
56 void Usart_receiverOn(void);
57 
61 void Usart_receiverOff(void);
62 
71 
81 uint32_t Usart_sendBuffer(const void * buf, uint32_t len);
82 
99 
104 uint32_t Usart_getMTUSize(void);
105 
109 void Usart_flush(void);
110 
111 #endif /* USART_H_ */
Usart_receiverOn
void Usart_receiverOn(void)
Enable USART Receiver.
Usart_setEnabled
void Usart_setEnabled(bool enabled)
Enable or disable USART Enables or disables USART clock and configures GPIO pins.
Usart_enableReceiver
void Usart_enableReceiver(serial_rx_callback_f callback)
Enable UART receiver Set callback handler for character RX event Enables interrupt source and event,...
UART_FLOW_CONTROL_HW
@ UART_FLOW_CONTROL_HW
Definition: usart.h:20
Usart_flush
void Usart_flush(void)
Soft flush (dump data to I/O) UART TX buffer.
UART_FLOW_CONTROL_NONE
@ UART_FLOW_CONTROL_NONE
Definition: usart.h:19
Usart_setFlowControl
bool Usart_setFlowControl(uart_flow_control_e flow)
Set USART flow control mode.
uart_flow_control_e
uart_flow_control_e
Definition: usart.h:17
Usart_receiverOff
void Usart_receiverOff(void)
Disable USART Receiver.
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
void Usart_init(uint32_t baudrate)
Initialize all USART blocks Enables peripheral clocks and disables peripherals for the duration of th...
Usart_sendBuffer
uint32_t Usart_sendBuffer(const void *buf, uint32_t len)
Send a buffer to USART.
serial_rx_callback_f
void(* serial_rx_callback_f)(uint8_t *ch, size_t n)
Definition: usart.h:15