refactoring - reducing GPIO complexity
This commit is contained in:
parent
f96de7eef3
commit
46f02fb3f7
|
@ -264,9 +264,10 @@
|
|||
// todo: this should be detected automatically based on pin selection
|
||||
#define TS_SERIAL_AF 7
|
||||
|
||||
#define LED_WARNING_PORT GPIOD
|
||||
#define LED_WARNING_PIN 13
|
||||
#define LED_WARNING_BRAIN_PIN GPIOD_13
|
||||
|
||||
// LED_ERROR_BRAIN_PIN should match LED_ERROR_PORT/LED_ERROR_PIN
|
||||
#define LED_ERROR_BRAIN_PIN GPIOD_14
|
||||
#define LED_ERROR_PORT GPIOD
|
||||
#define LED_ERROR_PIN 14
|
||||
|
||||
|
|
|
@ -557,8 +557,7 @@ static void initStatusLeds(void) {
|
|||
#endif
|
||||
|
||||
#if EFI_WARNING_LED || defined(__DOXYGEN__)
|
||||
outputPinRegister("led: warning status", &enginePins.warningPin, LED_WARNING_PORT,
|
||||
LED_WARNING_PIN);
|
||||
outputPinRegisterExt2("led: warning status", &enginePins.warningPin, LED_WARNING_BRAIN_PIN, &DEFAULT_OUTPUT);
|
||||
outputPinRegisterExt2("led: running status", &enginePins.runningPin, engineConfiguration->runningPin,
|
||||
&DEFAULT_OUTPUT);
|
||||
#endif /* EFI_WARNING_LED */
|
||||
|
|
|
@ -184,10 +184,6 @@ void initOutputPins(void) {
|
|||
// todo: it's too late to clear now? this breaks default status LEDs
|
||||
// todo: fix this?
|
||||
// memset(&outputs, 0, sizeof(outputs));
|
||||
// outputPinRegister("ext led 1", LED_EXT_1, EXTRA_LED_1_PORT, EXTRA_LED_1_PIN);
|
||||
// outputPinRegister("ext led 2", LED_EXT_2, EXTRA_LED_2_PORT, EXTRA_LED_2_PIN);
|
||||
// outputPinRegister("ext led 3", LED_EXT_3, EXTRA_LED_2_PORT, EXTRA_LED_3_PIN);
|
||||
// outputPinRegister("alive1", LED_DEBUG, GPIOD, 6);
|
||||
|
||||
#if HAL_USE_SPI || defined(__DOXYGEN__)
|
||||
outputPinRegisterExt2("spi CS5", &enginePins.sdCsPin, boardConfiguration->sdCardCsPin, &DEFAULT_OUTPUT);
|
||||
|
@ -262,7 +258,7 @@ void outputPinRegister(const char *msg, OutputPin *output, ioportid_t port, uint
|
|||
}
|
||||
|
||||
void initPrimaryPins(void) {
|
||||
outputPinRegister("led: ERROR status", &enginePins.errorLedPin, LED_ERROR_PORT, LED_ERROR_PIN);
|
||||
outputPinRegisterExt2("led: ERROR status", &enginePins.errorLedPin, LED_ERROR_BRAIN_PIN, &DEFAULT_OUTPUT);
|
||||
}
|
||||
|
||||
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode) {
|
||||
|
|
|
@ -143,9 +143,7 @@ void turnPinHigh(NamedOutputPin *output);
|
|||
void turnPinLow(NamedOutputPin *output);
|
||||
|
||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||
void initOutputPin(const char *msg, OutputPin *outputPin, ioportid_t port, uint32_t pinNumber);
|
||||
void initOutputPinExt(const char *msg, OutputPin *outputPin, ioportid_t port, uint32_t pinNumber, iomode_t mode);
|
||||
void outputPinRegister(const char *msg, OutputPin *output, ioportid_t port, uint32_t pin);
|
||||
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode);
|
||||
|
||||
ioportmask_t getHwPin(brain_pin_e brainPin);
|
||||
|
|
Loading…
Reference in New Issue