refactoring - reducing GPIO complexity
This commit is contained in:
parent
ec805f5cba
commit
0992f1465a
|
@ -1,5 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* @file efiGpio.cpp
|
* @file efiGpio.cpp
|
||||||
|
* @brief EFI-related GPIO code
|
||||||
*
|
*
|
||||||
* @date Sep 26, 2014
|
* @date Sep 26, 2014
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* @file efiGpio.h
|
* @file efiGpio.h
|
||||||
|
* @brief EFI-related GPIO code
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @date Sep 26, 2014
|
* @date Sep 26, 2014
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||||
|
@ -7,15 +9,20 @@
|
||||||
#ifndef EFIGPIO_H_
|
#ifndef EFIGPIO_H_
|
||||||
#define EFIGPIO_H_
|
#define EFIGPIO_H_
|
||||||
|
|
||||||
#include "main.h"
|
|
||||||
#include "io_pins.h"
|
#include "io_pins.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
#define INITIAL_PIN_STATE -1
|
#define INITIAL_PIN_STATE -1
|
||||||
|
|
||||||
// mode >= 0 is always true since that's an unsigned
|
void initPrimaryPins(void);
|
||||||
#define assertOMode(mode) { \
|
void initOutputPins(void);
|
||||||
efiAssertVoid(mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e"); \
|
|
||||||
}
|
#if EFI_GPIO || defined(__DOXYGEN__)
|
||||||
|
void turnAllPinsOff(void);
|
||||||
|
#else /* EFI_GPIO */
|
||||||
|
#define turnAllPinsOff() {}
|
||||||
|
#endif /* EFI_GPIO */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Single output pin reference and state
|
* @brief Single output pin reference and state
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* @file io_pins.cpp
|
* @file io_pins.cpp
|
||||||
* @brief It could be that the main purpose of this file is the status LED blinking
|
* @brief his file is about general input/output utility methods, not much EFI-specifics
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @date Jan 24, 2013
|
* @date Jan 24, 2013
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* @file io_pins.h
|
* @file io_pins.h
|
||||||
|
* @brief his file is about general input/output utility methods, not much EFI-specifics
|
||||||
*
|
*
|
||||||
* @date Jan 24, 2013
|
* @date Jan 24, 2013
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||||
|
@ -9,25 +10,14 @@
|
||||||
#define IO_PINS_H_
|
#define IO_PINS_H_
|
||||||
|
|
||||||
#include "rusefi_enums.h"
|
#include "rusefi_enums.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
#define GPIO_NULL NULL
|
#define GPIO_NULL NULL
|
||||||
|
|
||||||
typedef enum {
|
// mode >= 0 is always true since that's an unsigned
|
||||||
INJECTOR_1,
|
#define assertOMode(mode) { \
|
||||||
INJECTOR_2,
|
efiAssertVoid(mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e"); \
|
||||||
INJECTOR_3,
|
}
|
||||||
INJECTOR_4,
|
|
||||||
INJECTOR_5,
|
|
||||||
INJECTOR_6,
|
|
||||||
INJECTOR_7,
|
|
||||||
INJECTOR_8,
|
|
||||||
INJECTOR_9_,
|
|
||||||
INJECTOR_10,
|
|
||||||
INJECTOR_11,
|
|
||||||
INJECTOR_12,
|
|
||||||
|
|
||||||
INJECTOR_NONE,
|
|
||||||
} injector_channel_e;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,13 +51,5 @@ typedef enum {
|
||||||
// LED_HUGE_19,
|
// LED_HUGE_19,
|
||||||
// LED_HUGE_20,
|
// LED_HUGE_20,
|
||||||
|
|
||||||
void initPrimaryPins(void);
|
|
||||||
void initOutputPins(void);
|
|
||||||
|
|
||||||
#if EFI_GPIO
|
|
||||||
void turnAllPinsOff(void);
|
|
||||||
#else
|
|
||||||
#define turnAllPinsOff() {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* IO_PINS_H_ */
|
#endif /* IO_PINS_H_ */
|
Loading…
Reference in New Issue