refactoring - reducing GPIO complexity

This commit is contained in:
rusefi 2017-04-21 16:36:50 -04:00
parent 3be80a6a32
commit e23be8b2a6
1 changed files with 6 additions and 12 deletions

View File

@ -12,12 +12,14 @@
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) #if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
#include "io_pins.h" #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 */ #endif /* EFI_GPIO_HARDWARE */
EXTERN_ENGINE; 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 pin_output_mode_e OUTPUT_MODE_DEFAULT = OM_DEFAULT;
static const char *sparkNames[IGNITION_PIN_COUNT] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", 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", static const char *injectorNames[INJECTION_PIN_COUNT] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8",
"j9", "iA", "iB", "iC"}; "j9", "iA", "iB", "iC"};
EnginePins::EnginePins() { EnginePins::EnginePins() {
dizzyOutput.name = DIZZY_NAME; dizzyOutput.name = DIZZY_NAME;
tachOut.name = TACH_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() { NamedOutputPin::NamedOutputPin() : OutputPin() {
name = NULL; name = NULL;
} }
@ -79,15 +74,14 @@ InjectorOutputPin::InjectorOutputPin() : NamedOutputPin() {
injectorIndex = -1; injectorIndex = -1;
} }
bool NamedOutputPin::stop() { bool NamedOutputPin::stop() {
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
if (isInitialized() && getLogicValue()) { if (isInitialized() && getLogicValue()) {
setValue(false); setValue(false);
scheduleMsg(&sharedLogger, "turning off %s", name); scheduleMsg(&sharedLogger, "turning off %s", name);
return true; return true;
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_GPIO_HARDWARE */
return false; return false;
} }