trigger and start button pins not displayed by "pins" command #2084

This commit is contained in:
rusefi 2020-12-22 21:20:57 -05:00
parent 42c1fb7b5e
commit a254c79d93
3 changed files with 28 additions and 21 deletions

View File

@ -43,6 +43,27 @@ bool efiReadPin(brain_pin_e pin) {
return false;
}
void efiSetPadModeWithoutOwnershipAcquisition(const char *msg, brain_pin_e brainPin, iomode_t mode)
{
/*check if on-chip pin or external */
if (brain_pin_is_onchip(brainPin)) {
/* on-chip */
ioportid_t port = getHwPort(msg, brainPin);
ioportmask_t pin = getHwPin(msg, brainPin);
/* paranoid */
if (port == GPIO_NULL)
return;
palSetPadMode(port, pin, mode);
}
#if (BOARD_EXT_GPIOCHIPS > 0)
else {
gpiochips_setPadMode(brainPin, mode);
}
#endif
}
/**
* This method would set an error condition if pin is already used
*/
@ -56,22 +77,7 @@ void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
bool wasUsed = brain_pin_markUsed(brainPin, msg);
if (!wasUsed) {
/*check if on-chip pin or external */
if (brain_pin_is_onchip(brainPin)) {
/* on-chip */
ioportid_t port = getHwPort(msg, brainPin);
ioportmask_t pin = getHwPin(msg, brainPin);
/* paranoid */
if (port == GPIO_NULL)
return;
palSetPadMode(port, pin, mode);
}
#if (BOARD_EXT_GPIOCHIPS > 0)
else {
gpiochips_setPadMode(brainPin, mode);
}
#endif
efiSetPadModeWithoutOwnershipAcquisition(msg, brainPin, mode);
}
}

View File

@ -21,6 +21,7 @@
#if EFI_GPIO_HARDWARE
EXTERNC void efiSetPadMode(const char *msg, brain_pin_e pin, iomode_t mode);
EXTERNC void efiSetPadModeWithoutOwnershipAcquisition(const char *msg, brain_pin_e brainPin, iomode_t mode);
EXTERNC void efiSetPadUnused(brain_pin_e brainPin);
EXTERNC bool efiReadPin(brain_pin_e pin);

View File

@ -104,11 +104,11 @@ void stopJoystickPins() {
void startJoystickPins() {
// todo: extract 'configurePalInputPin() method?
// input capture driver would claim pin ownership so we are not using 'efiSetPadMode' here
palSetPadMode("joy center", CONFIG(joystickCenterPin), PAL_MODE_INPUT_PULLUP);
palSetPadMode("joy A", CONFIG(joystickAPin), PAL_MODE_INPUT_PULLUP);
// not used so far palSetPadMode("joy B", CONFIG(joystickBPin), PAL_MODE_INPUT_PULLUP);
// not used so far palSetPadMode("joy C", CONFIG(joystickCPin), PAL_MODE_INPUT_PULLUP);
palSetPadMode("joy D", CONFIG(joystickDPin), PAL_MODE_INPUT_PULLUP);
efiSetPadModeWithoutOwnershipAcquisition("joy center", CONFIG(joystickCenterPin), PAL_MODE_INPUT_PULLUP);
efiSetPadModeWithoutOwnershipAcquisition("joy A", CONFIG(joystickAPin), PAL_MODE_INPUT_PULLUP);
// not used so far efiSetPadModeWithoutOwnershipAcquisition("joy B", CONFIG(joystickBPin), PAL_MODE_INPUT_PULLUP);
// not used so far efiSetPadModeWithoutOwnershipAcquisition("joy C", CONFIG(joystickCPin), PAL_MODE_INPUT_PULLUP);
efiSetPadModeWithoutOwnershipAcquisition("joy D", CONFIG(joystickDPin), PAL_MODE_INPUT_PULLUP);
}
void initJoystick(Logging *shared) {