refactoring - reducing GPIO complexity
This commit is contained in:
parent
396746dd9a
commit
ac16341b2b
|
@ -549,12 +549,10 @@ static OutputPin *leds[] = { &enginePins.warningPin, &enginePins.runningPin, &en
|
|||
extern pin_output_mode_e DEFAULT_OUTPUT;
|
||||
|
||||
static void initStatusLeds(void) {
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
outputPinRegisterExt2("led: comm status", &enginePins.communicationPin,
|
||||
engineConfiguration->communicationPin, &DEFAULT_OUTPUT);
|
||||
// we initialize this here so that we can blink it on start-up
|
||||
outputPinRegisterExt2("MalfunctionIndicator", &enginePins.checkEnginePin, boardConfiguration->malfunctionIndicatorPin, &DEFAULT_OUTPUT);
|
||||
#endif
|
||||
|
||||
#if EFI_WARNING_LED || defined(__DOXYGEN__)
|
||||
outputPinRegisterExt2("led: warning status", &enginePins.warningPin, LED_WARNING_BRAIN_PIN, &DEFAULT_OUTPUT);
|
||||
|
|
|
@ -229,13 +229,8 @@ void initOutputPins(void) {
|
|||
#endif /* EFI_GPIO_HARDWARE */
|
||||
}
|
||||
|
||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||
|
||||
void initPrimaryPins(void) {
|
||||
outputPinRegisterExt2("led: ERROR status", &enginePins.errorLedPin, LED_ERROR_BRAIN_PIN, &DEFAULT_OUTPUT);
|
||||
}
|
||||
|
||||
void outputPinRegisterExt2(const char *msg, OutputPin *outputPin, brain_pin_e brainPin, pin_output_mode_e *outputMode) {
|
||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||
if (brainPin == GPIO_UNASSIGNED)
|
||||
return;
|
||||
ioportid_t port = getHwPort(brainPin);
|
||||
|
@ -273,6 +268,13 @@ void outputPinRegisterExt2(const char *msg, OutputPin *outputPin, brain_pin_e br
|
|||
mySetPadMode(msg, port, pin, mode);
|
||||
|
||||
outputPin->setDefaultPinState(outputMode);
|
||||
#endif /* EFI_GPIO_HARDWARE */
|
||||
}
|
||||
|
||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||
|
||||
void initPrimaryPins(void) {
|
||||
outputPinRegisterExt2("led: ERROR status", &enginePins.errorLedPin, LED_ERROR_BRAIN_PIN, &DEFAULT_OUTPUT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
void setDefaultPinState(pin_output_mode_e *defaultState);
|
||||
bool getLogicValue();
|
||||
void unregister();
|
||||
bool isPinAssigned();
|
||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||
ioportid_t port;
|
||||
uint8_t pin;
|
||||
|
@ -142,9 +143,10 @@ public:
|
|||
void turnPinHigh(NamedOutputPin *output);
|
||||
void turnPinLow(NamedOutputPin *output);
|
||||
|
||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode);
|
||||
|
||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||
|
||||
ioportmask_t getHwPin(brain_pin_e brainPin);
|
||||
ioportid_t getHwPort(brain_pin_e brainPin);
|
||||
const char *portname(ioportid_t GPIOx);
|
||||
|
|
|
@ -41,9 +41,6 @@ extern WaveChart waveChart;
|
|||
|
||||
static LoggingWithStorage sharedLogger("simulator");
|
||||
|
||||
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode) {
|
||||
}
|
||||
|
||||
int getRemainingStack(thread_t *otp) {
|
||||
return 99999;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue