refactoring - reducing GPIO complexity
This commit is contained in:
parent
070475f1ff
commit
65aa80c379
|
@ -234,7 +234,6 @@ void outputPinRegister(const char *msg, OutputPin *output, ioportid_t port, uint
|
|||
outputPinRegisterExt(msg, output, port, pin, &DEFAULT_OUTPUT);
|
||||
}
|
||||
|
||||
|
||||
void initPrimaryPins(void) {
|
||||
outputPinRegister("led: ERROR status", &enginePins.errorLedPin, LED_ERROR_PORT, LED_ERROR_PIN);
|
||||
}
|
||||
|
@ -248,5 +247,17 @@ void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brain
|
|||
outputPinRegisterExt(msg, output, hwPort, hwPin, outputMode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is part of fatal error handling.
|
||||
* Please note that worst case scenario the pins might get re-enabled by some other code :(
|
||||
* The whole method is pretty naive, but that's at least something.
|
||||
*/
|
||||
void turnAllPinsOff(void) {
|
||||
for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
|
||||
enginePins.injectors[i].setValue(false);
|
||||
}
|
||||
for (int i = 0; i < IGNITION_PIN_COUNT; i++) {
|
||||
enginePins.coils[i].setValue(false);
|
||||
}
|
||||
}
|
||||
#endif /* EFI_GPIO_HARDWARE */
|
||||
|
|
|
@ -23,11 +23,8 @@ EXTERN_ENGINE;
|
|||
#include "main_trigger_callback.h"
|
||||
#endif /* EFI_ENGINE_CONTROL */
|
||||
|
||||
extern board_configuration_s *boardConfiguration;
|
||||
|
||||
static LoggingWithStorage logger("io_pins");
|
||||
|
||||
|
||||
extern EnginePins enginePins;
|
||||
|
||||
#if defined(STM32F4XX)
|
||||
|
@ -36,8 +33,6 @@ static ioportid_t PORTS[] = { GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, G
|
|||
static ioportid_t PORTS[] = { GPIOA, GPIOB, GPIOC, GPIOD, GPIOF};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
ioportid_t getHwPort(brain_pin_e brainPin) {
|
||||
if (brainPin == GPIO_UNASSIGNED)
|
||||
return GPIO_NULL;
|
||||
|
@ -83,20 +78,3 @@ void initOutputPin(const char *msg, OutputPin *outputPin, ioportid_t port, uint3
|
|||
initOutputPinExt(msg, outputPin, port, pinNumber, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
}
|
||||
|
||||
|
||||
#if EFI_GPIO_HARDWARE
|
||||
|
||||
/**
|
||||
* This method is part of fatal error handling.
|
||||
* Please note that worst case scenario the pins might get re-enabled by some other code :(
|
||||
* The whole method is pretty naive, but that's at least something.
|
||||
*/
|
||||
void turnAllPinsOff(void) {
|
||||
for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
|
||||
enginePins.injectors[i].setValue(false);
|
||||
}
|
||||
for (int i = 0; i < IGNITION_PIN_COUNT; i++) {
|
||||
enginePins.coils[i].setValue(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,6 @@ static ioportid_t ports[7] = {GPIOA,
|
|||
};
|
||||
|
||||
PinRepository::PinRepository() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue