00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __AVR_CPP_AT90USB1287_TIMER_H__
00029 #define __AVR_CPP_AT90USB1287_TIMER_H__
00030
00031
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/at90usb1287/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__ "at90usb1287/Timer.h"
00043 #else
00044 #error "Attempt to include more than one <avr/cpp/XXX/Timer.h> file."
00045 #endif
00046
00047 #define TIMER0_COMPA_ns Timer
00048 #define TIMER0_COMPB_ns Timer
00049 #define TIMER0_OVF_ns Timer
00050
00051 #define TIMER1_COMPA_ns Timer
00052 #define TIMER1_COMPB_ns Timer
00053 #define TIMER1_COMPC_ns Timer
00054 #define TIMER1_OVF_ns Timer
00055 #define TIMER1_CAPT_ns Timer
00056
00057 #define TIMER2_COMPA_ns Timer
00058 #define TIMER2_COMPB_ns Timer
00059 #define TIMER2_OVF_ns Timer
00060
00061 #define TIMER3_COMPA_ns Timer
00062 #define TIMER3_COMPB_ns Timer
00063 #define TIMER3_COMPC_ns Timer
00064 #define TIMER3_OVF_ns Timer
00065 #define TIMER3_CAPT_ns Timer
00066
00067 #define TIMER0_COMPA_struct Timer::TimerCounter0::CompareMatchAInterrupt
00068 #define TIMER0_COMPB_struct Timer::TimerCounter0::CompareMatchBInterrupt
00069 #define TIMER0_OVF_struct Timer::TimerCounter0::OverflowInterrupt
00070
00071 #define TIMER1_COMPA_struct Timer::TimerCounter1::CompareMatchAInterrupt
00072 #define TIMER1_COMPB_struct Timer::TimerCounter1::CompareMatchBInterrupt
00073 #define TIMER1_COMPC_struct Timer::TimerCounter1::CompareMatchCInterrupt
00074 #define TIMER1_OVF_struct Timer::TimerCounter1::OverflowInterrupt
00075 #define TIMER1_CAPT_struct Timer::TimerCounter1::InputCaptureInterrupt
00076
00077 #define TIMER2_COMPA_struct Timer::TimerCounter2::CompareMatchAInterrupt
00078 #define TIMER2_COMPB_struct Timer::TimerCounter2::CompareMatchBInterrupt
00079 #define TIMER2_OVF_struct Timer::TimerCounter2::OverflowInterrupt
00080
00081 #define TIMER3_COMPA_struct Timer::TimerCounter3::CompareMatchAInterrupt
00082 #define TIMER3_COMPB_struct Timer::TimerCounter3::CompareMatchBInterrupt
00083 #define TIMER3_COMPC_struct Timer::TimerCounter3::CompareMatchCInterrupt
00084 #define TIMER3_OVF_struct Timer::TimerCounter3::OverflowInterrupt
00085 #define TIMER3_CAPT_struct Timer::TimerCounter3::InputCaptureInterrupt
00086
00087
00088 namespace AVRCpp
00089 {
00090 namespace Timer
00091 {
00092 inline void StartSynchronization() { SetBits<_GTCCR>(_TSM); }
00093 inline void EndSynchronization() { ClearBits<_GTCCR>(_TSM); }
00094
00095 inline void PrescalerReset310() { SetBits<_GTCCR>(_PSRSYNC); }
00096 inline void PrescalerReset2() { SetBits<_GTCCR>(_PSRASY); }
00097
00098
00099 struct TimerCounter0 : Internal::TwoChannel8BitTimer <
00100 _TCNT0,
00101 _OCR0A,
00102 _OCR0B,
00103 _TCCR0A,
00104 _TCCR0B,
00105 ClockB,
00106 OutputPin7<PortB>,
00107 OutputPin0<PortD> >
00108 {
00109 struct CompareMatchAInterrupt : Interrupt<Bits<_TIMSK0, _OCIE0A>, Bits<_TIFR0, _OCF0A> > { __INTERRUPT_HANDLER_SUPPORT__ };
00110 struct CompareMatchBInterrupt : Interrupt<Bits<_TIMSK0, _OCIE0B>, Bits<_TIFR0, _OCF0B> > { __INTERRUPT_HANDLER_SUPPORT__ };
00111 struct OverflowInterrupt : Interrupt<Bits<_TIMSK0, _TOIE0>, Bits<_TIFR0, _TOV0> > { __INTERRUPT_HANDLER_SUPPORT__ };
00112
00113 };
00114
00115
00116 struct TimerCounter1 : Internal::ThreeChannel16BitTimer <
00117 _TCNT1,
00118 _OCR1A,
00119 _OCR1B,
00120 _OCR1C,
00121 _ICR1,
00122 _TCCR1A,
00123 _TCCR1B,
00124 _TCCR1C,
00125 ClockB,
00126 OutputPin5<PortB>,
00127 OutputPin6<PortB>,
00128 OutputPin7<PortB>,
00129 InputPin4<PortD> >
00130 {
00131 struct CompareMatchAInterrupt : Interrupt<Bits<_TIMSK1, _OCIE1A>, Bits<_TIFR1, _OCF1A> > { __INTERRUPT_HANDLER_SUPPORT__ };
00132 struct CompareMatchBInterrupt : Interrupt<Bits<_TIMSK1, _OCIE1B>, Bits<_TIFR1, _OCF1B> > { __INTERRUPT_HANDLER_SUPPORT__ };
00133 struct CompareMatchCInterrupt : Interrupt<Bits<_TIMSK1, _OCIE1C>, Bits<_TIFR1, _OCF1C> > { __INTERRUPT_HANDLER_SUPPORT__ };
00134 struct OverflowInterrupt : Interrupt<Bits<_TIMSK1, _TOIE1>, Bits<_TIFR1, _TOV1> > { __INTERRUPT_HANDLER_SUPPORT__ };
00135 struct InputCaptureInterrupt : Interrupt<Bits<_TIMSK1, _ICIE1>, Bits<_TIFR1, _ICF1> > { __INTERRUPT_HANDLER_SUPPORT__ };
00136
00137 };
00138
00139
00140 struct TimerCounter2 : Internal::TwoChannel8BitTimerWithAsynchronousOperation <
00141 _TCNT2,
00142 _OCR2A,
00143 _OCR2B,
00144 _TCCR2A,
00145 _TCCR2B,
00146 _TIMSK2,
00147 _TIFR2,
00148 _ASSR,
00149 OutputPin4<PortB>,
00150 OutputPin1<PortD> >
00151 {
00152 struct CompareMatchAInterrupt : Interrupt<Bits<_TIMSK2, _OCIE2A>, Bits<_TIFR2, _OCF2A> > { __INTERRUPT_HANDLER_SUPPORT__ };
00153 struct CompareMatchBInterrupt : Interrupt<Bits<_TIMSK2, _OCIE2B>, Bits<_TIFR2, _OCF2B> > { __INTERRUPT_HANDLER_SUPPORT__ };
00154 struct OverflowInterrupt : Interrupt<Bits<_TIMSK2, _TOIE2>, Bits<_TIFR2, _TOV2> > { __INTERRUPT_HANDLER_SUPPORT__ };
00155
00156 };
00157
00158
00159 struct TimerCounter3 : Internal::ThreeChannel16BitTimer <
00160 _TCNT3,
00161 _OCR3A,
00162 _OCR3B,
00163 _OCR3C,
00164 _ICR3,
00165 _TCCR3A,
00166 _TCCR3B,
00167 _TCCR3C,
00168 ClockB,
00169 OutputPin6<PortC>,
00170 OutputPin5<PortC>,
00171 OutputPin4<PortC>,
00172 InputPin7<PortC> >
00173 {
00174 struct CompareMatchAInterrupt : Interrupt<Bits<_TIMSK3, _OCIE3A>, Bits<_TIFR3, _OCF3A> > { __INTERRUPT_HANDLER_SUPPORT__ };
00175 struct CompareMatchBInterrupt : Interrupt<Bits<_TIMSK3, _OCIE3B>, Bits<_TIFR3, _OCF3B> > { __INTERRUPT_HANDLER_SUPPORT__ };
00176 struct CompareMatchCInterrupt : Interrupt<Bits<_TIMSK3, _OCIE3C>, Bits<_TIFR3, _OCF3C> > { __INTERRUPT_HANDLER_SUPPORT__ };
00177 struct OverflowInterrupt : Interrupt<Bits<_TIMSK3, _TOIE3>, Bits<_TIFR3, _TOV3> > { __INTERRUPT_HANDLER_SUPPORT__ };
00178 struct InputCaptureInterrupt : Interrupt<Bits<_TIMSK3, _ICIE3>, Bits<_TIFR3, _ICF3> > { __INTERRUPT_HANDLER_SUPPORT__ };
00179
00180 };
00181
00182 }
00183
00184 }
00185
00186 #endif // ifndef __AVR_CPP_AT90USB1287_TIMER_H__