MiraOS UART driver.
More...
#include <stdint.h>
Go to the source code of this file.
|
typedef void(* | MiraUartDataReceivedCallback) (uint8_t *data_ptr, uint8_t length) |
|
|
enum | MiraUartError { MIRA_UART_NONE = 0x00,
MIRA_UART_ERROR = 0x01
} |
|
enum | MiraUartBits { MIRA_UART_BITS_5 = 5,
MIRA_UART_BITS_6,
MIRA_UART_BITS_7,
MIRA_UART_BITS_8
} |
|
enum | MiraUartParity { MIRA_UART_PARITY_NONE,
MIRA_UART_PARITY_ODD,
MIRA_UART_PARITY_EVEN
} |
|
enum | MiraUartStopBits { MIRA_UART_STOP_BITS_1 = 1,
MIRA_UART_STOP_BITS_2
} |
|
MiraOS UART driver.
- Author
- LumenRadio AB
- Date
- 16 Nov 2016 The MiraOS library provides functions for controlling the Mira radio module, sending/receiving messages, controlling peripherals, etc.
- See also
- http://docs.lumenrad.io/mira
Enumerator |
---|
MIRA_UART_NONE |
Success
|
MIRA_UART_ERROR |
Error
|
MiraUartError mira_uart_init |
( |
uint32_t |
baud_rate, |
|
|
MiraUartBits |
bits, |
|
|
MiraUartParity |
parity, |
|
|
MiraUartStopBits |
stop_bits, |
|
|
MiraUartDataReceivedCallback |
callback |
|
) |
| |
Initialize UART.
- Parameters
-
baud_rate | UART baud rate. A value between 300 and 1000000. |
bits | Word length. |
parity | Parity. |
stop_bits | Number of stop bits. |
callback | Callback to call when words are received. The callback is called from an interrupt handler and care should be taken to avoid race conditions. NULL if no callback. |
- Returns
- Returns an error if initialization could not be completed.
uint8_t mira_uart_receive_buffer_is_empty |
( |
| ) |
|
- Returns
- True if the receive buffer is empty.
uint8_t mira_uart_receive_buffer_is_full |
( |
| ) |
|
- Returns
- True if the receive buffer is full.
uint8_t mira_uart_receive_byte |
( |
| ) |
|
Receive one byte.
Blocks until there are bytes available in the receive buffer.
- Returns
- Received byte
uint8_t mira_uart_send_buffer_is_empty |
( |
| ) |
|
- Returns
- True if the send buffer is empty.
uint8_t mira_uart_send_buffer_is_full |
( |
| ) |
|
- Returns
- True if the send buffer is not full
void mira_uart_send_byte |
( |
uint8_t |
data | ) |
|
Send one byte.
Add one byte to the send buffer. Blocks until the send buffer is not full.
- Parameters
-