rusEFI
The most advanced open source ECU
|
This PWM implementation keep track of when it would be the next time to toggle the signal. It constantly sets timer to that next toggle time, then sets the timer again from the callback, and so on.
Definition in file pwm_generator_logic.cpp.
Functions | |
static efitick_t | getNextSwitchTimeNt (PwmConfig *state) |
static void | timerCallback (PwmConfig *state) |
void | copyPwmParameters (PwmConfig *state, MultiChannelStateSequence const *seq) |
void | startSimplePwm (SimplePwm *state, const char *msg, Scheduler *executor, OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *callback) |
void | startSimplePwmExt (SimplePwm *state, const char *msg, Scheduler *executor, brain_pin_e brainPin, OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *callback) |
void | startSimplePwmHard (SimplePwm *state, const char *msg, Scheduler *executor, brain_pin_e brainPin, OutputPin *output, float frequency, float dutyCycle) |
void | applyPinState (int stateIndex, PwmConfig *state) |
void applyPinState | ( | int | stateIndex, |
PwmConfig * | state | ||
) |
This method controls the actual hardware pins
Definition at line 403 of file pwm_generator_logic.cpp.
Referenced by emulatorApplyPinState(), and startSimplePwm().
void copyPwmParameters | ( | PwmConfig * | state, |
MultiChannelStateSequence const * | seq | ||
) |
Incoming parameters are potentially just values on current stack, so we have to copy into our own permanent storage, right?
Definition at line 279 of file pwm_generator_logic.cpp.
Referenced by updateTriggerWaveformIfNeeded(), and PwmConfig::weComplexInit().
|
static |
returns absolute timestamp of state change
Once 'iteration' gets relatively high, we might lose calculation precision here. This is addressed by iterationLimit below, using any many cycles as possible without overflowing timeToSwitchNt Shall we reuse 'sumTickAndFloat' here?
Definition at line 96 of file pwm_generator_logic.cpp.
Referenced by PwmConfig::togglePwmState().
void startSimplePwm | ( | SimplePwm * | state, |
const char * | msg, | ||
Scheduler * | executor, | ||
OutputPin * | output, | ||
float | frequency, | ||
float | dutyCycle, | ||
pwm_gen_callback * | callback = NULL |
||
) |
Start a one-channel software PWM driver.
This method should be called after scheduling layer is started by initSignalExecutor()
Definition at line 315 of file pwm_generator_logic.cpp.
Referenced by applyIACposition(), TachometerModule::init(), Generic4TransmissionController::init(), Gm4l6xTransmissionController::init(), initAlternatorCtrl(), initGpPwm(), initSpeedometer(), startBoostPin(), and startSimplePwmExt().
void startSimplePwmExt | ( | SimplePwm * | state, |
const char * | msg, | ||
Scheduler * | executor, | ||
brain_pin_e | brainPin, | ||
OutputPin * | output, | ||
float | frequency, | ||
float | dutyCycle, | ||
pwm_gen_callback * | callback = NULL |
||
) |
initialize GPIO pin and start a one-channel software PWM driver.
This method should be called after scheduling layer is started by initSignalExecutor()
Definition at line 361 of file pwm_generator_logic.cpp.
Referenced by startPwm(), startSimplePwmHard(), and turnVvtPidOn().
void startSimplePwmHard | ( | SimplePwm * | state, |
const char * | msg, | ||
Scheduler * | executor, | ||
brain_pin_e | brainPin, | ||
OutputPin * | output, | ||
float | frequency, | ||
float | dutyCycle | ||
) |
dutyCycle | value between 0 and 1 |
Definition at line 374 of file pwm_generator_logic.cpp.
Referenced by initVrThresholdPwm(), and DcHardware::start().
|
static |
Main PWM loop: toggle pin & schedule next invocation
First invocation happens on application thread
Definition at line 255 of file pwm_generator_logic.cpp.
Referenced by PwmConfig::weComplexInit().