auto-sync

This commit is contained in:
rusEfi 2015-01-07 19:04:09 -06:00
parent 6d7b802996
commit 2bb32d8228
10 changed files with 18 additions and 24 deletions

View File

@ -367,7 +367,9 @@ static OutputPin *leds[] = { &warningPin, &runningPin,
* This method would blink all the LEDs just to test them
*/
static void initialLedsBlink(void) {
#if EFI_PROD_CODE
outputPinRegister("communication status 1", &communicationPin, LED_COMMUNICATION_PORT, LED_COMMUNICATION_PIN);
#endif
#if EFI_WARNING_LED
outputPinRegister("warning", &warningPin, LED_WARNING_PORT, LED_WARNING_PIN);

View File

@ -53,8 +53,6 @@ case GPIO_9:
return "GPIO_9";
case HIP9011_INT_HOLD:
return "HIP9011_INT_HOLD";
case IDLE_VALVE:
return "IDLE_VALVE";
case INJECTOR_10_OUTPUT:
return "INJECTOR_10_OUTPUT";
case INJECTOR_11_OUTPUT:
@ -123,8 +121,6 @@ case LED_HUGE_8:
return "LED_HUGE_8";
case LED_HUGE_9:
return "LED_HUGE_9";
case LED_TRIGGER_ERROR:
return "LED_TRIGGER_ERROR";
case MAIN_RELAY:
return "MAIN_RELAY";
case O2_HEATER:

View File

@ -63,12 +63,6 @@ typedef enum {
IO_INVALID,
LED_TRIGGER_ERROR,
/**
* see board_configuration_s->idleValvePin
*/
IDLE_VALVE,
TRIGGER_EMULATOR_PRIMARY,
TRIGGER_EMULATOR_SECONDARY,
TRIGGER_EMULATOR_3RD,

View File

@ -339,7 +339,7 @@ void initFsioImpl(Engine *engine) {
if (frequency == 0) {
outputPinRegisterExt2(getPinName(pin), &outputs[(int)pin], boardConfiguration->fsioPins[i], &defa);
} else {
startSimplePwmExt(&fsioPwm[i], "FSIO", brainPin, pin, frequency, 0.5f, applyPinState);
startSimplePwmExt(&fsioPwm[i], "FSIO", brainPin, &outputs[(int)pin], frequency, 0.5f, applyPinState);
}
}
}

View File

@ -40,6 +40,7 @@ static Logging logger;
EXTERN_ENGINE
;
static OutputPin idlePin;
static SimplePwm idleValvePwm;
/**
@ -134,7 +135,7 @@ void startIdleThread(Engine *engine) {
/**
* Start PWM for IDLE_VALVE logical / idleValvePin physical
*/
startSimplePwmExt(&idleValvePwm, "Idle Valve", boardConfiguration->idleValvePin, IDLE_VALVE,
startSimplePwmExt(&idleValvePwm, "Idle Valve", boardConfiguration->idleValvePin, &idlePin,
boardConfiguration->idleSolenoidFrequency, boardConfiguration->idleSolenoidPwm, applyIdleSolenoidPinState);
idle.init();

View File

@ -35,6 +35,8 @@
#include "efiGpio.h"
#include "engine.h"
static OutputPin triggerDecoderErrorPin;
EXTERN_ENGINE
;
@ -191,7 +193,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, uint64_t now
|| eventCount[1] != TRIGGER_SHAPE(expectedEventCount[1])
|| eventCount[2] != TRIGGER_SHAPE(expectedEventCount[2]);
setOutputPinValue(LED_TRIGGER_ERROR, isDecodingError);
triggerDecoderErrorPin.setValue(isDecodingError);
if (isDecodingError) {
totalTriggerErrorCounter++;
if (engineConfiguration->isPrintTriggerSynchDetails) {
@ -444,6 +446,8 @@ uint32_t findTriggerZeroEventIndex(trigger_shape_s * shape, trigger_config_s con
void initTriggerDecoder(void) {
#if (EFI_PROD_CODE || EFI_SIMULATOR)
outputPinRegisterExt2("trg_err", &triggerDecoderErrorPin, boardConfiguration->triggerErrorPin, &boardConfiguration->triggerErrorPinMode);
initLogging(&logger, "trigger decoder");
#endif
}

View File

@ -136,7 +136,6 @@ void initOutputPins(void) {
outputPinRegisterExt2("fan relay", &outputs[(int)FAN_RELAY], boardConfiguration->fanPin, &DEFAULT_OUTPUT);
outputPinRegisterExt2("o2 heater", &outputs[(int)O2_HEATER], boardConfiguration->o2heaterPin, &DEFAULT_OUTPUT);
outputPinRegisterExt2("trg_err", &outputs[(int)LED_TRIGGER_ERROR], boardConfiguration->triggerErrorPin, &boardConfiguration->triggerErrorPinMode);
outputPinRegisterExt2("A/C relay", &outputs[(int)AC_RELAY], boardConfiguration->acRelayPin, &boardConfiguration->acRelayPinMode);
// digit 1

View File

@ -35,7 +35,7 @@ void applyPinState(PwmConfig *state, int stateIndex) {
}
}
void startSimplePwm(PwmConfig *state, const char *msg, io_pin_e ioPin, float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback) {
void startSimplePwm(PwmConfig *state, const char *msg, OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback) {
efiAssertVoid(dutyCycle >= 0 && dutyCycle <= 1, "dutyCycle");
float switchTimes[] = { dutyCycle, 1 };
@ -43,22 +43,20 @@ void startSimplePwm(PwmConfig *state, const char *msg, io_pin_e ioPin, float fre
int *pinStates[1] = { pinStates0 };
state->outputPins[0] = &outputs[(int)ioPin];
state->outputPins[0] = output;
state->periodNt = US2NT(frequency2periodUs(frequency));
weComplexInit(msg, state, 2, switchTimes, 1, pinStates, NULL, stateChangeCallback);
}
extern OutputPin outputs[IO_PIN_COUNT];
void startSimplePwmExt(PwmConfig *state, const char *msg, brain_pin_e brainPin, io_pin_e ioPin, float frequency,
void startSimplePwmExt(PwmConfig *state, const char *msg, brain_pin_e brainPin, OutputPin *output, float frequency,
float dutyCycle, pwm_gen_callback *stateChangeCallback) {
GPIO_TypeDef * port = getHwPort(brainPin);
int pin = getHwPin(brainPin);
outputPinRegister(msg, &outputs[ioPin], port, pin);
outputPinRegister(msg, output, port, pin);
startSimplePwm(state, msg, ioPin, frequency, dutyCycle, stateChangeCallback);
startSimplePwm(state, msg, output, frequency, dutyCycle, stateChangeCallback);
}
void initPwmGenerator(void) {

View File

@ -15,13 +15,13 @@
#include "gpio_helper.h"
void startSimplePwm(PwmConfig *state, const char *msg, io_pin_e ioPin,
void startSimplePwm(PwmConfig *state, const char *msg, OutputPin *output,
float dutyCycle, float frequency, pwm_gen_callback *stateChangeCallback);
void applyPinState(PwmConfig *state, int stateIndex);
void initPwmGenerator(void);
void startSimplePwmExt(PwmConfig *state, const char *msg, brain_pin_e brainPin, io_pin_e ioPin,
void startSimplePwmExt(PwmConfig *state, const char *msg, brain_pin_e brainPin, OutputPin *output,
float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback);
#endif /* PWM_GENERATOR_H_ */

View File

@ -46,7 +46,7 @@ engine_configuration_s * engineConfiguration = &persistentState.persistentConfig
board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc;
engine_configuration2_s *engineConfiguration2 = &ec2;
void setOutputPinValue(io_pin_e pin, int logicValue) {
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode) {
}
int isInjectionEnabled(void) {