◆ ClearInterruptHandler()
Status pw::digital_io::DigitalIoOptional::ClearInterruptHandler |
( |
| ) |
|
|
inline |
Clears the interrupt handler and disables any existing interrupts that are enabled.
- Warning
- This method is not thread-safe and cannot be used in interrupt handlers.
- Returns
- OK: The interrupt handler was cleared.
- Returns other status codes as defined by the backend.
◆ DisableInterruptHandler()
Status pw::digital_io::DigitalIoOptional::DisableInterruptHandler |
( |
| ) |
|
|
inline |
Disables the interrupt handler. This is a no-op if interrupts are disabled.
This method can be called inside the interrupt handler for this line without any external synchronization. However, the exact behavior is backend-specific. There may be queued events that will trigger the handler again after this call returns.
- Returns
- OK: The interrupt handler was disabled.
- Returns other status codes as defined by the backend.
◆ EnableInterruptHandler()
Status pw::digital_io::DigitalIoOptional::EnableInterruptHandler |
( |
| ) |
|
|
inline |
Enables interrupts which will trigger the interrupt handler.
- Warning
- This method is not thread-safe and cannot be used in interrupt handlers.
- Precondition
- A handler has been set using
SetInterruptHandler()
.
- Returns
- OK: The interrupt handler was configured.
- FAILED_PRECONDITION: The line has not been enabled.
- Returns other status codes as defined by the backend.
◆ SetInterruptHandler()
Status pw::digital_io::DigitalIoOptional::SetInterruptHandler |
( |
InterruptTrigger |
trigger, |
|
|
InterruptHandler && |
handler |
|
) |
| |
|
inline |
Sets 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. Do not do any blocking or expensive work in the handler. The only universally safe operations are the IRQ-safe functions on pw_sync
primitives.
In particular, it is NOT safe to get the state of a DigitalIo
line—either from this line or any other DigitalIoOptional
instance—inside the handler.
- Warning
- This method is not thread-safe and cannot be used in interrupt handlers.
- Precondition
- No handler is currently set.
- Returns
- OK: The interrupt handler was configured.
- INVALID_ARGUMENT: The handler is empty.
- 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
- 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
- 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
- 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: