No pins should be restarted for no reason during config change #3151
This commit is contained in:
parent
22c0021751
commit
72d29f319d
|
@ -174,14 +174,10 @@ void turnOnTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
|
||||
void stopTriggerDebugPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
for (int i = 0; i < TRIGGER_INPUT_PIN_COUNT; i++) {
|
||||
if (isConfigurationChanged(triggerInputDebugPins[i])) {
|
||||
efiSetPadUnused(activeConfiguration.triggerInputDebugPins[i] PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
efiSetPadUnusedIfConfigurationChanged(triggerInputDebugPins[i]);
|
||||
}
|
||||
for (int i = 0; i < CAM_INPUTS_COUNT; i++) {
|
||||
if (isConfigurationChanged(camInputsDebug[i])) {
|
||||
efiSetPadUnused(activeConfiguration.camInputsDebug[i] PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
efiSetPadUnusedIfConfigurationChanged(camInputsDebug[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,13 +197,8 @@ void enableFrankensoCan(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
}
|
||||
|
||||
void stopCanPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
if (isConfigurationChanged(canTxPin)) {
|
||||
efiSetPadUnused(activeConfiguration.canTxPin);
|
||||
}
|
||||
|
||||
if (isConfigurationChanged(canRxPin)) {
|
||||
efiSetPadUnused(activeConfiguration.canRxPin);
|
||||
}
|
||||
efiSetPadUnusedIfConfigurationChanged(canTxPin);
|
||||
efiSetPadUnusedIfConfigurationChanged(canRxPin);
|
||||
}
|
||||
|
||||
// at the moment we support only very limited runtime configuration change, still not supporting online CAN toggle
|
||||
|
@ -224,12 +219,8 @@ void startCanPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (isConfigurationChanged(canTxPin)) {
|
||||
efiSetPadMode("CAN TX", CONFIG(canTxPin), PAL_MODE_ALTERNATE(EFI_CAN_TX_AF));
|
||||
}
|
||||
if (isConfigurationChanged(canRxPin)) {
|
||||
efiSetPadMode("CAN RX", CONFIG(canRxPin), PAL_MODE_ALTERNATE(EFI_CAN_RX_AF));
|
||||
}
|
||||
efiSetPadModeIfConfigurationChanged("CAN TX", canTxPin, PAL_MODE_ALTERNATE(EFI_CAN_TX_AF));
|
||||
efiSetPadModeIfConfigurationChanged("CAN RX", canRxPin, PAL_MODE_ALTERNATE(EFI_CAN_RX_AF));
|
||||
}
|
||||
|
||||
void initCan(void) {
|
||||
|
|
|
@ -19,6 +19,15 @@
|
|||
efiAssertVoid(CUSTOM_INVALID_MODE_SETTING, mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e"); \
|
||||
}
|
||||
|
||||
#define efiSetPadModeIfConfigurationChanged(msg, pin, mode) \
|
||||
if (isConfigurationChanged(pin)) { \
|
||||
efiSetPadMode(msg, CONFIG(pin), mode PASS_ENGINE_PARAMETER_SUFFIX); \
|
||||
}
|
||||
|
||||
#define efiSetPadUnusedIfConfigurationChanged(pin) \
|
||||
if (isConfigurationChanged(pin)) { \
|
||||
efiSetPadUnused(activeConfiguration.pin PASS_ENGINE_PARAMETER_SUFFIX); \
|
||||
}
|
||||
|
||||
EXTERNC void efiSetPadMode(const char *msg, brain_pin_e pin, iomode_t mode DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
EXTERNC void efiSetPadModeWithoutOwnershipAcquisition(const char *msg, brain_pin_e brainPin, iomode_t mode);
|
||||
|
|
Loading…
Reference in New Issue