Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | /*! \file uartsw2conf.h \brief Interrupt-driven Software UART Driver Configuration. */ |
2 | //***************************************************************************** |
||
3 | // |
||
4 | // File Name : 'uartsw2conf.h' |
||
5 | // Title : Interrupt-driven Software UART Driver Configuration |
||
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 | // 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 2 Output Capture for transmit timing |
||
19 | // -Timer 0 Output Capture for receive timing |
||
20 | // -External Interrupt 2 for receive triggering |
||
21 | // |
||
22 | // The above resources cannot be used for other purposes while this software |
||
23 | // UART is enabled. The overflow interrupts from Timer0 and Timer2 can still |
||
24 | // be used for other timing, but the prescalers for these timers must not be |
||
25 | // changed. |
||
26 | // |
||
27 | // Serial output from this UART can be routed to any I/O pin. Serial input |
||
28 | // for this UART must come from the External Interrupt 2 (INT2) I/O pin. |
||
29 | // These options should be configured by editing your local copy of |
||
30 | // "uartsw2conf.h". |
||
31 | // |
||
32 | // This code is distributed under the GNU Public License |
||
33 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
34 | // |
||
35 | //***************************************************************************** |
||
36 | |||
37 | #ifndef UARTSW2CONF_H |
||
38 | #define UARTSW2CONF_H |
||
39 | |||
40 | // constants/macros/typdefs |
||
41 | |||
42 | #define UARTSW_RX_BUFFER_SIZE 0x20 ///< UART receive buffer size in bytes |
||
43 | |||
44 | #define UARTSW_INVERT ///< define to invert polarity of RX/TX signals |
||
45 | // when non-inverted, the serial line is appropriate for passing though |
||
46 | // an RS232 driver like the MAX232. When inverted, the serial line can |
||
47 | // directly drive/receive RS232 signals to/from a DB9 connector. Be sure |
||
48 | // to use a current-limiting resistor and perhaps a diode-clamp circuit when |
||
49 | // connecting incoming RS232 signals to a microprocessor I/O pin. |
||
50 | |||
51 | // if non-inverted, the serial line idles high (logic 1) between bytes |
||
52 | // if inverted, the serial line idles low (logic 0) between bytes |
||
53 | |||
54 | |||
55 | // UART transmit pin defines |
||
56 | #define UARTSW_TX_PORT PORTB ///< UART Transmit Port |
||
57 | #define UARTSW_TX_DDR DDRB ///< UART Transmit DDR |
||
58 | #define UARTSW_TX_PIN PB3 ///< UART Transmit Pin |
||
59 | |||
60 | // UART receive pin defines |
||
61 | // This pin must correspond to the |
||
62 | // External Interrupt 2 (INT2) pin for your processor |
||
63 | #define UARTSW_RX_PORT PORTB ///< UART Receive Port |
||
64 | #define UARTSW_RX_DDR DDRB ///< UART Receive DDR |
||
65 | #define UARTSW_RX_PORTIN PINB ///< UART Receive Port Input |
||
66 | #define UARTSW_RX_PIN PB2 ///< UART Receive Pin |
||
67 | |||
68 | #endif |
Powered by WebSVN v2.8.3