-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuart.h
More file actions
64 lines (51 loc) · 1.29 KB
/
uart.h
File metadata and controls
64 lines (51 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* ------------------------------------------------------------------
* UART Library for AVR Devices
* ------------------------------------------------------------------ */
#ifndef UART_LIBRARY_H
#define UART_LIBRARY_H
#include <stddef.h>
#include <stdint.h>
#include <avr/io.h>
#include <avr/interrupt.h>
/**
* Config Example for Atmega328p
* #define UART_CONFIG_BAUDRATE 9600
* #define UART_CONFIG_DDR DDRD
* #define UART_CONFIG_PORT PORTD
* #define UART_CONFIG_TXD PD1
* #define UART_CONFIG_RXD PD0
*/
#include "uart-config.h"
/**
* Initialize UART Interface with RXD pullup
*/
extern void uart_init_with_rxd_pullup ( void );
/**
* Initialize UART Interface without RXD pullup
*/
extern void uart_init_no_rxd_pullup ( void );
/**
* Uninitialize UART Interface
*/
extern void uart_uninit ( void );
/**
* Send data byte via UART Interface
*/
extern void uart_tx_byte ( uint8_t byte );
/**
* Send data bytes via UART Interface
*/
extern void uart_tx_data ( const uint8_t * data, size_t len );
/**
* Receive data byte via UART Interface
*/
extern uint8_t uart_rx_byte ( void );
/**
* Check for UART Interface data available
*/
extern int8_t uart_data_available ( void );
/**
* Receive data bytes via UART Interface
*/
extern void uart_rx_data ( uint8_t * data, size_t len );
#endif