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

#include <pint.h>

Inheritance diagram for pw::digital_io::McuxpressoPintInterrupt:
pw::digital_io::DigitalInterrupt pw::digital_io::DigitalIoOptional

Public Member Functions

 McuxpressoPintInterrupt (pw::sync::Borrowable< McuxpressoPintController > &controller, pint_pin_int_t pin)
 
 McuxpressoPintInterrupt (const McuxpressoPintInterrupt &)=delete
 
McuxpressoPintInterruptoperator= (const McuxpressoPintInterrupt &)=delete
 
- Public Member Functions inherited from pw::digital_io::DigitalInterrupt
Status ClearInterruptHandler ()
 
Status DisableInterruptHandler ()
 
Status EnableInterruptHandler ()
 
Status SetInterruptHandler (InterruptTrigger trigger, InterruptHandler &&handler)
 
- 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::Status DoSetInterruptHandler (pw::digital_io::InterruptTrigger trigger, pw::digital_io::InterruptHandler &&handler) override
 
pw::Status DoEnableInterruptHandler (bool enable) override
 

Detailed Description

Represents one interrupt on the PINT module.

Class-specific behaviors:

  • The pin must be attached to the PINT module via INPUTMUX_AttachSignal().
  • Enable and Disable have no effect.
  • 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

◆ McuxpressoPintInterrupt()

pw::digital_io::McuxpressoPintInterrupt::McuxpressoPintInterrupt ( pw::sync::Borrowable< McuxpressoPintController > &  controller,
pint_pin_int_t  pin 
)

Constructs a McuxpressoPintInterrupt for a specific pin.

Parameters
[in]controllerA pw::sync::Borrowable reference to the McuxpressoPintInterrupt representing the PINT module.
[in]pinThe pint_pin_int_t enum member identifying the pin interrupt on the PINT module.

Member Function Documentation

◆ DoEnable()

pw::Status pw::digital_io::McuxpressoPintInterrupt::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.

◆ DoEnableInterruptHandler()

pw::Status pw::digital_io::McuxpressoPintInterrupt::DoEnableInterruptHandler ( bool  enable)
overrideprivatevirtual

Enables or disables interrupts which will trigger the interrupt handler.

Warning
This interrupt handler disabling must be both thread-safe and, interrupt-safe, however enabling is not interrupt-safe and not thread-safe.
Precondition
When enabling, a handler must have been set using DoSetInterruptHandler().
Interrupt handler enabling cannot be used in interrupt contexts.
Returns
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.

◆ DoSetInterruptHandler()

pw::Status pw::digital_io::McuxpressoPintInterrupt::DoSetInterruptHandler ( pw::digital_io::InterruptTrigger  trigger,
pw::digital_io::InterruptHandler &&  handler 
)
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).

Precondition
This method cannot be used in interrupt contexts.
If setting a handler, no handler is permitted to be currently set.
When cleaing a handler, the interrupt handler must be disabled.
Returns
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.


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