io_pins: efiReadPin() variant with pin_input_mode_e argument
Will invert state in case of inverted mode.
This commit is contained in:
parent
9209bc64cb
commit
48144a49b4
|
@ -134,3 +134,15 @@ void setMockState(brain_pin_e pin, bool state) {
|
|||
}
|
||||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
bool efiIsInputPinInverted(pin_input_mode_e mode)
|
||||
{
|
||||
return ((mode == PI_INVERTED_DEFAULT) ||
|
||||
(mode == PI_INVERTED_PULLUP) ||
|
||||
(mode == PI_INVERTED_PULLDOWN));
|
||||
}
|
||||
|
||||
bool efiReadPin(brain_pin_e pin, pin_input_mode_e mode)
|
||||
{
|
||||
return efiReadPin(pin) ^ efiIsInputPinInverted(mode);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ void efiSetPadUnused(brain_pin_e brainPin);
|
|||
|
||||
#if EFI_GPIO_HARDWARE
|
||||
bool efiReadPin(brain_pin_e pin);
|
||||
bool efiReadPin(brain_pin_e pin, pin_input_mode_e mode);
|
||||
bool efiIsInputPinInverted(pin_input_mode_e mode);
|
||||
|
||||
iomode_t getInputMode(pin_input_mode_e mode);
|
||||
|
||||
|
|
Loading…
Reference in New Issue