switch to pass by reference (#1832)
This commit is contained in:
parent
ae9c60731a
commit
4d0b953129
|
@ -14,8 +14,8 @@ ButtonShiftController buttonShiftController;
|
||||||
|
|
||||||
void ButtonShiftController::init (DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void ButtonShiftController::init (DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
// 500 millisecond is maybe a little long?
|
// 500 millisecond is maybe a little long?
|
||||||
debounceUp.init(500, &CONFIG(tcuUpshiftButtonPin), &CONFIG(tcuUpshiftButtonPinMode));
|
debounceUp.init(500, CONFIG(tcuUpshiftButtonPin), CONFIG(tcuUpshiftButtonPinMode));
|
||||||
debounceDown.init(500, &CONFIG(tcuDownshiftButtonPin), &CONFIG(tcuDownshiftButtonPinMode));
|
debounceDown.init(500, CONFIG(tcuDownshiftButtonPin), CONFIG(tcuDownshiftButtonPinMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonShiftController::update() {
|
void ButtonShiftController::update() {
|
||||||
|
|
|
@ -16,7 +16,7 @@ ButtonDebounce acDebounce;
|
||||||
|
|
||||||
void initSensors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void initSensors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
initMapDecoder(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
initMapDecoder(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
acDebounce.init(15, &CONFIG(acSwitch), &CONFIG(acSwitchMode));
|
acDebounce.init(15, CONFIG(acSwitch), CONFIG(acSwitchMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getAcToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
bool getAcToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
|
|
@ -7,5 +7,5 @@ ButtonDebounce startStopButtonDebounce;
|
||||||
|
|
||||||
void initStartStopButton(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void initStartStopButton(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
/* startCrankingDuration is efitimesec_t, so we need to multiply it by 1000 to get milliseconds*/
|
/* startCrankingDuration is efitimesec_t, so we need to multiply it by 1000 to get milliseconds*/
|
||||||
startStopButtonDebounce.init((CONFIG(startCrankingDuration)*1000), &CONFIG(startStopButtonPin), &CONFIG(startStopButtonMode));
|
startStopButtonDebounce.init((CONFIG(startCrankingDuration)*1000), CONFIG(startStopButtonPin), CONFIG(startStopButtonMode));
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ ButtonDebounce* ButtonDebounce::s_firstDebounce = nullptr;
|
||||||
/**
|
/**
|
||||||
We need to have a separate init function because we do not have the pin or mode in the context in which the class is originally created
|
We need to have a separate init function because we do not have the pin or mode in the context in which the class is originally created
|
||||||
*/
|
*/
|
||||||
void ButtonDebounce::init (efitimems_t threshold, brain_pin_e *pin, pin_input_mode_e *mode) {
|
void ButtonDebounce::init (efitimems_t threshold, brain_pin_e &pin, pin_input_mode_e &mode) {
|
||||||
// we need to keep track of whether we have already been initialized due to the way unit tests run.
|
// we need to keep track of whether we have already been initialized due to the way unit tests run.
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
// Link us to the list that is used to track ButtonDebounce instances, so that when the configuration changes,
|
// Link us to the list that is used to track ButtonDebounce instances, so that when the configuration changes,
|
||||||
|
@ -25,8 +25,8 @@ void ButtonDebounce::init (efitimems_t threshold, brain_pin_e *pin, pin_input_mo
|
||||||
}
|
}
|
||||||
m_threshold = MS2NT(threshold);
|
m_threshold = MS2NT(threshold);
|
||||||
timeLast = 0;
|
timeLast = 0;
|
||||||
m_pin = pin;
|
m_pin = &pin;
|
||||||
m_mode = mode;
|
m_mode = &mode;
|
||||||
startConfiguration();
|
startConfiguration();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
class ButtonDebounce {
|
class ButtonDebounce {
|
||||||
public:
|
public:
|
||||||
void init(efitimems_t threshold, brain_pin_e *pin, pin_input_mode_e *mode);
|
void init(efitimems_t threshold, brain_pin_e &pin, pin_input_mode_e &mode);
|
||||||
void stopConfiguration();
|
void stopConfiguration();
|
||||||
void startConfiguration();
|
void startConfiguration();
|
||||||
bool readPinEvent();
|
bool readPinEvent();
|
||||||
|
|
Loading…
Reference in New Issue