PWM docs
This commit is contained in:
parent
f2752a1b1d
commit
0112bd8237
|
@ -48,9 +48,11 @@ void PwmConfig::init(float *st, single_wave_s *waves) {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method allows you to change duty cycle on the fly
|
||||
* @param dutyCycle value between 0 and 1
|
||||
*/
|
||||
void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
|
||||
efiAssertVoid(dutyCycle >= 0 && dutyCycle <= 1, "spwd:dutyCycle");
|
||||
multiWave.setSwitchTime(0, dutyCycle);
|
||||
}
|
||||
|
||||
|
@ -76,6 +78,11 @@ static efitimeus_t getNextSwitchTimeUs(PwmConfig *state) {
|
|||
}
|
||||
|
||||
void PwmConfig::setFrequency(float frequency) {
|
||||
if (cisnan(frequency)) {
|
||||
// explicit code just to be sure
|
||||
periodNt = NAN;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* see #handleCycleStart()
|
||||
*/
|
||||
|
@ -102,6 +109,10 @@ void PwmConfig::handleCycleStart() {
|
|||
}
|
||||
}
|
||||
|
||||
efitimeus_t PwmConfig::togglePwmState() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Next time for signal toggle
|
||||
*/
|
||||
|
|
|
@ -50,6 +50,9 @@ public:
|
|||
pwm_cycle_callback *cycleCallback,
|
||||
pwm_gen_callback *callback);
|
||||
|
||||
/**
|
||||
* @param use NAN frequency to pause PWM
|
||||
*/
|
||||
void setFrequency(float frequency);
|
||||
|
||||
void handleCycleStart();
|
||||
|
@ -59,9 +62,10 @@ public:
|
|||
multi_wave_s multiWave;
|
||||
/**
|
||||
* float value of PWM period
|
||||
* PWM generation is not happening while this value is zero
|
||||
* PWM generation is not happening while this value is NAN
|
||||
*/
|
||||
float periodNt;
|
||||
efitimeus_t togglePwmState();
|
||||
|
||||
int dbgNestingLevel;
|
||||
|
||||
|
|
Loading…
Reference in New Issue