MiraOS  1.26
mira_uart.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (C) 2016 LumenRadio AB *
3  * *
4  * This file is part of MiraOS. *
5  * *
6  * MiraOS contains software components that are patented by LumenRadio. *
7  * Use of this software is under the terms of the LumenRadio MiraOS *
8  * license.
9  * *
10  * You should have received a copy of the MiraOS license from your *
11  * LumenRadio representative. If not, email to <licenses@lumenradio.com> *
12  ****************************************************************************/
13 
25 #ifndef LIBMIRA_UART_H_
26 #define LIBMIRA_UART_H_
27 
28 #include <stdint.h>
29 
30 typedef enum {
31  MIRA_UART_NONE = 0x00,
34 
35 typedef enum {
36  MIRA_UART_BITS_5 = 5,
37  MIRA_UART_BITS_6,
38  MIRA_UART_BITS_7,
39  MIRA_UART_BITS_8
40 } MiraUartBits;
41 
42 typedef enum {
43  MIRA_UART_PARITY_NONE,
44  MIRA_UART_PARITY_ODD,
45  MIRA_UART_PARITY_EVEN
46 } MiraUartParity;
47 
48 typedef enum {
49  MIRA_UART_STOP_BITS_1 = 1,
50  MIRA_UART_STOP_BITS_2
51 } MiraUartStopBits;
52 
53 typedef void (* MiraUartDataReceivedCallback)(uint8_t* data_ptr, uint8_t length);
54 
67  uint32_t baud_rate,
68  MiraUartBits bits,
69  MiraUartParity parity,
70  MiraUartStopBits stop_bits,
71  MiraUartDataReceivedCallback callback);
72 
80 void mira_uart_send_byte(uint8_t data);
81 
89 uint8_t mira_uart_receive_byte();
90 
95 
100 
105 
110 
111 #endif /* LIBMIRA_UART_H_ */
uint8_t mira_uart_receive_byte()
Receive one byte.
uint8_t mira_uart_send_buffer_is_full()
uint8_t mira_uart_receive_buffer_is_empty()
void mira_uart_send_byte(uint8_t data)
Send one byte.
MiraUartError mira_uart_init(uint32_t baud_rate, MiraUartBits bits, MiraUartParity parity, MiraUartStopBits stop_bits, MiraUartDataReceivedCallback callback)
Initialize UART.
Definition: mira_uart.h:31
uint8_t mira_uart_receive_buffer_is_full()
Definition: mira_uart.h:32
MiraUartError
Definition: mira_uart.h:30
uint8_t mira_uart_send_buffer_is_empty()