PikeAero::CTaskFuelInjection Class Reference

Impliments the fuel injector bank. More...

#include <ctaskfuelinjection.h>

Inheritance diagram for PikeAero::CTaskFuelInjection:

Inheritance graph
[legend]
Collaboration diagram for PikeAero::CTaskFuelInjection:

Collaboration graph
[legend]

Public Member Functions

 CTaskFuelInjection (CMachine::ubit32 frequency=2000000)
void event (CEvent *e)
 The CEvent listener [ inherits pointer ownership ].
virtual CMachine::bit32 fault ()
 The CTaskScheduler will call the fault() method when a fault code was returned by any of the task's other methods.
virtual void irq (CMachine::InterruptVector v)
 receive a hardware interrupt
virtual const char * name ()
virtual CMachine::bit32 run ()
 called exactly once. perform task initialization such as initializing private variable. Other tasks are not guaranteed so do not interract with other tasks at this stage.
virtual CMachine::bit32 start ()
 called exactly once. all tasks are initialized at this point. called just prior to first call to run()
virtual CMachine::bit32 stop ()
 The CTaskScheduler will call the stop() method after the task was scheduled for cancelation.
virtual ~CTaskFuelInjection ()

Private Attributes

CTaskAggregatormAggregator
CBinaryInputOutputPWMmCurrentLimit [0]
CBinaryInputOutputGPIOmEFIDisable
CMachine::ubit32 mFrequency
CFuelInjectormFuelInjector [8]

Detailed Description

Impliments the fuel injector bank.

Author:
Michael Sharkey <mike@pikeaero.com>

Definition at line 35 of file ctaskfuelinjection.h.


Constructor & Destructor Documentation

PikeAero::CTaskFuelInjection::CTaskFuelInjection ( CMachine::ubit32  frequency = 2000000  ) 

Definition at line 28 of file ctaskfuelinjection.cpp.

00029  : ITask()
00030  , mFrequency(frequency)
00031 {
00032 }

PikeAero::CTaskFuelInjection::~CTaskFuelInjection (  )  [virtual]

Definition at line 35 of file ctaskfuelinjection.cpp.

00036 {
00037 }


Member Function Documentation

void PikeAero::CTaskFuelInjection::event ( CEvent e  )  [virtual]

The CEvent listener [ inherits pointer ownership ].

The CEvent listener.

wake up the bottom half

Reimplemented from PikeAero::CObject.

Definition at line 135 of file ctaskfuelinjection.cpp.

References PikeAero::ITask::setSleeping(), PikeAero::CEvent::Tick, and PikeAero::CEvent::type().

00136 {
00137     switch( e->type() )
00138     {
00139         case CEvent::Tick:
00140             setSleeping(false); /** wake up the bottom half */
00141             break;
00142         default:
00143             break;
00144     }
00145 }

Here is the call graph for this function:

CMachine::bit32 PikeAero::CTaskFuelInjection::fault (  )  [virtual]

The CTaskScheduler will call the fault() method when a fault code was returned by any of the task's other methods.

Returns:
0 on success.

Reimplemented from PikeAero::ITask.

Definition at line 127 of file ctaskfuelinjection.cpp.

00128 {
00129     return 0;
00130 }

void PikeAero::CTaskFuelInjection::irq ( CMachine::InterruptVector  v  )  [virtual]

receive a hardware interrupt

Reimplemented from PikeAero::CObject.

Definition at line 150 of file ctaskfuelinjection.cpp.

00151 {
00152 }

virtual const char* PikeAero::CTaskFuelInjection::name (  )  [inline, virtual]

Returns:
A CString containing an human readable name for the task

Reimplemented from PikeAero::ITask.

Definition at line 43 of file ctaskfuelinjection.h.

00043 {return "CTaskFuelInjection";}

CMachine::bit32 PikeAero::CTaskFuelInjection::run (  )  [virtual]

called exactly once. perform task initialization such as initializing private variable. Other tasks are not guaranteed so do not interract with other tasks at this stage.

Called periodically by CTaskScheduler to do a piece of work.

Returns:
0 on success.

Reimplemented from PikeAero::ITask.

Definition at line 114 of file ctaskfuelinjection.cpp.

References PikeAero::CMachine::FaultEngineStop, mAggregator, PikeAero::CTaskAggregator::rpm(), and PikeAero::ITask::setSleeping().

00115 {
00116     setSleeping(true);
00117     if ( mAggregator != NULL )
00118     {
00119         return (mAggregator->rpm() == 0) ? CMachine::FaultEngineStop : 0;
00120     }
00121     return 0;
00122 }

Here is the call graph for this function:

CMachine::bit32 PikeAero::CTaskFuelInjection::start (  )  [virtual]

called exactly once. all tasks are initialized at this point. called just prior to first call to run()

Called exactly once. all tasks are initialized at this point. called just prior to first call to run().

Returns:
0 on success.

Reimplemented from PikeAero::ITask.

Definition at line 43 of file ctaskfuelinjection.cpp.

