Wirepas SDK
usart.h
Go to the documentation of this file.
1 /* Copyright 2017 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 
45 void Usart_setEnabled(bool enabled);
46 
50 void Usart_receiverOn(void);
51 
55 void Usart_receiverOff(void);
56 
65 
75 uint32_t Usart_sendBuffer(const void * buf, uint32_t len);
85 
90 uint32_t Usart_getMTUSize(void);
91 
95 void Usart_flush(void);
96 
97 #endif /* USART_H_ */
Usart_receiverOn
void Usart_receiverOn(void)
Enable USART Receiver.
Usart_setEnabled
void Usart_setEnabled(bool enabled)
Enable or disable USART.
Usart_enableReceiver
void Usart_enableReceiver(serial_rx_callback_f callback)
Enable UART receiver Set callback handlers 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