smarter PWM API - need to pass arbitrary pointer
This commit is contained in:
parent
cad2297a72
commit
54f83a431e
|
@ -124,7 +124,7 @@ void setAltPFactor(float p) {
|
||||||
showAltInfo();
|
showAltInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applyAlternatorPinState(PwmConfig *state, int stateIndex, PwmConfig *arg) /* pwm_gen_callback */ {
|
static void applyAlternatorPinState(PwmConfig *unused, int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
|
||||||
efiAssertVoid(CUSTOM_ERR_6643, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
|
efiAssertVoid(CUSTOM_ERR_6643, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
|
||||||
efiAssertVoid(CUSTOM_IDLE_WAVE_CNT, state->multiWave.waveCount == 1, "invalid idle waveCount");
|
efiAssertVoid(CUSTOM_IDLE_WAVE_CNT, state->multiWave.waveCount == 1, "invalid idle waveCount");
|
||||||
OutputPin *output = state->outputPins[0];
|
OutputPin *output = state->outputPins[0];
|
||||||
|
|
|
@ -119,7 +119,7 @@ static void turnAuxPidOn(int index) {
|
||||||
&engine->executor,
|
&engine->executor,
|
||||||
engineConfiguration->auxPidPins[index],
|
engineConfiguration->auxPidPins[index],
|
||||||
&auxPidPin[0],
|
&auxPidPin[0],
|
||||||
engineConfiguration->auxPidFrequency[index], 0.1, applyPinState);
|
engineConfiguration->auxPidFrequency[index], 0.1, (pwm_gen_callback*)applyPinState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startAuxPins(void) {
|
void startAuxPins(void) {
|
||||||
|
|
|
@ -115,7 +115,7 @@ public:
|
||||||
&etbOutput,
|
&etbOutput,
|
||||||
freq,
|
freq,
|
||||||
0.80,
|
0.80,
|
||||||
applyPinState);
|
(pwm_gen_callback*)applyPinState);
|
||||||
outputDirectionOpen.initPin("etb dir open", directionPin1);
|
outputDirectionOpen.initPin("etb dir open", directionPin1);
|
||||||
outputDirectionClose.initPin("etb dir close", directionPin2);
|
outputDirectionClose.initPin("etb dir close", directionPin2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -449,7 +449,7 @@ void setDefaultIdleParameters(void) {
|
||||||
engineConfiguration->idleRpmPid.periodMs = 10;
|
engineConfiguration->idleRpmPid.periodMs = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applyIdleSolenoidPinState(PwmConfig *state, int stateIndex, void *arg) /* pwm_gen_callback */ {
|
static void applyIdleSolenoidPinState(PwmConfig *unused, int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
|
||||||
efiAssertVoid(CUSTOM_ERR_6645, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
|
efiAssertVoid(CUSTOM_ERR_6645, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
|
||||||
efiAssertVoid(CUSTOM_ERR_6646, state->multiWave.waveCount == 1, "invalid idle waveCount");
|
efiAssertVoid(CUSTOM_ERR_6646, state->multiWave.waveCount == 1, "invalid idle waveCount");
|
||||||
OutputPin *output = state->outputPins[0];
|
OutputPin *output = state->outputPins[0];
|
||||||
|
@ -480,7 +480,7 @@ static void initIdleHardware() {
|
||||||
&engine->executor,
|
&engine->executor,
|
||||||
CONFIGB(idle).solenoidPin, &enginePins.idleSolenoidPin,
|
CONFIGB(idle).solenoidPin, &enginePins.idleSolenoidPin,
|
||||||
CONFIGB(idle).solenoidFrequency, CONFIGB(manIdlePosition) / 100,
|
CONFIGB(idle).solenoidFrequency, CONFIGB(manIdlePosition) / 100,
|
||||||
applyIdleSolenoidPinState);
|
(pwm_gen_callback*)applyIdleSolenoidPinState);
|
||||||
idlePositionSensitivityThreshold = 0.0f;
|
idlePositionSensitivityThreshold = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -665,7 +665,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, applyPinState);
|
brainPin, &enginePins.fsioOutputs[i], frequency, 0.5f, (pwm_gen_callback*)applyPinState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,7 @@ void startSimplePwmExt(SimplePwm *state, const char *msg,
|
||||||
*
|
*
|
||||||
* This method takes ~350 ticks.
|
* This method takes ~350 ticks.
|
||||||
*/
|
*/
|
||||||
void applyPinState(PwmConfig *state, int stateIndex, void *arg) /* pwm_gen_callback */ {
|
void applyPinState(PwmConfig *unused, int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
|
||||||
efiAssertVoid(CUSTOM_ERR_6663, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
|
efiAssertVoid(CUSTOM_ERR_6663, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
|
||||||
efiAssertVoid(CUSTOM_ERR_6664, state->multiWave.waveCount <= PWM_PHASE_MAX_WAVE_PER_PWM, "invalid waveCount");
|
efiAssertVoid(CUSTOM_ERR_6664, state->multiWave.waveCount <= PWM_PHASE_MAX_WAVE_PER_PWM, "invalid waveCount");
|
||||||
for (int channelIndex = 0; channelIndex < state->multiWave.waveCount; channelIndex++) {
|
for (int channelIndex = 0; channelIndex < state->multiWave.waveCount; channelIndex++) {
|
||||||
|
|
|
@ -133,7 +133,7 @@ static void updateTriggerShapeIfNeeded(PwmConfig *state) {
|
||||||
|
|
||||||
static TriggerEmulatorHelper helper;
|
static TriggerEmulatorHelper helper;
|
||||||
|
|
||||||
static void emulatorApplyPinState(PwmConfig *state, int stateIndex, void *arg) /* pwm_gen_callback */ {
|
static void emulatorApplyPinState(PwmConfig *unused, int stateIndex, PwmConfig *state) /* pwm_gen_callback */ {
|
||||||
if (stopEmulationAtIndex == stateIndex) {
|
if (stopEmulationAtIndex == stateIndex) {
|
||||||
isEmulating = false;
|
isEmulating = false;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ static void emulatorApplyPinState(PwmConfig *state, int stateIndex, void *arg) /
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
applyPinState(state, stateIndex, arg);
|
applyPinState(unused, stateIndex, state);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
if (engineConfiguration->directSelfStimulation) {
|
if (engineConfiguration->directSelfStimulation) {
|
||||||
/**
|
/**
|
||||||
|
@ -172,7 +172,7 @@ void initTriggerEmulatorLogic(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUF
|
||||||
triggerSignal.weComplexInit("position sensor",
|
triggerSignal.weComplexInit("position sensor",
|
||||||
&engine->executor,
|
&engine->executor,
|
||||||
s->getSize(), s->wave.switchTimes, PWM_PHASE_MAX_WAVE_PER_PWM,
|
s->getSize(), s->wave.switchTimes, PWM_PHASE_MAX_WAVE_PER_PWM,
|
||||||
pinStates, updateTriggerShapeIfNeeded, emulatorApplyPinState);
|
pinStates, updateTriggerShapeIfNeeded, (pwm_gen_callback*)emulatorApplyPinState);
|
||||||
|
|
||||||
addConsoleActionI("rpm", setTriggerEmulatorRPM);
|
addConsoleActionI("rpm", setTriggerEmulatorRPM);
|
||||||
addConsoleActionI("stop_stimulator_at_index", setEmulatorAtIndex);
|
addConsoleActionI("stop_stimulator_at_index", setEmulatorAtIndex);
|
||||||
|
|
|
@ -21,6 +21,6 @@ void initPwmGenerator(void);
|
||||||
* default implementation of pwm_gen_callback which simply toggles the pins
|
* default implementation of pwm_gen_callback which simply toggles the pins
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void applyPinState(PwmConfig *state, int stateIndex, void* arg) /* pwm_gen_callback */;
|
void applyPinState(PwmConfig *unused, int stateIndex, PwmConfig* state) /* pwm_gen_callback */;
|
||||||
|
|
||||||
#endif /* PWM_GENERATOR_H_ */
|
#endif /* PWM_GENERATOR_H_ */
|
||||||
|
|
|
@ -561,7 +561,7 @@ void initCJ125(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
scheduleMsg(logger, "cj125: Starting heater control");
|
scheduleMsg(logger, "cj125: Starting heater control");
|
||||||
globalInstance.StartHeaterControl(applyPinState PASS_ENGINE_PARAMETER_SUFFIX);
|
globalInstance.StartHeaterControl((pwm_gen_callback*)applyPinState PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
cjStart(PASS_ENGINE_PARAMETER_SIGNATURE);
|
cjStart(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
#ifdef CJ125_DEBUG
|
#ifdef CJ125_DEBUG
|
||||||
|
|
Loading…
Reference in New Issue