avr/cpp/atmega64/USART.h

Go to the documentation of this file.
00001 /**********************************************************************************************************************\
00002 
00003         C++ library for Atmel AVR microcontrollers
00004         Copyright (C) 2007 Lauri Kirikal, Mikk Leini, MT� TT� Robotiklubi
00005 
00006         This program is free software; you can redistribute it and/or
00007         modify it under the terms of the GNU General Public License
00008         as published by the Free Software Foundation; either version 2
00009         of the License, or (at your option) any later version.
00010 
00011         This program is distributed in the hope that it will be useful,
00012         but WITHOUT ANY WARRANTY; without even the implied warranty of
00013         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014         GNU General Public License for more details.
00015 
00016         You should have received a copy of the GNU General Public License
00017         along with this program; if not, write to the Free Software
00018         Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019 
00020         See http://creativecommons.org/licenses/GPL/2.0/
00021 
00022         MT� TT� Robotiklubi  http://www.robotiklubi.ee robotiklubi@gmail.com
00023         Lauri Kirikal        laurikirikal@gmail.com
00024         Mikk Leini           mikk.leini@gmail.com
00025 
00026 \**********************************************************************************************************************/
00027 
00028 #ifndef __AVR_CPP_ATMEGA64_USART_H__
00029 #define __AVR_CPP_ATMEGA64_USART_H__
00030 
00031 /* This file should only be included from <avr/cpp/USART.h>, never directly. */
00032 
00033 #ifndef __AVR_CPP_USART_H__
00034 #ifdef __DOXYGEN__
00035 #include <avr/cpp/USART.h>
00036 #else
00037 #error "Include <avr/cpp/USART.h> instead of <avr/cpp/atmega64/USART.h>."
00038 #endif
00039 #endif // ifndef __AVR_CPP_USART_H__
00040 
00041 #ifndef __AVR_CPP_XXX_USART_H__
00042 #define __AVR_CPP_XXX_USART_H__ "atmega64/USART.h"
00043 #else
00044 #error "Attempt to include more than one <avr/cpp/XXX/USART.h> file."
00045 #endif
00046 
00047 #define USART0_RX_ns    USART
00048 #define USART0_TX_ns    USART
00049 #define USART0_UDRE_ns  USART
00050 #define USART1_RX_ns    USART
00051 #define USART1_TX_ns    USART
00052 #define USART1_UDRE_ns  USART
00053 
00054 #define USART0_RX_struct        USART::USART0::ReceiveCompleteInterrupt
00055 #define USART0_TX_struct        USART::USART0::TransferCompleteInterrupt
00056 #define USART0_UDRE_struct      USART::USART0::DataRegisterEmptyInterrupt
00057 #define USART1_RX_struct        USART::USART1::ReceiveCompleteInterrupt
00058 #define USART1_TX_struct        USART::USART1::TransferCompleteInterrupt
00059 #define USART1_UDRE_struct      USART::USART1::DataRegisterEmptyInterrupt
00060 
00061 
00062 namespace AVRCpp
00063 {
00064         namespace USART
00065         {
00066                 // Functions from this namespace should not be called by user
00067                 namespace Internal
00068                 {
00069                         bool &Cancel0();
00070                         bool &Cancel1();
00071                         
00072                 } // namespace Internal
00073                 
00074                 struct USART0 : Internal::USARTBase <
00075                                 _UBRR0H,                                        /* BaudRateRegisterHigh */
00076                                 _UBRR0L,                                        /* BaudRateRegisterLow */
00077                                 _UCSR0A,                                        /* ControlRegisterA */
00078                                 _UCSR0B,                                        /* ControlRegisterB */
00079                                 _UCSR0C,                                        /* ControlRegisterC */
00080                                 _UDR0,                                          /* DataRegister */
00081                                 Pin2<PortE>,                            /* TransferClockPin */
00082                                 Internal::NoRegisterSelect,     /* registerSelect */
00083                                 Internal::Cancel0 >                     /* Cancel */
00084                 {
00085                         struct ReceiveCompleteInterrupt : BasicInterrupt<Bits<_UCSR0B, _RXCIE0> > { __INTERRUPT_HANDLER_SUPPORT__ };
00086                         struct TransferCompleteInterrupt : BasicInterrupt<Bits<_UCSR0B, _TXCIE0> > { __INTERRUPT_HANDLER_SUPPORT__ };
00087                         struct DataRegisterEmptyInterrupt : BasicInterrupt<Bits<_UCSR0B, _UDRIE0> > { __INTERRUPT_HANDLER_SUPPORT__ };
00088                         
00089                 }; // struct USART0
00090                 
00091                 struct USART1 : Internal::USARTBase <
00092                                 _UBRR1H,                                        /* BaudRateRegisterHigh */
00093                                 _UBRR1L,                                        /* BaudRateRegisterLow */
00094                                 _UCSR1A,                                        /* ControlRegisterA */
00095                                 _UCSR1B,                                        /* ControlRegisterB */
00096                                 _UCSR1C,                                        /* ControlRegisterC */
00097                                 _UDR1,                                          /* DataRegister */
00098                                 Pin5<PortD>,                            /* TransferClockPin */
00099                                 Internal::NoRegisterSelect,     /* registerSelect */
00100                                 Internal::Cancel1 >                     /* Cancel */
00101                 {
00102                         struct ReceiveCompleteInterrupt : BasicInterrupt<Bits<_UCSR1B, _RXCIE1> > { __INTERRUPT_HANDLER_SUPPORT__ };
00103                         struct TransferCompleteInterrupt : BasicInterrupt<Bits<_UCSR1B, _TXCIE1> > { __INTERRUPT_HANDLER_SUPPORT__ };
00104                         struct DataRegisterEmptyInterrupt : BasicInterrupt<Bits<_UCSR1B, _UDRIE1> > { __INTERRUPT_HANDLER_SUPPORT__ };
00105                         
00106                 }; // struct USART1
00107                 
00108         } // namespace USART
00109         
00110 } // namespace AVRCpp
00111 
00112 #endif // ifndef __AVR_CPP_ATMEGA64_USART_H__

Generated on Sat Sep 15 23:41:05 2007 for AVR C++ Lib for ATmega64 by  doxygen 1.5.2
SourceForge.net Logo MTÜ TTÜ Robotiklubi