From 03b66eaa4f838dd322a1b9d2e8de9b564156c024 Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 21 Apr 2017 16:36:50 -0400 Subject: [PATCH] refactoring - reducing GPIO complexity --- firmware/controllers/system/efiGpio.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/firmware/controllers/system/efiGpio.cpp b/firmware/controllers/system/efiGpio.cpp index f409fe455b..05a70537a2 100644 --- a/firmware/controllers/system/efiGpio.cpp +++ b/firmware/controllers/system/efiGpio.cpp @@ -12,12 +12,14 @@ #if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) #include "io_pins.h" -// todo: maybe remove this from here? pin_repository.h has a lot of stuff it should not have -#include "pin_repository.h" #endif /* EFI_GPIO_HARDWARE */ EXTERN_ENGINE; +// todo: clean this mess, this should become 'static'/private +EnginePins enginePins; +extern LoggingWithStorage sharedLogger; + static pin_output_mode_e OUTPUT_MODE_DEFAULT = OM_DEFAULT; static const char *sparkNames[IGNITION_PIN_COUNT] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", @@ -26,7 +28,6 @@ static const char *sparkNames[IGNITION_PIN_COUNT] = { "c1", "c2", "c3", "c4", "c static const char *injectorNames[INJECTION_PIN_COUNT] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "j9", "iA", "iB", "iC"}; - EnginePins::EnginePins() { dizzyOutput.name = DIZZY_NAME; tachOut.name = TACH_NAME; @@ -60,12 +61,6 @@ void EnginePins::reset() { } } - - -// todo: clean this mess, this should become 'static'/private -EnginePins enginePins; -extern LoggingWithStorage sharedLogger; - NamedOutputPin::NamedOutputPin() : OutputPin() { name = NULL; } @@ -79,15 +74,14 @@ InjectorOutputPin::InjectorOutputPin() : NamedOutputPin() { injectorIndex = -1; } - bool NamedOutputPin::stop() { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) if (isInitialized() && getLogicValue()) { setValue(false); scheduleMsg(&sharedLogger, "turning off %s", name); return true; } -#endif /* EFI_PROD_CODE */ +#endif /* EFI_GPIO_HARDWARE */ return false; }