Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | /*! \file uartswconf.h \brief Interrupt-driven Software UART Driver Configuration. */ |
2 | //***************************************************************************** |
||
3 | // |
||
4 | // File Name : 'uartswconf.h' |
||
5 | // Title : Interrupt-driven Software UART Driver Configuration |
||
6 | // Author : Pascal Stang - Copyright (C) 2002-2004 |
||
7 | // Created : 7/20/2002 |
||
8 | // Revised : 4/27/2004 |
||
9 | // Version : 0.1 |
||
10 | // Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32) |
||
11 | // Editor Tabs : 4 |
||
12 | // |
||
13 | // Description : |
||
14 | // This uart library emulates the operation of a UART (serial port) using |
||
15 | // the AVR's hardware timers, I/O pins, and some software. |
||
16 | // |
||
17 | // Specifically, this code uses: |
||
18 | // -Timer 1 Output Compare A for transmit timing |
||
19 | // -Timer 1 Output Compare B for receive timing |
||
20 | // -Timer 1 Input Capture for receive triggering |
||
21 | // |
||
22 | // The above resources cannot be used for other purposes while this software |
||
23 | // UART is enabled. The overflow interrupt from Timer1 can still be used for |
||
24 | // other timing, but the prescaler for Timer1 must not be changed. |
||
25 | // |
||
26 | // Serial output from this UART can be routed to any I/O pin. Serial input |
||
27 | // for this UART must come from the Timer1 Input Capture (IC1) I/O pin. |
||
28 | // These options should be configured by editing your local copy of |
||
29 | // "uartswconf.h". |
||
30 | // |
||
31 | // This code is distributed under the GNU Public License |
||
32 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
33 | // |
||
34 | //***************************************************************************** |
||
35 | |||
36 | #ifndef UARTSWCONF_H |
||
37 | #define UARTSWCONF_H |
||
38 | |||
39 | // constants/macros/typdefs |
||
40 | |||
41 | #define UARTSW_RX_BUFFER_SIZE 0x20 ///< UART receive buffer size in bytes |
||
42 | |||
43 | #define UARTSW_INVERT ///< define to invert polarity of RX/TX signals |
||
44 | // when non-inverted, the serial line is appropriate for passing though |
||
45 | // an RS232 driver like the MAX232. When inverted, the serial line can |
||
46 | // directly drive/receive RS232 signals to/from a DB9 connector. Be sure |
||
47 | // to use a current-limiting resistor and perhaps a diode-clamp circuit when |
||
48 | // connecting incoming RS232 signals to a microprocessor I/O pin. |
||
49 | |||
50 | // if non-inverted, the serial line idles high (logic 1) between bytes |
||
51 | // if inverted, the serial line idles low (logic 0) between bytes |
||
52 | |||
53 | |||
54 | // UART transmit pin defines |
||
55 | #define UARTSW_TX_PORT PORTD ///< UART Transmit Port |
||
56 | #define UARTSW_TX_DDR DDRD ///< UART Transmit DDR |
||
57 | #define UARTSW_TX_PIN PD5 ///< UART Transmit Pin |
||
58 | |||
59 | // UART receive pin defines |
||
60 | // This pin must correspond to the |
||
61 | // Timer1 Input Capture (ICP or IC1) pin for your processor |
||
62 | #define UARTSW_RX_PORT PORTD ///< UART Receive Port |
||
63 | #define UARTSW_RX_DDR DDRD ///< UART Receive DDR |
||
64 | #define UARTSW_RX_PORTIN PIND ///< UART Receive Port Input |
||
65 | #define UARTSW_RX_PIN PD6 ///< UART Receive Pin |
||
66 | |||
67 | #endif |
Powered by WebSVN v2.8.3