Pigweed
 
Loading...
Searching...
No Matches
pw::digital_io::McuxpressoDigitalIn Class Reference

#include <digital_io.h>

Inheritance diagram for pw::digital_io::McuxpressoDigitalIn:
pw::digital_io::DigitalIn pw::digital_io::DigitalIoOptional

Public Member Functions

 McuxpressoDigitalIn (GPIO_Type *base, uint32_t port, uint32_t pin)
 
bool is_enabled () const
 Returns true if the input is enabled.
 
- Public Member Functions inherited from pw::digital_io::DigitalIn
Result< State > GetState ()
 
Result< bool > IsStateActive ()
 
- Public Member Functions inherited from pw::digital_io::DigitalIoOptional
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
 

Detailed Description

Provides input-only support for an MCUXpresso GPIO pin.

Class-specific behaviors:

  • The input buffer for the pin must be enabled in the IO Pad Controller (IOPCTL) via the Input Buffer Enable (IBENA) bit.
  • The input polarity is affected by the Input Invert Enable (IIENA) bit on the corresponding IO Pad Controller (IOPCTL) register.

Constructor & Destructor Documentation

◆ McuxpressoDigitalIn()

pw::digital_io::McuxpressoDigitalIn::McuxpressoDigitalIn ( GPIO_Type *  base,
uint32_t  port,
uint32_t  pin 
)

Constructs a McuxpressoDigitalIn for a specific GPIO module+port+pin.

Parameters
[in]baseThe base address of the GPIO module (e.g. GPIO).
[in]portThe port number on the given GPIO module.
[in]pinThe pin number on the given GPIO port.

Member Function Documentation

◆ DoEnable()

pw::Status pw::digital_io::McuxpressoDigitalIn::DoEnable ( bool  enable)
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.

Precondition
This method cannot be used in interrupt contexts.
When disabling, the interrupt handler must already be disabled.
Returns
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.

◆ DoGetState()

pw::Result< pw::digital_io::State > pw::digital_io::McuxpressoDigitalIn::DoGetState ( )
overrideprivatevirtual

Gets the state of the line.

Precondition
This method cannot be used in interrupt contexts.
Returns
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.


The documentation for this class was generated from the following file: