openwsn_uart.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Hamburg University of Applied Sciences
3  * 2020 Inria
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
26 #ifndef OPENWSN_UART_H
27 #define OPENWSN_UART_H
28 
29 #include "stdint.h"
30 #include "board.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
42 #ifndef STDIO_UART_DEV
43 #define STDIO_UART_DEV (UART_DEV(0))
44 #endif
45 
52 #ifndef OPENWSN_UART_DEV
53 #ifdef MODULE_STDIO_NULL
54 #define OPENWSN_UART_DEV (STDIO_UART_DEV)
55 #else
56 #define OPENWSN_UART_DEV ((STDIO_UART_DEV + 1) % UART_NUMOF)
57 #endif
58 #endif
59 
63 #ifndef OPENWSN_UART_BAUDRATE
64 #ifndef STDIO_UART_BAUDRATE
65 #define OPENWSN_UART_BAUDRATE (115200U)
66 #else
67 #define OPENWSN_UART_BAUDRATE (STDIO_UART_BAUDRATE)
68 #endif
69 #endif
70 
78 void uart_init_openwsn(void);
79 
83 typedef void (*uart_tx_cbt)(void);
84 
88 typedef void (*uart_rx_cbt)(void);
89 
94 
102 void uart_setCTS(bool state);
103 
107 void uart_writeByte(uint8_t byteToWrite);
108 
115 uint8_t uart_readByte(void);
116 
120 void uart_enableInterrupts(void);
121 
125 void uart_disableInterrupts(void);
126 
130 void uart_clearRxInterrupts(void);
131 
135 void uart_clearTxInterrupts(void);
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /* OPENWSN_UART_H */
uart_readByte
uint8_t uart_readByte(void)
Reads a single byte received through uart.
uart_writeByte
void uart_writeByte(uint8_t byteToWrite)
Write a single byte to the configured OpenWSN uart.
uart_rx_cbt
void(* uart_rx_cbt)(void)
OpenWSN uart rx callback type.
Definition: openwsn_uart.h:88
uart_setCTS
void uart_setCTS(bool state)
Sets software flow control CTS.
uart_clearTxInterrupts
void uart_clearTxInterrupts(void)
Unused in RIOT, needs to be defined for OpenWSN.
uart_tx_cbt
void(* uart_tx_cbt)(void)
OpenWSN uart tx callback type.
Definition: openwsn_uart.h:83
uart_disableInterrupts
void uart_disableInterrupts(void)
Unused in RIOT, needs to be defined for OpenWSN.
uart_setCallbacks
void uart_setCallbacks(uart_tx_cbt txCb, uart_rx_cbt rxCb)
OpenWSN uart tx callback type.
uart_enableInterrupts
void uart_enableInterrupts(void)
Unused in RIOT, needs to be defined for OpenWSN.
uart_init_openwsn
void uart_init_openwsn(void)
Initialize OpenWSN uart.
uart_clearRxInterrupts
void uart_clearRxInterrupts(void)
Unused in RIOT, needs to be defined for OpenWSN.