References PikeAero::CMachine::FaultNULLPtr, PikeAero::CTaskScheduler::find(), GPIO0, GPIO1, GPIO5, GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_10, GPIO_PIN_15, GPIO_PIN_4, GPIO_PIN_7, GPIO_PIN_8, PikeAero::CEventQueue::installListener(), mAggregator, mCurrentLimit, mEFIDisable, mFrequency, mFuelInjector, PWM4, PWM5, PikeAero::CBinaryInputOutputGPIO::reset(), PikeAero::CBinaryInputOutputGPIO::set(), PikeAero::ITask::setFault(), PikeAero::ITask::setSleeping(), PikeAero::CBinaryInputOutputPWM::start(), PikeAero::CEvent::Tick, TIM0, TIM1, TIM2, TIM3, TIM4, TIM5, TIM6, TIM7, PikeAero::CMachine::Vector_PWM4, PikeAero::CMachine::Vector_PWM5, PikeAero::CMachine::Vector_TIM0, PikeAero::CMachine::Vector_TIM1, PikeAero::CMachine::Vector_TIM2, PikeAero::CMachine::Vector_TIM3, PikeAero::CMachine::Vector_TIM4, PikeAero::CMachine::Vector_TIM5, PikeAero::CMachine::Vector_TIM6, and PikeAero::CMachine::Vector_TIM7.

00044 {
00045     setSleeping(true);
00046 
00047     mAggregator = (CTaskAggregator*)CTaskScheduler::find("CTaskAggregator");
00048     if ( mAggregator == NULL )
00049     {
00050         setFault(CMachine::FaultNULLPtr);
00051     }
00052 
00053     /* Disable EFI outputs - we don't want to apply anything to the final outputs until we're all set up. */
00054     mEFIDisable = new CBinaryInputOutputGPIO( GPIO5, GPIO_PIN_8 );
00055     mEFIDisable->set();
00056 
00057     /* Start up current limiting PWMs @ 16 KHz @ 50% duty cycle */
00058     mCurrentLimit[0] = new CBinaryInputOutputPWM( CMachine::Vector_PWM4, PWM4, 16000, 50 );
00059     mCurrentLimit[1] = new CBinaryInputOutputPWM( CMachine::Vector_PWM5, PWM5, 16000, 50 );
00060     mCurrentLimit[0]->start();
00061     mCurrentLimit[1]->start();
00062 
00063     mFuelInjector[0] = new CFuelInjector( CMachine::Vector_TIM0, TIM0, GPIO1, GPIO_PIN_8,  false, false, mFrequency );
00064     mFuelInjector[1] = new CFuelInjector( CMachine::Vector_TIM1, TIM1, GPIO1, GPIO_PIN_7,  false, false, mFrequency );
00065     mFuelInjector[2] = new CFuelInjector( CMachine::Vector_TIM2, TIM2, GPIO0, GPIO_PIN_1,  false, false, mFrequency );
00066     mFuelInjector[3] = new CFuelInjector( CMachine::Vector_TIM3, TIM3, GPIO0, GPIO_PIN_15, false, false, mFrequency );
00067     mFuelInjector[4] = new CFuelInjector( CMachine::Vector_TIM4, TIM4, GPIO1, GPIO_PIN_0,  false, false, mFrequency );
00068     mFuelInjector[5] = new CFuelInjector( CMachine::Vector_TIM5, TIM5, GPIO0, GPIO_PIN_4,  false, false, mFrequency );
00069     mFuelInjector[6] = new CFuelInjector( CMachine::Vector_TIM6, TIM6, GPIO0, GPIO_PIN_8,  false, false, mFrequency );
00070     mFuelInjector[7] = new CFuelInjector( CMachine::Vector_TIM7, TIM7, GPIO0, GPIO_PIN_10, false, false, mFrequency );
00071 
00072     CEventQueue::installListener(this,CEvent::Tick);
00073 
00074     /* Enable EFI outputs */
00075     mEFIDisable->reset();
00076 
00077     return 0;
00078 }

Here is the call graph for this function:

CMachine::bit32 PikeAero::CTaskFuelInjection::stop (  )  [virtual]

The CTaskScheduler will call the stop() method after the task was scheduled for cancelation.

The CTaskScheduler will call the stop () method after the task was scheduled for cancelation.

Returns:
0 on success.

Reimplemented from PikeAero::ITask.

Definition at line 84 of file ctaskfuelinjection.cpp.

References mCurrentLimit, mEFIDisable, mFuelInjector, PikeAero::CEventQueue::removeListener(), PikeAero::ITask::setSleeping(), and PikeAero::CEvent::Tick.

00085 {
00086     setSleeping(true);
00087 
00088     CEventQueue::removeListener(this,CEvent::Tick);
00089 
00090     for( CMachine::ubit32 n=0; n < 8; n++ )
00091     {
00092         if ( mFuelInjector[n] != NULL )
00093         {
00094             delete mFuelInjector[n];
00095             mFuelInjector[n] = NULL;
00096         }
00097     }
00098 
00099     delete mCurrentLimit[0];
00100     delete mCurrentLimit[1];
00101     mCurrentLimit[0] = NULL;
00102     mCurrentLimit[1] = NULL;
00103 
00104     delete mEFIDisable;
00105     mEFIDisable = NULL;
00106 
00107     return 0;
00108 }

Here is the call graph for this function:


Field Documentation

Definition at line 76 of file ctaskfuelinjection.h.

Referenced by run(), and start().

Definition at line 77 of file ctaskfuelinjection.h.

Referenced by start(), and stop().

Definition at line 78 of file ctaskfuelinjection.h.

Referenced by start(), and stop().

Definition at line 75 of file ctaskfuelinjection.h.

Referenced by start().

Definition at line 74 of file ctaskfuelinjection.h.

Referenced by start(), and stop().


The documentation for this class was generated from the following files:

Generated on Sun Oct 25 14:00:26 2009 for stingray3 by  doxygen 1.5.8