#include <cbinaryinputoutputpwm.h>


Public Member Functions | |
| CBinaryInputOutputPWM (CMachine::InterruptVector vector, PWM_TypeDef *PWMx, CMachine::ubit32 freqency=16000, CMachine::ubit32 dutyCycle=50) | |
| PWM_TypeDef * | pwm () |
| bool | running () |
| Is the pwm running. | |
| CMachine::ubit16 | setDutyCycle (CMachine::ubit32 dutyCycle=50) |
| Calculate the duty cycle from percent. (default 50 percent). | |
| CMachine::ubit16 | setFrequency (CMachine::ubit32 frequency=16000) |
| Calculate the prescaler requred to get the target frequency. Default is 16 KHz. | |
| void | start () |
| Start the pwm. | |
| void | stop () |
| Stop the pwm. | |
| virtual | ~CBinaryInputOutputPWM () |
Private Attributes | |
| PWM_TypeDef * | mPWM |
Definition at line 31 of file cbinaryinputoutputpwm.h.
| PikeAero::CBinaryInputOutputPWM::CBinaryInputOutputPWM | ( | CMachine::InterruptVector | vector, | |
| PWM_TypeDef * | PWMx, | |||
| CMachine::ubit32 | freqency = 16000, |
|||
| CMachine::ubit32 | dutyCycle = 50 | |||
| ) |
Set the Prescaler
Set the duty cycle
Definition at line 24 of file cbinaryinputoutputpwm.cpp.
References PikeAero::PWM_TypeDef::IM, PikeAero::PWM_TypeDef::PEN, PikeAero::PWM_TypeDef::PLS, pwm(), setDutyCycle(), and setFrequency().
00030 : CObject() 00031 , mPWM(PWMx) 00032 { 00033 /* Diable the PWM */ 00034 pwm()->PEN = 0; 00035 /* Initialize output polarity */ 00036 pwm()->PLS = 0; 00037 /* Disable interrupts */ 00038 pwm()->IM = 0; 00039 /** Set the Prescaler */ 00040 setFrequency( frequency ); 00041 /** Set the duty cycle */ 00042 setDutyCycle( dutyCycle ); 00043 }

| PikeAero::CBinaryInputOutputPWM::~CBinaryInputOutputPWM | ( | ) | [virtual] |
| PWM_TypeDef* PikeAero::CBinaryInputOutputPWM::pwm | ( | ) | [inline] |
Definition at line 42 of file cbinaryinputoutputpwm.h.
References mPWM.
Referenced by CBinaryInputOutputPWM(), running(), setDutyCycle(), setFrequency(), start(), and stop().
00042 {return mPWM;}

| bool PikeAero::CBinaryInputOutputPWM::running | ( | ) | [inline] |
| CMachine::ubit16 PikeAero::CBinaryInputOutputPWM::setDutyCycle | ( | CMachine::ubit32 | dutyCycle = 50 |
) |
Calculate the duty cycle from percent. (default 50 percent).
Calculate the duty cycle from percent.
Definition at line 66 of file cbinaryinputoutputpwm.cpp.
References PikeAero::PWM_TypeDef::DUT, PikeAero::PWM_TypeDef::PER, and pwm().
Referenced by CBinaryInputOutputPWM().
00067 { 00068 pwm()->DUT = (CMachine::ubit16)(pwm()->PER / (CMachine::real)( 100.0 / dutyCycle )); 00069 return pwm()->DUT; 00070 }


| CMachine::ubit16 PikeAero::CBinaryInputOutputPWM::setFrequency | ( | CMachine::ubit32 | frequency = 16000 |
) |
Calculate the prescaler requred to get the target frequency. Default is 16 KHz.
| frequency | The target frequency expressed in Hz. |
Definition at line 55 of file cbinaryinputoutputpwm.cpp.
References PikeAero::PWM_TypeDef::PER, PikeAero::PWM_TypeDef::PRS0, PikeAero::PWM_TypeDef::PRS1, pwm(), PWM_PR0, and PWM_PR1.
Referenced by CBinaryInputOutputPWM().
00056 { 00057 pwm()->PRS0 = PWM_PR0(0); /* (32 MHz / 1) = 32 MHz */ 00058 pwm()->PRS1 = PWM_PR1(1); /* 32 MHz / 2 = 16 MHz */ 00059 pwm()->PER = (128000 / frequency); /* 16 MHz / frequency */ 00060 return pwm()->PER; 00061 }


| void PikeAero::CBinaryInputOutputPWM::start | ( | ) | [inline] |
Start the pwm.
Definition at line 45 of file cbinaryinputoutputpwm.h.
References PikeAero::PWM_TypeDef::PEN, pwm(), and PWM_PE.
Referenced by PikeAero::CTaskFuelInjection::start().


| void PikeAero::CBinaryInputOutputPWM::stop | ( | ) | [inline] |
Stop the pwm.
Definition at line 48 of file cbinaryinputoutputpwm.h.
References PikeAero::PWM_TypeDef::PEN, pwm(), and PWM_PE.

PWM_TypeDef* PikeAero::CBinaryInputOutputPWM::mPWM [private] |
1.5.8