3 This file is part of the AVR-uart_ni.
4 Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * \email daniel.otte@rub.de
24 * \license GPLv3 or later
26 * \brief declaration for non-interrupt uart
33 #include "circularbytebuffer.h"
37 circularbytebuffer_t rxb;
38 circularbytebuffer_t txb;
41 volatile uint8_t hook_running;
44 volatile uint8_t txon;
45 volatile uint8_t rxon;
51 circularbytebuffer_t rxb;
52 circularbytebuffer_t txb;
55 volatile uint8_t hook_running;
58 volatile uint8_t txon;
59 volatile uint8_t rxon;
65 /** \fn uart0_init(void)
66 * \brief initialize uart0.
67 * This function initializes the first uart according to the parameter specifyed
70 void uart0_init(void);
72 /** \fn uart0_putc(uint16_t)
73 * \brief send data through uart0.
74 * This function sends data through the first uart
75 * (the data size is debfined in config.h).
76 * \param c data to send
78 void uart0_putc(uint16_t c);
80 /** \fn uart0_getc(void)
81 * \brief read data from uart0.
82 * This function reads data from the first uart
83 * (the data size is debfined in config.h).
84 * \return data recived by uart0
86 uint16_t uart0_getc(void);
88 /** \fn uart0_dataavail(void)
89 * \brief checks if data is available.
91 * This function checks the state of the input buffer of uart0 and
92 * returns if data is available or not.
93 * \return zero if no data is available else a value different from zero is returned
95 uint8_t uart0_dataavail(void);
98 void uart0_sethook(void(*fpt)(uint8_t));
105 /** \fn uart1_init(void)
106 * \brief initialize uart1.
107 * This function initializes the second uart according to the parameter specifyed
110 void uart1_init(void);
112 /** \fn uart1_putc(uint16_t)
113 * \brief send data through uart1.
114 * This function sends data through the second uart
115 * (the data size is debfined in config.h).
116 * \param c data to send
118 void uart1_putc(uint16_t c);
120 /** \fn uart1_getc(void)
121 * \brief read data from uart1.
122 * This function reads data from the second uart
123 * (the data size is debfined in config.h).
124 * \return data recived by uart1
126 uint16_t uart1_getc(void);
128 /** \fn uart1_dataavail(void)
129 * \brief checks if data is available.
130 * This function checks the state of the input buffer of uart1 and
131 * returns if data is available or not.
132 * \return zero if no data is available else a value different from zero is returned
134 uint8_t uart1_dataavail(void);
136 void uart0_sethook(void(*fpt)(uint8_t));
139 #endif /* UART_I_H_ */