de-pointerize outputMode #49
This commit is contained in:
parent
74e2592746
commit
f7e6ccd9e2
|
@ -4,10 +4,10 @@
|
|||
BOARDCPPSRC += $(BOARDS_DIR)/hellen/hellen_common.cpp \
|
||||
$(BOARDS_DIR)/hellen/hellen_board_id.cpp
|
||||
|
||||
DDEFS += -DLED_ERROR_BRAIN_PIN_MODE=INVERTED_OUTPUT
|
||||
DDEFS += -DLED_RUNING_BRAIN_PIN_MODE=INVERTED_OUTPUT
|
||||
DDEFS += -DLED_WARNING_BRAIN_PIN_MODE=INVERTED_OUTPUT
|
||||
DDEFS += -DLED_COMMUNICATION_BRAIN_PIN_MODE=INVERTED_OUTPUT
|
||||
DDEFS += -DLED_ERROR_BRAIN_PIN_MODE=OM_INVERTED
|
||||
DDEFS += -DLED_RUNING_BRAIN_PIN_MODE=OM_INVERTED
|
||||
DDEFS += -DLED_WARNING_BRAIN_PIN_MODE=OM_INVERTED
|
||||
DDEFS += -DLED_COMMUNICATION_BRAIN_PIN_MODE=OM_INVERTED
|
||||
|
||||
# We are running on Hellen-One hardware!
|
||||
DDEFS += -DHW_HELLEN=1
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
#undef LED_CRITICAL_ERROR_BRAIN_PIN
|
||||
#define LED_CRITICAL_ERROR_BRAIN_PIN Gpio::A13
|
||||
#undef LED_ERROR_BRAIN_PIN_MODE
|
||||
#define LED_ERROR_BRAIN_PIN_MODE DEFAULT_OUTPUT
|
||||
#define LED_ERROR_BRAIN_PIN_MODE OM_DEFAULT
|
||||
|
||||
#undef CONSOLE_MODE_SWITCH_PORT
|
||||
#undef CONFIG_RESET_SWITCH_PORT
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
/* LEDs */
|
||||
#undef LED_ERROR_BRAIN_PIN_MODE
|
||||
#define LED_ERROR_BRAIN_PIN_MODE INVERTED_OUTPUT
|
||||
#define LED_ERROR_BRAIN_PIN_MODE OM_DEFAULT
|
||||
#undef LED_WARNING_BRAIN_PIN_MODE
|
||||
#define LED_WARNING_BRAIN_PIN_MODE INVERTED_OUTPUT
|
||||
#define LED_WARNING_BRAIN_PIN_MODE OM_DEFAULT
|
||||
#undef LED_RUNING_BRAIN_PIN_MODE
|
||||
#define LED_RUNING_BRAIN_PIN_MODE INVERTED_OUTPUT
|
||||
#define LED_RUNING_BRAIN_PIN_MODE OM_DEFAULT
|
||||
|
||||
/* debug console */
|
||||
#define TS_PRIMARY_UxART_PORT SD1
|
||||
|
|
|
@ -424,7 +424,7 @@
|
|||
#define LED_CRITICAL_ERROR_BRAIN_PIN Gpio::D14
|
||||
#endif
|
||||
#ifndef LED_ERROR_BRAIN_PIN_MODE
|
||||
#define LED_ERROR_BRAIN_PIN_MODE DEFAULT_OUTPUT
|
||||
#define LED_ERROR_BRAIN_PIN_MODE OM_DEFAULT
|
||||
#endif
|
||||
|
||||
// USART1 -> check defined STM32_SERIAL_USE_USART1
|
||||
|
|
|
@ -85,17 +85,14 @@ extern WaveChart waveChart;
|
|||
|
||||
#include "sensor_chart.h"
|
||||
|
||||
extern pin_output_mode_e DEFAULT_OUTPUT;
|
||||
extern pin_output_mode_e INVERTED_OUTPUT;
|
||||
|
||||
#ifndef LED_WARNING_BRAIN_PIN_MODE
|
||||
#define LED_WARNING_BRAIN_PIN_MODE DEFAULT_OUTPUT
|
||||
#define LED_WARNING_BRAIN_PIN_MODE OM_DEFAULT
|
||||
#endif
|
||||
#ifndef LED_RUNING_BRAIN_PIN_MODE
|
||||
#define LED_RUNING_BRAIN_PIN_MODE DEFAULT_OUTPUT
|
||||
#define LED_RUNING_BRAIN_PIN_MODE OM_DEFAULT
|
||||
#endif
|
||||
#ifndef LED_COMMUNICATION_BRAIN_PIN_MODE
|
||||
#define LED_COMMUNICATION_BRAIN_PIN_MODE DEFAULT_OUTPUT
|
||||
#define LED_COMMUNICATION_BRAIN_PIN_MODE OM_DEFAULT
|
||||
#endif
|
||||
|
||||
int warningEnabled = true;
|
||||
|
@ -261,11 +258,11 @@ static OutputPin *leds[] = { &enginePins.warningLedPin, &enginePins.runningLedPi
|
|||
&enginePins.errorLedPin, &enginePins.communicationLedPin, &enginePins.checkEnginePin };
|
||||
|
||||
static void initStatusLeds() {
|
||||
enginePins.communicationLedPin.initPin("led: comm status", engineConfiguration->communicationLedPin, &LED_COMMUNICATION_BRAIN_PIN_MODE, true);
|
||||
enginePins.communicationLedPin.initPin("led: comm status", engineConfiguration->communicationLedPin, LED_COMMUNICATION_BRAIN_PIN_MODE, true);
|
||||
// checkEnginePin is already initialized by the time we get here
|
||||
|
||||
enginePins.warningLedPin.initPin("led: warning status", engineConfiguration->warningLedPin, &LED_WARNING_BRAIN_PIN_MODE, true);
|
||||
enginePins.runningLedPin.initPin("led: running status", engineConfiguration->runningLedPin, &LED_RUNING_BRAIN_PIN_MODE, true);
|
||||
enginePins.warningLedPin.initPin("led: warning status", engineConfiguration->warningLedPin, LED_WARNING_BRAIN_PIN_MODE, true);
|
||||
enginePins.runningLedPin.initPin("led: running status", engineConfiguration->runningLedPin, LED_RUNING_BRAIN_PIN_MODE, true);
|
||||
}
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
// todo: clean this mess, this should become 'static'/private
|
||||
EnginePins enginePins;
|
||||
|
||||
pin_output_mode_e DEFAULT_OUTPUT = OM_DEFAULT;
|
||||
pin_output_mode_e INVERTED_OUTPUT = OM_INVERTED;
|
||||
|
||||
static const char* const sparkNames[] = { "Coil 1", "Coil 2", "Coil 3", "Coil 4", "Coil 5", "Coil 6", "Coil 7", "Coil 8",
|
||||
"Coil 9", "Coil 10", "Coil 11", "Coil 12"};
|
||||
|
||||
|
@ -107,11 +104,11 @@ bool RegisteredOutputPin::isPinConfigurationChanged() {
|
|||
void RegisteredOutputPin::init() {
|
||||
brain_pin_e newPin = *(brain_pin_e *) ((void *) (&((char*) engineConfiguration)[m_pinOffset]));
|
||||
|
||||
pin_output_mode_e* newMode;
|
||||
pin_output_mode_e newMode;
|
||||
if (m_hasPinMode) {
|
||||
newMode = (pin_output_mode_e *) ((void *) (&((char*) engineConfiguration)[m_pinModeOffset]));
|
||||
newMode = *(pin_output_mode_e *) ((void *) (&((char*) engineConfiguration)[m_pinModeOffset]));
|
||||
} else {
|
||||
newMode = &DEFAULT_OUTPUT;
|
||||
newMode = OM_DEFAULT;
|
||||
}
|
||||
|
||||
if (isPinConfigurationChanged()) {
|
||||
|
@ -296,12 +293,12 @@ void EnginePins::startIgnitionPins() {
|
|||
for (size_t i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
NamedOutputPin *trailingOutput = &enginePins.trailingCoils[i];
|
||||
if (isPinOrModeChanged(trailingCoilPins[i], ignitionPinMode)) {
|
||||
trailingOutput->initPin(trailingOutput->name, engineConfiguration->trailingCoilPins[i], &engineConfiguration->ignitionPinMode);
|
||||
trailingOutput->initPin(trailingOutput->name, engineConfiguration->trailingCoilPins[i], engineConfiguration->ignitionPinMode);
|
||||
}
|
||||
|
||||
NamedOutputPin *output = &enginePins.coils[i];
|
||||
if (isPinOrModeChanged(ignitionPins[i], ignitionPinMode)) {
|
||||
output->initPin(output->name, engineConfiguration->ignitionPins[i], &engineConfiguration->ignitionPinMode);
|
||||
output->initPin(output->name, engineConfiguration->ignitionPins[i], engineConfiguration->ignitionPinMode);
|
||||
}
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
@ -314,7 +311,7 @@ void EnginePins::startInjectionPins() {
|
|||
NamedOutputPin *output = &enginePins.injectors[i];
|
||||
if (isPinOrModeChanged(injectionPins[i], injectionPinMode)) {
|
||||
output->initPin(output->name, engineConfiguration->injectionPins[i],
|
||||
&engineConfiguration->injectionPinMode);
|
||||
engineConfiguration->injectionPinMode);
|
||||
}
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
@ -453,10 +450,6 @@ void IgnitionOutputPin::reset() {
|
|||
signalFallSparkId = 0;
|
||||
}
|
||||
|
||||
OutputPin::OutputPin() {
|
||||
modePtr = &DEFAULT_OUTPUT;
|
||||
}
|
||||
|
||||
bool OutputPin::isInitialized() {
|
||||
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
|
||||
#if (BOARD_EXT_GPIOCHIPS > 0)
|
||||
|
@ -514,8 +507,6 @@ void OutputPin::setValue(int logicValue) {
|
|||
return;
|
||||
}
|
||||
|
||||
efiAssertVoid(ObdCode::CUSTOM_ERR_6621, modePtr!=NULL, "pin mode not initialized");
|
||||
pin_output_mode_e mode = *modePtr;
|
||||
efiAssertVoid(ObdCode::CUSTOM_ERR_6622, mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e");
|
||||
int electricalValue = getElectricalValue(logicValue, mode);
|
||||
|
||||
|
@ -541,11 +532,9 @@ bool OutputPin::getLogicValue() const {
|
|||
return currentLogicValue == 1;
|
||||
}
|
||||
|
||||
void OutputPin::setDefaultPinState(const pin_output_mode_e *outputMode) {
|
||||
pin_output_mode_e mode = *outputMode;
|
||||
/* may be*/UNUSED(mode);
|
||||
void OutputPin::setDefaultPinState(pin_output_mode_e outputMode) {
|
||||
assertOMode(mode);
|
||||
this->modePtr = outputMode;
|
||||
this->mode = outputMode;
|
||||
setValue(false); // initial state
|
||||
}
|
||||
|
||||
|
@ -575,10 +564,10 @@ void initOutputPins() {
|
|||
}
|
||||
|
||||
void OutputPin::initPin(const char *msg, brain_pin_e brainPin) {
|
||||
initPin(msg, brainPin, &DEFAULT_OUTPUT);
|
||||
initPin(msg, brainPin, OM_DEFAULT);
|
||||
}
|
||||
|
||||
void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode, bool forceInitWithFatalError) {
|
||||
void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError) {
|
||||
#if EFI_UNIT_TEST
|
||||
unitTestTurnedOnCounter = 0;
|
||||
#endif
|
||||
|
@ -603,17 +592,17 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_
|
|||
return;
|
||||
}
|
||||
|
||||
if (*outputMode > OM_OPENDRAIN_INVERTED) {
|
||||
if (outputMode > OM_OPENDRAIN_INVERTED) {
|
||||
firmwareError(ObdCode::CUSTOM_INVALID_MODE_SETTING, "%s invalid pin_output_mode_e %d %s",
|
||||
msg,
|
||||
*outputMode,
|
||||
outputMode,
|
||||
hwPortname(brainPin)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
|
||||
iomode_t mode = (*outputMode == OM_DEFAULT || *outputMode == OM_INVERTED) ?
|
||||
iomode_t mode = (outputMode == OM_DEFAULT || outputMode == OM_INVERTED) ?
|
||||
PAL_MODE_OUTPUT_PUSHPULL : PAL_MODE_OUTPUT_OPENDRAIN;
|
||||
|
||||
#if (BOARD_EXT_GPIOCHIPS > 0)
|
||||
|
@ -654,16 +643,16 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_
|
|||
// we had enough drama with pin configuration in board.h and else that we shall self-check
|
||||
|
||||
// todo: handle OM_OPENDRAIN and OM_OPENDRAIN_INVERTED as well
|
||||
if (*outputMode == OM_DEFAULT || *outputMode == OM_INVERTED) {
|
||||
if (outputMode == OM_DEFAULT || outputMode == OM_INVERTED) {
|
||||
const int logicalValue =
|
||||
(*outputMode == OM_INVERTED)
|
||||
(outputMode == OM_INVERTED)
|
||||
? !actualValue
|
||||
: actualValue;
|
||||
|
||||
#ifndef DISABLE_PIN_STATE_VALIDATION
|
||||
// if the pin was set to logical 1, then set an error and disable the pin so that things don't catch fire
|
||||
if (logicalValue) {
|
||||
firmwareError(ObdCode::OBD_PCM_Processor_Fault, "HARDWARE VALIDATION FAILED %s: unexpected startup pin state %s actual value=%d logical value=%d mode=%s", msg, hwPortname(brainPin), actualValue, logicalValue, getPin_output_mode_e(*outputMode));
|
||||
firmwareError(ObdCode::OBD_PCM_Processor_Fault, "HARDWARE VALIDATION FAILED %s: unexpected startup pin state %s actual value=%d logical value=%d mode=%s", msg, hwPortname(brainPin), actualValue, logicalValue, getPin_output_mode_e(outputMode));
|
||||
OutputPin::deInit();
|
||||
}
|
||||
#endif
|
||||
|
@ -704,15 +693,15 @@ ioportmask_t criticalErrorLedPin;
|
|||
uint8_t criticalErrorLedState;
|
||||
|
||||
#ifndef LED_ERROR_BRAIN_PIN_MODE
|
||||
#define LED_ERROR_BRAIN_PIN_MODE DEFAULT_OUTPUT
|
||||
#define LED_ERROR_BRAIN_PIN_MODE OM_DEFAULT
|
||||
#endif /* LED_ERROR_BRAIN_PIN_MODE */
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
static void initErrorLed(Gpio led) {
|
||||
enginePins.errorLedPin.initPin("led: CRITICAL status", led, &(LED_ERROR_BRAIN_PIN_MODE));
|
||||
enginePins.errorLedPin.initPin("led: CRITICAL status", led, (LED_ERROR_BRAIN_PIN_MODE));
|
||||
criticalErrorLedPort = getHwPort("CRITICAL", led);
|
||||
criticalErrorLedPin = getHwPin("CRITICAL", led);
|
||||
criticalErrorLedState = (LED_ERROR_BRAIN_PIN_MODE == INVERTED_OUTPUT) ? 0 : 1;
|
||||
criticalErrorLedState = (LED_ERROR_BRAIN_PIN_MODE == OM_INVERTED) ? 0 : 1;
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
|
|
|
@ -20,21 +20,13 @@
|
|||
*/
|
||||
class OutputPin {
|
||||
public:
|
||||
OutputPin();
|
||||
/**
|
||||
* initializes pin & registers it in pin repository
|
||||
* outputMode being a pointer allow us to change configuration (for example invert logical pin) in configuration and get resuts applied
|
||||
* away, or at least I hope that's why
|
||||
*/
|
||||
void initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode, bool forceInitWithFatalError = false);
|
||||
/**
|
||||
* same as above, with DEFAULT_OUTPUT mode
|
||||
*/
|
||||
// initializes pin & registers it in pin repository
|
||||
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError = false);
|
||||
|
||||
// same as above, with OM_DEFAULT mode
|
||||
void initPin(const char *msg, brain_pin_e brainPin);
|
||||
|
||||
/**
|
||||
* dissociates pin from this output and un-registers it in pin repository
|
||||
*/
|
||||
// dissociates pin from this output and un-registers it in pin repository
|
||||
void deInit();
|
||||
|
||||
bool isInitialized();
|
||||
|
@ -69,11 +61,11 @@ public:
|
|||
*/
|
||||
private:
|
||||
// todo: inline this method?
|
||||
void setDefaultPinState(const pin_output_mode_e *defaultState);
|
||||
void setDefaultPinState(pin_output_mode_e mode);
|
||||
void setOnchipValue(int electricalValue);
|
||||
|
||||
// 4 byte pointer is a bit of a memory waste here
|
||||
const pin_output_mode_e *modePtr = nullptr;
|
||||
pin_output_mode_e mode = OM_DEFAULT;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,7 @@ SimpleTransmissionController simpleTransmissionController;
|
|||
|
||||
void SimpleTransmissionController::init() {
|
||||
for (size_t i = 0; i < efi::size(engineConfiguration->tcu_solenoid); i++) {
|
||||
enginePins.tcuSolenoids[i].initPin("Transmission Solenoid", engineConfiguration->tcu_solenoid[i], &engineConfiguration->tcu_solenoid_mode[i]);
|
||||
enginePins.tcuSolenoids[i].initPin("Transmission Solenoid", engineConfiguration->tcu_solenoid[i], engineConfiguration->tcu_solenoid_mode[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,24 +10,24 @@ static SimplePwm shift32Pwm("3-2 Shift Control");
|
|||
|
||||
void Gm4l6xTransmissionController::init() {
|
||||
for (size_t i = 0; i < efi::size(engineConfiguration->tcu_solenoid); i++) {
|
||||
enginePins.tcuSolenoids[i].initPin("Transmission Solenoid", engineConfiguration->tcu_solenoid[i], &engineConfiguration->tcu_solenoid_mode[i]);
|
||||
enginePins.tcuSolenoids[i].initPin("Transmission Solenoid", engineConfiguration->tcu_solenoid[i], engineConfiguration->tcu_solenoid_mode[i]);
|
||||
}
|
||||
enginePins.tcuTccOnoffSolenoid.initPin("TCC On/Off Solenoid", engineConfiguration->tcu_tcc_onoff_solenoid, &engineConfiguration->tcu_tcc_onoff_solenoid_mode);
|
||||
enginePins.tcuTccPwmSolenoid.initPin("TCC PWM Solenoid", engineConfiguration->tcu_tcc_pwm_solenoid, &engineConfiguration->tcu_tcc_pwm_solenoid_mode);
|
||||
enginePins.tcuTccOnoffSolenoid.initPin("TCC On/Off Solenoid", engineConfiguration->tcu_tcc_onoff_solenoid, engineConfiguration->tcu_tcc_onoff_solenoid_mode);
|
||||
enginePins.tcuTccPwmSolenoid.initPin("TCC PWM Solenoid", engineConfiguration->tcu_tcc_pwm_solenoid, engineConfiguration->tcu_tcc_pwm_solenoid_mode);
|
||||
startSimplePwm(&tccPwm,
|
||||
"TCC",
|
||||
&engine->executor,
|
||||
&enginePins.tcuTccPwmSolenoid,
|
||||
engineConfiguration->tcu_tcc_pwm_solenoid_freq,
|
||||
0);
|
||||
enginePins.tcuPcSolenoid.initPin("Pressure Control Solenoid", engineConfiguration->tcu_pc_solenoid_pin, &engineConfiguration->tcu_pc_solenoid_pin_mode);
|
||||
enginePins.tcuPcSolenoid.initPin("Pressure Control Solenoid", engineConfiguration->tcu_pc_solenoid_pin, engineConfiguration->tcu_pc_solenoid_pin_mode);
|
||||
startSimplePwm(&pcPwm,
|
||||
"Line Pressure",
|
||||
&engine->executor,
|
||||
&enginePins.tcuPcSolenoid,
|
||||
engineConfiguration->tcu_pc_solenoid_freq,
|
||||
0);
|
||||
enginePins.tcu32Solenoid.initPin("3-2 Shift Solenoid", engineConfiguration->tcu_32_solenoid_pin, &engineConfiguration->tcu_32_solenoid_pin_mode);
|
||||
enginePins.tcu32Solenoid.initPin("3-2 Shift Solenoid", engineConfiguration->tcu_32_solenoid_pin, engineConfiguration->tcu_32_solenoid_pin_mode);
|
||||
startSimplePwm(&shift32Pwm,
|
||||
"3-2 Solenoid",
|
||||
&engine->executor,
|
||||
|
|
|
@ -239,7 +239,7 @@ void startTriggerEmulatorPins() {
|
|||
#if EFI_PROD_CODE
|
||||
if (isConfigurationChanged(triggerSimulatorPins[i])) {
|
||||
triggerEmulatorSignal.outputPins[i]->initPin("Trigger emulator", pin,
|
||||
&engineConfiguration->triggerSimulatorPinModes[i]);
|
||||
engineConfiguration->triggerSimulatorPinModes[i]);
|
||||
}
|
||||
#endif // EFI_PROD_CODE
|
||||
}
|
||||
|
|
|
@ -335,25 +335,25 @@ void stopSmartCsPins() {
|
|||
void startSmartCsPins() {
|
||||
#if (BOARD_TLE8888_COUNT > 0)
|
||||
tle8888Cs.initPin("tle8888 CS", engineConfiguration->tle8888_cs,
|
||||
&engineConfiguration->tle8888_csPinMode);
|
||||
engineConfiguration->tle8888_csPinMode);
|
||||
tle8888Cs.setValue(true);
|
||||
#endif /* BOARD_TLE8888_COUNT */
|
||||
#if (BOARD_TLE6240_COUNT > 0)
|
||||
// todo: any way to reduce copy-paste? some convention between pin property name and pin mode property name?
|
||||
tle6240Cs.initPin("tle6240 CS", engineConfiguration->tle6240_cs,
|
||||
&engineConfiguration->tle6240_csPinMode);
|
||||
engineConfiguration->tle6240_csPinMode);
|
||||
tle6240Cs.setValue(true);
|
||||
#endif /* BOARD_TLE6240_COUNT */
|
||||
#if (BOARD_MC33972_COUNT > 0)
|
||||
// todo: any way to reduce copy-paste? some convention between pin property name and pin mode property name?
|
||||
mc33972Cs.initPin("mc33972 CS", engineConfiguration->mc33972_cs,
|
||||
&engineConfiguration->mc33972_csPinMode);
|
||||
engineConfiguration->mc33972_csPinMode);
|
||||
mc33972Cs.setValue(true);
|
||||
#endif /* BOARD_MC33972_COUNT */
|
||||
#if (BOARD_DRV8860_COUNT > 0)
|
||||
// todo: any way to reduce copy-paste? some convention between pin property name and pin mode property name?
|
||||
drv8860Cs.initPin("drv8860 CS", engineConfiguration->drv8860_cs,
|
||||
&engineConfiguration->drv8860_csPinMode);
|
||||
engineConfiguration->drv8860_csPinMode);
|
||||
drv8860Cs.setValue(true);
|
||||
#endif /* BOARD_DRV8860_COUNT */
|
||||
#if (BOARD_MC33810_COUNT > 0)
|
||||
|
|
|
@ -220,13 +220,13 @@ void StepDirectionStepper::initialize(brain_pin_e stepPin, brain_pin_e direction
|
|||
setReactionTime(reactionTime);
|
||||
|
||||
this->directionPinMode = directionPinMode;
|
||||
this->directionPin.initPin("Stepper DIR", directionPin, &this->directionPinMode);
|
||||
this->directionPin.initPin("Stepper DIR", directionPin, this->directionPinMode);
|
||||
|
||||
this->stepPinMode = OM_DEFAULT; // todo: do we need configurable stepPinMode?
|
||||
this->stepPin.initPin("Stepper step", stepPin, &this->stepPinMode);
|
||||
this->stepPin.initPin("Stepper step", stepPin, this->stepPinMode);
|
||||
|
||||
this->enablePinMode = enablePinMode;
|
||||
this->enablePin.initPin("Stepper EN", enablePin, &this->enablePinMode);
|
||||
this->enablePin.initPin("Stepper EN", enablePin, this->enablePinMode);
|
||||
|
||||
// All pins must be 0 for correct hardware startup (e.g. stepper auto-disabling circuit etc.).
|
||||
this->enablePin.setValue(true); // disable stepper
|
||||
|
|
Loading…
Reference in New Issue