trigger and start button pins not displayed by "pins" command #2084
This commit is contained in:
parent
42c1fb7b5e
commit
a254c79d93
|
@ -43,19 +43,9 @@ bool efiReadPin(brain_pin_e pin) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method would set an error condition if pin is already used
|
void efiSetPadModeWithoutOwnershipAcquisition(const char *msg, brain_pin_e brainPin, iomode_t mode)
|
||||||
*/
|
|
||||||
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
|
|
||||||
{
|
{
|
||||||
if (brainPin == GPIO_UNASSIGNED) {
|
|
||||||
// No pin configured, nothing to do here.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wasUsed = brain_pin_markUsed(brainPin, msg);
|
|
||||||
|
|
||||||
if (!wasUsed) {
|
|
||||||
/*check if on-chip pin or external */
|
/*check if on-chip pin or external */
|
||||||
if (brain_pin_is_onchip(brainPin)) {
|
if (brain_pin_is_onchip(brainPin)) {
|
||||||
/* on-chip */
|
/* on-chip */
|
||||||
|
@ -73,6 +63,22 @@ void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method would set an error condition if pin is already used
|
||||||
|
*/
|
||||||
|
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
|
||||||
|
{
|
||||||
|
if (brainPin == GPIO_UNASSIGNED) {
|
||||||
|
// No pin configured, nothing to do here.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wasUsed = brain_pin_markUsed(brainPin, msg);
|
||||||
|
|
||||||
|
if (!wasUsed) {
|
||||||
|
efiSetPadModeWithoutOwnershipAcquisition(msg, brainPin, mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void efiSetPadUnused(brain_pin_e brainPin)
|
void efiSetPadUnused(brain_pin_e brainPin)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE
|
#if EFI_GPIO_HARDWARE
|
||||||
EXTERNC void efiSetPadMode(const char *msg, brain_pin_e pin, iomode_t mode);
|
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 void efiSetPadUnused(brain_pin_e brainPin);
|
||||||
|
|
||||||
EXTERNC bool efiReadPin(brain_pin_e pin);
|
EXTERNC bool efiReadPin(brain_pin_e pin);
|
||||||
|
|
|
@ -104,11 +104,11 @@ void stopJoystickPins() {
|
||||||
void startJoystickPins() {
|
void startJoystickPins() {
|
||||||
// todo: extract 'configurePalInputPin() method?
|
// todo: extract 'configurePalInputPin() method?
|
||||||
// input capture driver would claim pin ownership so we are not using 'efiSetPadMode' here
|
// input capture driver would claim pin ownership so we are not using 'efiSetPadMode' here
|
||||||
palSetPadMode("joy center", CONFIG(joystickCenterPin), PAL_MODE_INPUT_PULLUP);
|
efiSetPadModeWithoutOwnershipAcquisition("joy center", CONFIG(joystickCenterPin), PAL_MODE_INPUT_PULLUP);
|
||||||
palSetPadMode("joy A", CONFIG(joystickAPin), PAL_MODE_INPUT_PULLUP);
|
efiSetPadModeWithoutOwnershipAcquisition("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 efiSetPadModeWithoutOwnershipAcquisition("joy B", CONFIG(joystickBPin), PAL_MODE_INPUT_PULLUP);
|
||||||
// not used so far palSetPadMode("joy C", CONFIG(joystickCPin), PAL_MODE_INPUT_PULLUP);
|
// not used so far efiSetPadModeWithoutOwnershipAcquisition("joy C", CONFIG(joystickCPin), PAL_MODE_INPUT_PULLUP);
|
||||||
palSetPadMode("joy D", CONFIG(joystickDPin), PAL_MODE_INPUT_PULLUP);
|
efiSetPadModeWithoutOwnershipAcquisition("joy D", CONFIG(joystickDPin), PAL_MODE_INPUT_PULLUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initJoystick(Logging *shared) {
|
void initJoystick(Logging *shared) {
|
||||||
|
|
Loading…
Reference in New Issue