#include <digital_io.h>
Public Member Functions | |
McuxpressoDigitalInOutInterrupt (GPIO_Type *base, uint32_t port, uint32_t pin, bool output) | |
bool | is_enabled () const |
Returns true if the line is enabled (in any state). | |
![]() | |
Status | ClearInterruptHandler () |
Status | DisableInterruptHandler () |
Status | EnableInterruptHandler () |
Result< State > | GetState () |
Result< bool > | IsStateActive () |
Status | SetInterruptHandler (InterruptTrigger trigger, InterruptHandler &&handler) |
Status | SetState (State state) |
Status | SetStateActive () |
Status | SetStateInactive () |
![]() | |
constexpr bool | provides_input () const |
constexpr bool | provides_output () const |
constexpr bool | provides_interrupt () const |
Result< State > | GetState () |
Status | SetState (State state) |
Result< bool > | IsStateActive () |
Status | SetStateActive () |
Status | SetStateInactive () |
Status | SetInterruptHandler (InterruptTrigger trigger, InterruptHandler &&handler) |
Status | ClearInterruptHandler () |
Status | EnableInterruptHandler () |
Status | DisableInterruptHandler () |
Status | Enable () |
Status | Disable () |
Private Member Functions | |
pw::Status | DoEnable (bool enable) override |
pw::Result< pw::digital_io::State > | DoGetState () override |
pw::Status | DoSetState (pw::digital_io::State state) override |
pw::Status | DoSetInterruptHandler (pw::digital_io::InterruptTrigger trigger, pw::digital_io::InterruptHandler &&handler) override |
pw::Status | DoEnableInterruptHandler (bool enable) override |
Friends | |
void | GPIO_INTA_DriverIRQHandler () |
Additional Inherited Members | |
![]() | |
constexpr | Item ()=default |
Provides input, output, and interrupt support for an MCUXpresso GPIO pin.
Interrupts are provided by IRQ "A" on the GPIO module.
Class-specific behaviors:
Enable
is 0 (inactive).Disable
has no actual effect; unlike McuxpressoDigitalOut, the GPIO is not reverted to an input.IOPCTL
) via the Input Buffer Enable (IBENA
) bit.IIENA
) bit on the corresponding IO Pad Controller (IOPCTL
) register. pw::digital_io::McuxpressoDigitalInOutInterrupt::McuxpressoDigitalInOutInterrupt | ( | GPIO_Type * | base, |
uint32_t | port, | ||
uint32_t | pin, | ||
bool | output | ||
) |
Constructs a McuxpressoDigitalInOutInterrupt for a specific GPIO module+port+pin.
[in] | base | The base address of the GPIO module (e.g. GPIO ). |
[in] | port | The port number on the given GPIO module. |
[in] | pin | The pin number on the given GPIO port. |
[in] | output | True if the line should be configured as an output on enable; False if it should be an input. |
|
overrideprivatevirtual |
Enables the line to initialize it into the default state as determined by the backend or disables the line to power down any pull-up/down resistors and disconnect from any voltage sources.
This may enable pull-up/down resistors, drive the line high/low, etc. The line must be enabled before getting/setting the state or enabling interrupts. Callers are responsible for waiting for the voltage level to settle after this call returns.
Calling DoEnable(true) on an already-enabled line should be a no-op, it shouldn't reset the line back to the "default state".
Calling DoEnable(false) should force the line into the disabled state, If the line was not initialized at object construction time.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: The line is enabled and ready for use. * * Returns other status codes as defined by the backend. * *
Implements pw::digital_io::DigitalIoOptional.
|
overrideprivatevirtual |
Enables or disables interrupts which will trigger the interrupt handler.
DoSetInterruptHandler()
. embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: The interrupt handler was configured. * * FAILED_PRECONDITION: The line has not been enabled. * * Returns other status codes as defined by the backend. * *
Implements pw::digital_io::DigitalIoOptional.
|
overrideprivatevirtual |
Gets the state of the line.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: An active or inactive state. * * FAILED_PRECONDITION: The line has not been enabled. * * Returns other status codes as defined by the backend. * *
Implements pw::digital_io::DigitalIoOptional.
|
overrideprivatevirtual |
Sets or clears an interrupt handler to execute when an interrupt is triggered, and configures the condition for triggering the interrupt.
The handler is executed in a backend-specific context—this may be a system interrupt handler or a shared notification thread.
The implementation is expected to provide the handler the last known state of the input. The intention is to either sample the current state and provide that or if not possible provide the state which triggerred the interrupt (e.g. active for activating edge, and inactive for deactivating edge).
The handler is cleared by passing an empty handler, this can be checked by comparing the handler to a nullptr. The implementation must guarantee that the handler is not currently executing and (and will never execute again) after returning from DoSetInterruptHandler(_, nullptr).
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: The interrupt handler was configured. * * Returns other status codes as defined by the backend. * *
Implements pw::digital_io::DigitalIoOptional.
|
overrideprivatevirtual |
Sets the state of the line.
Callers are responsible to wait for the voltage level to settle after this call returns.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: The state has been set. * * FAILED_PRECONDITION: The line has not been enabled. * * Returns other status codes as defined by the backend. * *
Implements pw::digital_io::DigitalIoOptional.