Default to applyPinState (#1219)
* make applyPinState default * consumers * format
This commit is contained in:
parent
6f5a9760ed
commit
2349d74f0b
|
@ -123,7 +123,7 @@ static void turnAuxPidOn(int index) {
|
||||||
&engine->executor,
|
&engine->executor,
|
||||||
engineConfiguration->auxPidPins[index],
|
engineConfiguration->auxPidPins[index],
|
||||||
&instances[index].auxOutputPin,
|
&instances[index].auxOutputPin,
|
||||||
engineConfiguration->auxPidFrequency[index], 0.1, (pwm_gen_callback*)applyPinState);
|
engineConfiguration->auxPidFrequency[index], 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startAuxPins(void) {
|
void startAuxPins(void) {
|
||||||
|
|
|
@ -160,8 +160,7 @@ static void turnBoostPidOn() {
|
||||||
CONFIG(boostControlPin),
|
CONFIG(boostControlPin),
|
||||||
&enginePins.boostPin,
|
&enginePins.boostPin,
|
||||||
engineConfiguration->boostPwmFrequency,
|
engineConfiguration->boostPwmFrequency,
|
||||||
0.5f,
|
0.5f
|
||||||
(pwm_gen_callback*) applyPinState
|
|
||||||
);
|
);
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,24 +65,21 @@ public:
|
||||||
executor,
|
executor,
|
||||||
&m_pinEnable,
|
&m_pinEnable,
|
||||||
clampedFrequency,
|
clampedFrequency,
|
||||||
0,
|
0
|
||||||
(pwm_gen_callback*)applyPinState
|
|
||||||
);
|
);
|
||||||
|
|
||||||
startSimplePwm(&m_pwmDir1, "ETB Dir 1",
|
startSimplePwm(&m_pwmDir1, "ETB Dir 1",
|
||||||
executor,
|
executor,
|
||||||
&m_pinDir1,
|
&m_pinDir1,
|
||||||
clampedFrequency,
|
clampedFrequency,
|
||||||
0,
|
0
|
||||||
(pwm_gen_callback*)applyPinState
|
|
||||||
);
|
);
|
||||||
|
|
||||||
startSimplePwm(&m_pwmDir2, "ETB Dir 2",
|
startSimplePwm(&m_pwmDir2, "ETB Dir 2",
|
||||||
executor,
|
executor,
|
||||||
&m_pinDir2,
|
&m_pinDir2,
|
||||||
clampedFrequency,
|
clampedFrequency,
|
||||||
0,
|
0
|
||||||
(pwm_gen_callback*)applyPinState
|
|
||||||
);
|
);
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,18 +31,18 @@ static void startPwmTest(int freq) {
|
||||||
engine->isRunningPwmTest = true;
|
engine->isRunningPwmTest = true;
|
||||||
|
|
||||||
// PD13 pin is initialized elsewhere already
|
// PD13 pin is initialized elsewhere already
|
||||||
startSimplePwm(&pwmTest[0], "tester", &warningLedPin, 10, 0.5f, applyPinState);
|
startSimplePwm(&pwmTest[0], "tester", &warningLedPin, 10, 0.5f);
|
||||||
/**
|
/**
|
||||||
* See custom_engine.cpp for pinout
|
* See custom_engine.cpp for pinout
|
||||||
*/
|
*/
|
||||||
// currently this is PB9 by default - see CONFIG(injectionPins)
|
// currently this is PB9 by default - see CONFIG(injectionPins)
|
||||||
startSimplePwm(&pwmTest[1], "tester", &enginePins.injectors[0], freq / 1.3333333333, 0.5f, applyPinState);
|
startSimplePwm(&pwmTest[1], "tester", &enginePins.injectors[0], freq / 1.3333333333, 0.5f);
|
||||||
// currently this is PE2 by default
|
// currently this is PE2 by default
|
||||||
startSimplePwm(&pwmTest[2], "tester", &enginePins.injectors[1], freq / 1000, 0.5f, applyPinState);
|
startSimplePwm(&pwmTest[2], "tester", &enginePins.injectors[1], freq / 1000, 0.5f);
|
||||||
// currently this is PB8 by default
|
// currently this is PB8 by default
|
||||||
startSimplePwm(&pwmTest[3], "tester", &enginePins.injectors[2], freq, 0.5, applyPinState);
|
startSimplePwm(&pwmTest[3], "tester", &enginePins.injectors[2], freq, 0.5);
|
||||||
// currently this is PB7 by default
|
// currently this is PB7 by default
|
||||||
startSimplePwm(&pwmTest[4], "tester", &enginePins.injectors[3], freq / 33.33333333333, 0.5, applyPinState);
|
startSimplePwm(&pwmTest[4], "tester", &enginePins.injectors[3], freq / 33.33333333333, 0.5);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -693,7 +693,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
} else {
|
} else {
|
||||||
startSimplePwmExt(&fsioPwm[i], "FSIOpwm",
|
startSimplePwmExt(&fsioPwm[i], "FSIOpwm",
|
||||||
&engine->executor,
|
&engine->executor,
|
||||||
brainPin, &enginePins.fsioOutputs[i], frequency, 0.5f, (pwm_gen_callback*)applyPinState);
|
brainPin, &enginePins.fsioOutputs[i], frequency, 0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,4 +373,3 @@ void applyPinState(int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
|
||||||
output->setValue(value);
|
output->setValue(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,12 @@ private:
|
||||||
SingleChannelStateSequence waveInstance;
|
SingleChannelStateSequence waveInstance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default implementation of pwm_gen_callback which simply toggles the pins
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void applyPinState(int stateIndex, PwmConfig* state) /* pwm_gen_callback */;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a one-channel software PWM driver.
|
* Start a one-channel software PWM driver.
|
||||||
*
|
*
|
||||||
|
@ -133,7 +139,7 @@ private:
|
||||||
void startSimplePwm(SimplePwm *state, const char *msg,
|
void startSimplePwm(SimplePwm *state, const char *msg,
|
||||||
ExecutorInterface *executor,
|
ExecutorInterface *executor,
|
||||||
OutputPin *output,
|
OutputPin *output,
|
||||||
float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback);
|
float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback = (pwm_gen_callback*)applyPinState);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize GPIO pin and start a one-channel software PWM driver.
|
* initialize GPIO pin and start a one-channel software PWM driver.
|
||||||
|
@ -144,7 +150,7 @@ void startSimplePwmExt(SimplePwm *state,
|
||||||
const char *msg,
|
const char *msg,
|
||||||
ExecutorInterface *executor,
|
ExecutorInterface *executor,
|
||||||
brain_pin_e brainPin, OutputPin *output,
|
brain_pin_e brainPin, OutputPin *output,
|
||||||
float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback);
|
float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback = (pwm_gen_callback*)applyPinState);
|
||||||
|
|
||||||
void copyPwmParameters(PwmConfig *state, int phaseCount, float const *switchTimes,
|
void copyPwmParameters(PwmConfig *state, int phaseCount, float const *switchTimes,
|
||||||
int waveCount, pin_state_t *const *pinStates);
|
int waveCount, pin_state_t *const *pinStates);
|
||||||
|
|
|
@ -15,10 +15,3 @@
|
||||||
#include "efi_gpio.h"
|
#include "efi_gpio.h"
|
||||||
|
|
||||||
void initPwmGenerator(void);
|
void initPwmGenerator(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* default implementation of pwm_gen_callback which simply toggles the pins
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void applyPinState(int stateIndex, PwmConfig* state) /* pwm_gen_callback */;
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue