Class for handling synchronous (blocking) interrupts.
More...
#include <frc/SynchronousInterrupt.h>
Class for handling synchronous (blocking) interrupts.
By default, interrupts will occur on rising edge.
Asynchronous interrupts are handled by the AsynchronousInterrupt class.
◆ WaitResult
Event trigger combinations for a synchronous interrupt.
Enumerator |
---|
kTimeout | |
kRisingEdge | |
kFallingEdge | |
kBoth | |
◆ SynchronousInterrupt() [1/4]
frc::SynchronousInterrupt::SynchronousInterrupt |
( |
DigitalSource & |
source | ) |
|
|
explicit |
Construct a Synchronous Interrupt from a Digital Source.
- Parameters
-
◆ SynchronousInterrupt() [2/4]
frc::SynchronousInterrupt::SynchronousInterrupt |
( |
DigitalSource * |
source | ) |
|
|
explicit |
Construct a Synchronous Interrupt from a Digital Source.
- Parameters
-
◆ SynchronousInterrupt() [3/4]
frc::SynchronousInterrupt::SynchronousInterrupt |
( |
std::shared_ptr< DigitalSource > |
source | ) |
|
|
explicit |
Construct a Synchronous Interrupt from a Digital Source.
- Parameters
-
◆ ~SynchronousInterrupt()
frc::SynchronousInterrupt::~SynchronousInterrupt |
( |
| ) |
|
◆ SynchronousInterrupt() [4/4]
◆ GetFallingTimestamp()
units::second_t frc::SynchronousInterrupt::GetFallingTimestamp |
( |
| ) |
|
Get the timestamp of the last falling edge.
This function does not require the interrupt to be enabled to work.
This only works if falling edge was configured using setInterruptEdges.
- Returns
- the timestamp in seconds relative to getFPGATime
◆ GetRisingTimestamp()
units::second_t frc::SynchronousInterrupt::GetRisingTimestamp |
( |
| ) |
|
Get the timestamp (relative to FPGA Time) of the last rising edge.
- Returns
- the timestamp in seconds relative to getFPGATime
◆ operator=()
◆ SetInterruptEdges()
void frc::SynchronousInterrupt::SetInterruptEdges |
( |
bool |
risingEdge, |
|
|
bool |
fallingEdge |
|
) |
| |
Set which edges cause an interrupt to occur.
- Parameters
-
risingEdge | true to trigger on rising edge, false otherwise. |
fallingEdge | true to trigger on falling edge, false otherwise |
◆ WaitForInterrupt()
WaitResult frc::SynchronousInterrupt::WaitForInterrupt |
( |
units::second_t |
timeout, |
|
|
bool |
ignorePrevious = true |
|
) |
| |
Wait for an interrupt to occur.
Both rising and falling edge can be returned if both a rising and falling happened between calls, and ignorePrevious is false.
- Parameters
-
timeout | The timeout to wait for. 0s or less will return immediately. |
ignorePrevious | True to ignore any previous interrupts, false to return interrupt value if an interrupt has occurred since last call. |
- Returns
- The edge(s) that were triggered, or timeout.
◆ WakeupWaitingInterrupt()
void frc::SynchronousInterrupt::WakeupWaitingInterrupt |
( |
| ) |
|
Wake up an existing wait call.
Can be called from any thread.
The documentation for this class was generated from the following file: