Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | /*! \file uartsw2.h \brief Software Interrupt-driven UART Driver. */ |
2 | //***************************************************************************** |
||
3 | // |
||
4 | // File Name : 'uartsw2.h' |
||
5 | // Title : Software Interrupt-driven UART Driver |
||
6 | // Author : Pascal Stang - Copyright (C) 2002-2003 |
||
7 | // Created : 7/20/2002 |
||
8 | // Revised : 4/27/2004 |
||
9 | // Version : 0.6 |
||
10 | // Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32) |
||
11 | // Editor Tabs : 4 |
||
12 | // |
||
13 | /// \ingroup driver_sw |
||
14 | /// \defgroup uartsw2 Software Interrupt-driven UART Driver (uartsw2.c) |
||
15 | /// \code #include "uartsw2.h" \endcode |
||
16 | /// \par Overview |
||
17 | /// This uart library emulates the operation of a UART (serial port) using |
||
18 | /// the AVR's hardware timers, I/O pins, and some software. |
||
19 | /// |
||
20 | /// Specifically, this code uses: |
||
21 | /// -Timer 2 Output Capture for transmit timing |
||
22 | /// -Timer 0 Output Capture for receive timing |
||
23 | /// -External Interrupt 2 for receive triggering |
||
24 | /// |
||
25 | /// The above resources cannot be used for other purposes while this software |
||
26 | /// UART is enabled. The overflow interrupts from Timer0 and Timer2 can still |
||
27 | /// be used for other timing, but the prescalers for these timers must not be |
||
28 | /// changed. |
||
29 | /// |
||
30 | /// Serial output from this UART can be routed to any I/O pin. Serial input |
||
31 | /// for this UART must come from the External Interrupt 2 (INT2) I/O pin. |
||
32 | /// These options should be configured by editing your local copy of |
||
33 | /// "uartsw2conf.h". |
||
34 | // |
||
35 | // This code is distributed under the GNU Public License |
||
36 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
37 | // |
||
38 | //***************************************************************************** |
||
39 | |||
40 | #ifndef UARTSW2_H |
||
41 | #define UARTSW2_H |
||
42 | |||
43 | #include "global.h" |
||
44 | #include "buffer.h" |
||
45 | |||
46 | // include configuration |
||
47 | #include "uartsw2conf.h" |
||
48 | |||
49 | // constants/macros/typdefs |
||
50 | |||
51 | // functions |
||
52 | |||
53 | //! enable and initialize the software uart |
||
54 | void uartswInit(void); |
||
55 | //! create and initialize the uart buffers |
||
56 | void uartswInitBuffers(void); |
||
57 | //! turns off software UART |
||
58 | void uartswOff(void); |
||
59 | //! returns the receive buffer structure |
||
60 | cBuffer* uartswGetRxBuffer(void); |
||
61 | //! sets the uart baud rate |
||
62 | void uartswSetBaudRate(u32 baudrate); |
||
63 | //! sends a single byte over the uart |
||
64 | void uartswSendByte(u08 data); |
||
65 | |||
66 | //! gets a single byte from the uart receive buffer |
||
67 | // Function returns TRUE if data was available, FALSE if not. |
||
68 | // Actual data is returned in variable pointed to by "data". |
||
69 | // example usage: |
||
70 | // char myReceivedByte; |
||
71 | // uartswReceiveByte( &myReceivedByte ); |
||
72 | u08 uartswReceiveByte(u08* rxData); |
||
73 | |||
74 | //! internal transmit bit handler |
||
75 | void uartswTxBitService(void); |
||
76 | //! internal receive bit handler |
||
77 | void uartswRxBitService(void); |
||
78 | |||
79 | #endif |
Powered by WebSVN v2.8.3