#include <cinputtimingtoothcounter.h>


Public Member Functions | |
| virtual void | callback (CEvent *e) |
| receive a callback event. | |
| CInputTimingToothCounter (CMachine::InterruptVector vector, TIM_TypeDef *TIMx, bool invertA=false, bool invertB=false, CMachine::ubit16 countPerRevA=1, CMachine::ubit16 countPerRevB=1, CMachine::ubit32 freqency=BASE_TIMER_FREQUENCY) | |
| Constructor. Target counter frequency is expressed in Hz, default is 2MHz counter. | |
| virtual void | irq (CMachine::InterruptVector v) |
| receive a hardware interrupt | |
| virtual | ~CInputTimingToothCounter () |
Private Attributes | |
| CTimeBaseOneShot * | mTimeBaseOneShotA |
| CTimeBaseOneShot * | mTimeBaseOneShotB |
Definition at line 32 of file cinputtimingtoothcounter.h.
| PikeAero::CInputTimingToothCounter::CInputTimingToothCounter | ( | CMachine::InterruptVector | vector, | |
| TIM_TypeDef * | TIMx, | |||
| bool | invertA = false, |
|||
| bool | invertB = false, |
|||
| CMachine::ubit16 | countPerRevA = 1, |
|||
| CMachine::ubit16 | countPerRevB = 1, |
|||
| CMachine::ubit32 | freqency = BASE_TIMER_FREQUENCY | |||
| ) |
Constructor. Target counter frequency is expressed in Hz, default is 2MHz counter.
Definition at line 28 of file cinputtimingtoothcounter.cpp.
References PikeAero::CMachine::config(), PikeAero::CObject::installCallback(), mTimeBaseOneShotA, mTimeBaseOneShotB, PikeAero::CEvent::OneShot, TB1, TB2, PikeAero::CMachine::Vector_TB1, and PikeAero::CMachine::Vector_TB2.
00037 : inherited(vector,TIMx,invertA,invertB,countPerRevA,countPerRevB,frequency) 00038 { 00039 mTimeBaseOneShotA = new CTimeBaseOneShot(CMachine::Vector_TB1, TB1, 65536, CMachine::config()->getOneShotPrescaleA()); 00040 mTimeBaseOneShotB = new CTimeBaseOneShot(CMachine::Vector_TB2, TB2, 65536, CMachine::config()->getOneShotPrescaleB()); 00041 00042 mTimeBaseOneShotA->installCallback(this,CEvent::OneShot); 00043 mTimeBaseOneShotB->installCallback(this,CEvent::OneShot); 00044 }

| PikeAero::CInputTimingToothCounter::~CInputTimingToothCounter | ( | ) | [virtual] |
Definition at line 47 of file cinputtimingtoothcounter.cpp.
References mTimeBaseOneShotA, and mTimeBaseOneShotB.
00048 { 00049 delete mTimeBaseOneShotA; 00050 delete mTimeBaseOneShotB; 00051 00052 mTimeBaseOneShotA=NULL; 00053 mTimeBaseOneShotB=NULL; 00054 }
| void PikeAero::CInputTimingToothCounter::callback | ( | CEvent * | e | ) | [virtual] |
receive a callback event.
FIXME - do a callback to announce TDC...
reset tooth count
reset tooth count
Reimplemented from PikeAero::CObject.
Definition at line 59 of file cinputtimingtoothcounter.cpp.
References mTimeBaseOneShotA, mTimeBaseOneShotB, PikeAero::CEvent::sender(), PikeAero::CInputTiming::setCountA(), and PikeAero::CInputTiming::setCountB().
00060 { 00061 /** 00062 ** FIXME - do a callback to announce TDC... 00063 **/ 00064 if ( e->sender() == mTimeBaseOneShotA ) 00065 { 00066 /** reset tooth count */ 00067 setCountA(0); 00068 } 00069 else 00070 if ( e->sender() == mTimeBaseOneShotB ) 00071 { 00072 /** reset tooth count */ 00073 setCountB(0); 00074 } 00075 }

| void PikeAero::CInputTimingToothCounter::irq | ( | CMachine::InterruptVector | v | ) | [virtual] |
receive a hardware interrupt
Receive a hardware interrupt.
Calculate the pulse width(s) and get the tooth counts...
Load the one-shots...
Start the one-shots...
Reimplemented from PikeAero::CInputTiming.
Definition at line 80 of file cinputtimingtoothcounter.cpp.
References PikeAero::CTimeBase::load(), mTimeBaseOneShotA, mTimeBaseOneShotB, PikeAero::CBinaryInputCapture::pulseWidthA(), PikeAero::CBinaryInputCapture::pulseWidthB(), PikeAero::CTimeBase::start(), PikeAero::CBinaryInputCapture::statusRegister(), PikeAero::CTimeBase::stop(), PikeAero::CBinaryInputOutputTimer::ticksToDuration(), TIM_ICFA, and TIM_ICFB.
00081 { 00082 /** Calculate the pulse width(s) and get the tooth counts... */ 00083 inherited::irq(v); 00084 00085 /** Load the one-shots... */ 00086 if ( statusRegister() & TIM_ICFA ) 00087 { 00088 mTimeBaseOneShotA->stop(); 00089 mTimeBaseOneShotA->load( ticksToDuration( pulseWidthA() + (pulseWidthA()/4) ) ); 00090 } 00091 if ( statusRegister() & TIM_ICFB ) 00092 { 00093 mTimeBaseOneShotB->stop(); 00094 mTimeBaseOneShotB->load( ticksToDuration( pulseWidthB() + (pulseWidthB()/4) ) ); 00095 } 00096 00097 /** Start the one-shots... */ 00098 if ( statusRegister() & TIM_ICFA ) 00099 { 00100 mTimeBaseOneShotA->start(); 00101 } 00102 if ( statusRegister() & TIM_ICFB ) 00103 { 00104 mTimeBaseOneShotB->start(); 00105 } 00106 }

Definition at line 62 of file cinputtimingtoothcounter.h.
Referenced by callback(), CInputTimingToothCounter(), irq(), and ~CInputTimingToothCounter().
Definition at line 63 of file cinputtimingtoothcounter.h.
Referenced by callback(), CInputTimingToothCounter(), irq(), and ~CInputTimingToothCounter().
1.5.8