|
rusEFI
The most advanced open source ECU
|
Multi-channel software PWM output configuration. More...
#include <pwm_generator_logic.h>


Public Member Functions | |
| PwmConfig () | |
| void | weComplexInit (Scheduler *executor, MultiChannelStateSequence const *seq, pwm_cycle_callback *pwmCycleCallback, pwm_gen_callback *callback) |
| void | setFrequency (float frequency) |
| void | handleCycleStart () |
| efitick_t | togglePwmState () |
| void | stop () |
| void | applyPwmValue (OutputPin *output, int stateIndex, int channelIndex=0) |
Data Fields | |
| Scheduler * | m_executor = nullptr |
| pwm_mode_e | mode |
| bool | isStopRequested = false |
| const char * | m_name |
| OutputPin * | outputPins [PWM_PHASE_MAX_WAVE_PER_PWM] |
| MultiChannelStateSequence const * | multiChannelStateSequence = nullptr |
| int | dbgNestingLevel |
| scheduling_s | scheduling |
| pwm_config_safe_state_s | safe |
| pwm_cycle_callback * | m_pwmCycleCallback = nullptr |
| pwm_gen_callback * | m_stateChangeCallback = nullptr |
Private Attributes | |
| float | periodNt |
| bool | forceCycleStart = true |
Multi-channel software PWM output configuration.
Definition at line 50 of file pwm_generator_logic.h.
| PwmConfig::PwmConfig | ( | ) |
Definition at line 34 of file pwm_generator_logic.cpp.
| void PwmConfig::applyPwmValue | ( | OutputPin * | output, |
| int | stateIndex, | ||
| int | channelIndex = 0 |
||
| ) |
default implementation of pwm_gen_callback which simply toggles the pins
Definition at line 395 of file pwm_generator_logic.cpp.

| void PwmConfig::handleCycleStart | ( | ) |
period length has changed - we need to reset internal state
Definition at line 136 of file pwm_generator_logic.cpp.
Referenced by togglePwmState().


| void PwmConfig::setFrequency | ( | float | frequency | ) |
| use | NAN frequency to pause PWM |
see handleCycleStart() 'periodNt' is below 10 seconds here so we use 32 bit type for performance reasons
Definition at line 119 of file pwm_generator_logic.cpp.
Referenced by TachometerModule::onFastCallback(), DcHardware::setFrequency(), setTriggerEmulatorRPM(), and speedoUpdate().

| void PwmConfig::stop | ( | ) |
Definition at line 132 of file pwm_generator_logic.cpp.
Referenced by disableTriggerStimulator().

| efitick_t PwmConfig::togglePwmState | ( | ) |
Here is where the 'business logic' - the actual pin state change is happening
Definition at line 177 of file pwm_generator_logic.cpp.

| void PwmConfig::weComplexInit | ( | Scheduler * | executor, |
| MultiChannelStateSequence const * | seq, | ||
| pwm_cycle_callback * | pwmCycleCallback, | ||
| pwm_gen_callback * | stateChangeCallback | ||
| ) |
this method also starts the timer cycle See also startSimplePwm
Definition at line 290 of file pwm_generator_logic.cpp.
Referenced by startSimulatedTriggerSignal().


| int PwmConfig::dbgNestingLevel |
Definition at line 83 of file pwm_generator_logic.h.
Referenced by PwmConfig().
|
private |
Definition at line 106 of file pwm_generator_logic.h.
Referenced by handleCycleStart(), and togglePwmState().
| bool PwmConfig::isStopRequested = false |
Definition at line 66 of file pwm_generator_logic.h.
Referenced by SimplePwm::setSimplePwmDutyCycle(), stop(), togglePwmState(), and weComplexInit().
| Scheduler* PwmConfig::m_executor = nullptr |
Definition at line 60 of file pwm_generator_logic.h.
Referenced by weComplexInit().
| const char* PwmConfig::m_name |
Definition at line 74 of file pwm_generator_logic.h.
Referenced by PwmConfig(), SimplePwm::setSimplePwmDutyCycle(), and SimplePwm::SimplePwm().
| pwm_cycle_callback* PwmConfig::m_pwmCycleCallback = nullptr |
this callback is invoked before each wave generation cycle
Definition at line 92 of file pwm_generator_logic.h.
Referenced by handleCycleStart(), and weComplexInit().
| pwm_gen_callback* PwmConfig::m_stateChangeCallback = nullptr |
this main callback is invoked when it's time to switch level on any of the output channels
Definition at line 97 of file pwm_generator_logic.h.
Referenced by SimplePwm::setSimplePwmDutyCycle(), togglePwmState(), and weComplexInit().
| pwm_mode_e PwmConfig::mode |
We need to handle zero duty cycle and 100% duty cycle in a special way
Definition at line 65 of file pwm_generator_logic.h.
Referenced by PwmConfig(), SimplePwm::setSimplePwmDutyCycle(), and togglePwmState().
| MultiChannelStateSequence const* PwmConfig::multiChannelStateSequence = nullptr |
Definition at line 78 of file pwm_generator_logic.h.
Referenced by applyPwmValue(), and togglePwmState().
| OutputPin* PwmConfig::outputPins[PWM_PHASE_MAX_WAVE_PER_PWM] |
Definition at line 77 of file pwm_generator_logic.h.
Referenced by PwmConfig(), startTriggerEmulatorPins(), and stopTriggerEmulatorPins().
|
private |
float value of PWM period PWM generation is not happening while this value is NAN
Definition at line 103 of file pwm_generator_logic.h.
Referenced by handleCycleStart(), PwmConfig(), setFrequency(), togglePwmState(), and weComplexInit().
| pwm_config_safe_state_s PwmConfig::safe |
Definition at line 87 of file pwm_generator_logic.h.
Referenced by handleCycleStart(), PwmConfig(), togglePwmState(), triggerInfo(), and weComplexInit().
| scheduling_s PwmConfig::scheduling |
Definition at line 85 of file pwm_generator_logic.h.
Referenced by PwmConfig().