ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_interface_uart.h
Go to the documentation of this file.
1 #ifndef RUUVI_INTERFACE_UART_H
2 #define RUUVI_INTERFACE_UART_H
3 #include "ruuvi_driver_error.h"
4 #include "ruuvi_interface_gpio.h"
5 #include <stdbool.h>
6 #include <stddef.h>
7 #include <stdint.h>
8 
27 typedef enum
28 {
32 
36 typedef struct
37 {
38  ruuvi_interface_gpio_id_t tx;
39  ruuvi_interface_gpio_id_t rx;
40  ruuvi_interface_gpio_id_t cts;
41  ruuvi_interface_gpio_id_t rts;
43  bool parity;
44  bool hwfc;
46 
50 //typedef void (*ruuvi_interface_uart_cb_t)(const uint8_t* const data, const size_t data_length);
51 
62  const config);
63 
71 
81 ruuvi_driver_status_t ruuvi_interface_uart_uninit();
82 
94 ruuvi_driver_status_t ruuvi_interface_uart_send_blocking (const uint8_t * const p_tx,
95  const size_t tx_len);
96 
100 //void ruuvi_interface_uart_rx_cb_set(const ruuvi_interface_uart_cb_t cb);
101 /* @} */
102 #endif
Ruuvi error codes and error check function.
ruuvi_driver_status_t ruuvi_interface_uart_uninit()
Uninitialize UART driver.
ruuvi_interface_uart_baud_t
@ RUUVI_INTERFACE_UART_BAUD_9600
9600 bauds
@ RUUVI_INTERFACE_UART_BAUD_115200
2 Mbps
bool ruuvi_interface_uart_is_init()
check if UART interface is already initialized.
ruuvi_driver_status_t ruuvi_interface_uart_send_blocking(const uint8_t *const p_tx, const size_t tx_len)
UART write function. Function is blocking and will not sleep while transaction is ongoing.
ruuvi_driver_status_t ruuvi_interface_uart_init(const ruuvi_interface_uart_init_config_t *const config)
Callback function for received data.
ruuvi_interface_gpio_id_t tx
pin number of TX.
ruuvi_interface_gpio_id_t cts
pin number of CTS.
bool parity
True -> parity bit enabled. False -> disabled.
ruuvi_interface_uart_baud_t baud
Baud rate, see ruuvi_interface_uart_baud_t.
ruuvi_interface_gpio_id_t rts
pin number of RTS.
bool hwfc
True -> Hardware flow control enabled. False -> disabled.
ruuvi_interface_gpio_id_t rx
pin number of RX.