|
ruuvi.drivers.c ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
|
Interface for UART operations. More...
#include "ruuvi_driver_error.h"#include "ruuvi_interface_gpio.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | ruuvi_interface_uart_init_config_t |
Enumerations | |
| enum | ruuvi_interface_uart_baud_t { RUUVI_INTERFACE_UART_BAUD_9600 , RUUVI_INTERFACE_UART_BAUD_115200 } |
Functions | |
| ruuvi_driver_status_t | ruuvi_interface_uart_init (const ruuvi_interface_uart_init_config_t *const config) |
| Callback function for received data. | |
| bool | ruuvi_interface_uart_is_init () |
| check if UART interface is already initialized. | |
| ruuvi_driver_status_t | ruuvi_interface_uart_uninit () |
| Uninitialize UART driver. | |
| 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. | |
Interface for UART operations.
Definition in file ruuvi_interface_uart.h.
Baudrate for UART
| Enumerator | |
|---|---|
| RUUVI_INTERFACE_UART_BAUD_9600 | 9600 bauds |
| RUUVI_INTERFACE_UART_BAUD_115200 | 2 Mbps |
Definition at line 27 of file ruuvi_interface_uart.h.
| ruuvi_driver_status_t ruuvi_interface_uart_init | ( | const ruuvi_interface_uart_init_config_t *const | config | ) |
Callback function for received data.
Initialize UART driver with given settings
This function also handles configuring the GPIO pins as required
| config | Configuration of the UART peripheral. Will setup given pins as required. |
| bool ruuvi_interface_uart_is_init | ( | ) |
check if UART interface is already initialized.
true if UART is initialized false otherwise | 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.
| p_tx | pointer to data to be sent. Must be in RAM. |
| tx_len | length of data to be sent. |
| ruuvi_driver_status_t ruuvi_interface_uart_uninit | ( | ) |
Uninitialize UART driver.
This function might not uninitialize the UART GPIO pins, only the underlying peripheral. Uninitialized GPIOs explicitly if that is required.