C/C++ API Reference
Loading...
Searching...
No Matches
pw::digital_io::DigitalInOut Class Reference
Inheritance diagram for pw::digital_io::DigitalInOut:
pw::digital_io::DigitalIoOptional pw::digital_io::DigitalInOutMockImpl pw::digital_io::DigitalInOutMock< kCapacity >

Public Member Functions

Result< State > GetState ()
 
Result< bool > IsStateActive ()
 
Status SetState (State state)
 
Status SetStateActive ()
 
Status SetStateInactive ()
 
- 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

Status DoSetInterruptHandler (InterruptTrigger, InterruptHandler &&) final
 
Status DoEnableInterruptHandler (bool) final
 

Member Function Documentation

◆ GetState()

Result< State > pw::digital_io::DigitalIoOptional::GetState ( )
inline

Gets the state of the line.

Warning
This method is not thread-safe and cannot be used in interrupt handlers.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Returns an active or inactive state.
* 
*     FAILED_PRECONDITION: The line has not been enabled.
* 
*  Returns Other status codes as defined by the backend.
* 
*  

◆ IsStateActive()

Result< bool > pw::digital_io::DigitalIoOptional::IsStateActive ( )
inline

Checks if the line is in the active state.

The line is in the active state when GetState() returns State::kActive.

Warning
This method is not thread-safe and cannot be used in interrupt handlers.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: ``true`` if the line is in the active state, otherwise ``false``.
* 
*     FAILED_PRECONDITION: The line has not been enabled.
* 
*  Returns other status codes as defined by the backend.
* 
*  

◆ SetState()

Status pw::digital_io::DigitalIoOptional::SetState ( State  state)
inline

Sets the state of the line.

Callers are responsible to wait for the voltage level to settle after this call returns.

Warning
This method is not thread-safe and cannot be used in interrupt handlers.
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.
* 
*  

◆ SetStateActive()

Status pw::digital_io::DigitalIoOptional::SetStateActive ( )
inline

Sets the line to the active state. Equivalent to SetState(State::kActive).

Callers are responsible to wait for the voltage level to settle after this call returns.

Warning
This method is not thread-safe and cannot be used in interrupt handlers.
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.
* 
*  

◆ SetStateInactive()

Status pw::digital_io::DigitalIoOptional::SetStateInactive ( )
inline

Sets the line to the inactive state. Equivalent to SetState(State::kInactive).

Callers are responsible to wait for the voltage level to settle after this call returns.

Warning
This method is not thread-safe and cannot be used in interrupt handlers.
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.
* 
*  

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