Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

uartsw2.h

Go to the documentation of this file.
00001 /*! \file uartsw2.h \brief Software Interrupt-driven UART Driver. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'uartsw2.h'
00005 // Title        : Software Interrupt-driven UART Driver
00006 // Author       : Pascal Stang - Copyright (C) 2002-2003
00007 // Created      : 7/20/2002
00008 // Revised      : 4/27/2004
00009 // Version      : 0.6
00010 // Target MCU   : Atmel AVR Series (intended for the ATmega16 and ATmega32)
00011 // Editor Tabs  : 4
00012 //
00013 /// \ingroup driver_sw
00014 /// \defgroup uartsw2 Software Interrupt-driven UART Driver (uartsw2.c)
00015 /// \code #include "uartsw2.h" \endcode
00016 /// \par Overview
00017 ///     This uart library emulates the operation of a UART (serial port) using
00018 /// the AVR's hardware timers, I/O pins, and some software.
00019 ///
00020 /// Specifically, this code uses:
00021 ///     -Timer 2 Output Capture for transmit timing
00022 ///     -Timer 0 Output Capture for receive timing
00023 ///     -External Interrupt 2 for receive triggering
00024 ///
00025 /// The above resources cannot be used for other purposes while this software
00026 /// UART is enabled.  The overflow interrupts from Timer0 and Timer2 can still
00027 /// be used for other timing, but the prescalers for these timers must not be
00028 /// changed.
00029 ///
00030 /// Serial output from this UART can be routed to any I/O pin.  Serial input
00031 /// for this UART must come from the External Interrupt 2 (INT2) I/O pin.
00032 /// These options should be configured by editing your local copy of
00033 /// "uartsw2conf.h".
00034 //
00035 // This code is distributed under the GNU Public License
00036 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00037 //
00038 //*****************************************************************************
00039 
00040 #ifndef UARTSW2_H
00041 #define UARTSW2_H
00042 
00043 #include "global.h"
00044 #include "buffer.h"
00045 
00046 // include configuration
00047 #include "uartsw2conf.h"
00048 
00049 // constants/macros/typdefs
00050 
00051 // functions
00052 
00053 //! enable and initialize the software uart
00054 void uartswInit(void);
00055 //! create and initialize the uart buffers
00056 void uartswInitBuffers(void);
00057 //! turns off software UART
00058 void uartswOff(void);
00059 //! returns the receive buffer structure 
00060 cBuffer* uartswGetRxBuffer(void);
00061 //! sets the uart baud rate
00062 void uartswSetBaudRate(u32 baudrate);
00063 //! sends a single byte over the uart
00064 void uartswSendByte(u08 data);
00065 
00066 //! gets a single byte from the uart receive buffer
00067 // Function returns TRUE if data was available, FALSE if not.
00068 // Actual data is returned in variable pointed to by "data".
00069 // example usage:
00070 // char myReceivedByte;
00071 // uartswReceiveByte( &myReceivedByte );
00072 u08 uartswReceiveByte(u08* rxData);
00073 
00074 //! internal transmit bit handler
00075 void uartswTxBitService(void);
00076 //! internal receive bit handler
00077 void uartswRxBitService(void);
00078 
00079 #endif

Generated on Sun Oct 29 03:41:08 2006 for Procyon AVRlib by  doxygen 1.4.2