avr/cpp/atmega8515/Timer.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_ATMEGA8515_TIMER_H__
00029 #define __AVR_CPP_ATMEGA8515_TIMER_H__
00030 
00031 /* This file should only be included from <avr/cpp/Timer.h>, never directly. */
00032 
00033 #ifndef __AVR_CPP_TIMER_H__
00034 #ifdef __DOXYGEN__
00035 #include <avr/cpp/Timer.h>
00036 #else
00037 #error "Include <avr/cpp/Timer.h> instead of <avr/cpp/atmega8515/Timer.h>."
00038 #endif
00039 #endif // ifdef __AVR_CPP_TIMER_H__
00040 
00041 #ifndef __AVR_CPP_XXX_TIMER_H__
00042 #define __AVR_CPP_XXX_TIMER_H__ "atmega8515/Timer.h"
00043 #else
00044 #error "Attempt to include more than one <avr/cpp/XXX/Timer.h> file."
00045 #endif
00046 
00047 #define TIMER0_COMP_ns  Timer
00048 #define TIMER0_OVF_ns   Timer
00049 #define TIMER1_OVF_ns   Timer
00050 #define TIMER1_COMPA_ns Timer
00051 #define TIMER1_COMPB_ns Timer
00052 #define TIMER1_CAPT_ns  Timer
00053 
00054 #define TIMER0_COMP_struct      Timer::TimerCounter0::CompareMatchInterrupt
00055 #define TIMER0_OVF_struct       Timer::TimerCounter0::OverflowInterrupt
00056 #define TIMER1_OVF_struct       Timer::TimerCounter1::OverflowInterrupt
00057 #define TIMER1_COMPA_struct     Timer::TimerCounter1::CompareMatchAInterrupt
00058 #define TIMER1_COMPB_struct     Timer::TimerCounter1::CompareMatchBInterrupt
00059 #define TIMER1_CAPT_struct      Timer::TimerCounter1::InputCaptureInterrupt
00060 
00061 
00062 namespace AVRCpp
00063 {
00064         namespace Timer
00065         {
00066                 inline void PrescalerReset10() { SetBits<_SFIOR>(_PSR10); }
00067                 
00068                 
00069                 struct TimerCounter0 : Internal::OneChannel8BitTimer <
00070                                 _TCNT0,                         /* CounterRegister */
00071                                 _OCR0,                          /* OutputCompareRegister */
00072                                 _TCCR0,                         /* ControlRegister */
00073                                 ClockB,                         /* ClockEnum */
00074                                 OutputPin0<PortB> >     /* ChannelOutputPin */
00075                 {
00076                         struct CompareMatchInterrupt : Interrupt<Bits<_TIMSK, _OCIE0>, Bits<_TIFR, _OCF0> > { __INTERRUPT_HANDLER_SUPPORT__ };
00077                         struct OverflowInterrupt : Interrupt<Bits<_TIMSK, _TOIE0>, Bits<_TIFR, _TOV0> > { __INTERRUPT_HANDLER_SUPPORT__ };
00078                         
00079                 }; // struct TimerCounter0
00080                 
00081                 
00082                 struct TimerCounter1 : Internal::OldTwoChannel16BitTimer <
00083                                 _TCNT1,                         /* CounterRegister */
00084                                 _OCR1A,                         /* OutputCompareRegisterA */
00085                                 _OCR1B,                         /* OutputCompareRegisterB */
00086                                 _ICR1,                          /* InputCaptureRegister */
00087                                 _TCCR1A,                        /* ControlRegisterA */
00088                                 _TCCR1B,                        /* ControlRegisterB */
00089                                 ClockB,                         /* ClockEnum */
00090                                 OutputPin5<PortD>,      /* ChannelAOutputPin */
00091                                 OutputPin2<PortE>,      /* ChannelBOutputPin */
00092                                 InputPin0<PortE> >      /* InputCaptureInputPin */
00093                 {
00094                         struct InputCaptureInterrupt : Interrupt<Bits<_TIMSK, _TICIE1>, Bits<_TIFR, _ICF1> > { __INTERRUPT_HANDLER_SUPPORT__ };
00095                         struct CompareMatchAInterrupt : Interrupt<Bits<_TIMSK, _OCIE1A>, Bits<_TIFR, _OCF1A> > { __INTERRUPT_HANDLER_SUPPORT__ };
00096                         struct CompareMatchBInterrupt : Interrupt<Bits<_TIMSK, _OCIE1B>, Bits<_TIFR, _OCF1B> > { __INTERRUPT_HANDLER_SUPPORT__ };
00097                         struct OverflowInterrupt : Interrupt<Bits<_TIMSK, _TOIE1>, Bits<_TIFR, _TOV1> > { __INTERRUPT_HANDLER_SUPPORT__ };
00098                         
00099                 }; // struct TimerCounter1
00100                 
00101         } // namespace Timer
00102         
00103 } // namespace AVRCpp
00104 
00105 #endif // ifndef __AVR_CPP_ATMEGA8515_TIMER_H__

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