Package edu.wpi.first.hal
Class InterruptJNI
java.lang.Object
edu.wpi.first.hal.JNIWrapper
edu.wpi.first.hal.InterruptJNI
Interrupt HAL JNI functions.
- See Also:
-
- "hal/Interrupts.h"
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.wpi.first.hal.JNIWrapper
JNIWrapper.Helper -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanInterrupts(int interruptHandle) Frees an interrupt.static intInitializes an interrupt.static longreadInterruptFallingTimestamp(int interruptHandle) Returns the timestamp for the falling interrupt that occurred most recently.static longreadInterruptRisingTimestamp(int interruptHandle) Returns the timestamp for the rising interrupt that occurred most recently.static voidreleaseWaitingInterrupt(int interruptHandle) Releases a waiting interrupt.static voidrequestInterrupts(int interruptHandle, int digitalSourceHandle, int analogTriggerType) Requests interrupts on a specific digital source.static voidsetInterruptUpSourceEdge(int interruptHandle, boolean risingEdge, boolean fallingEdge) Sets the edges to trigger the interrupt on.static longwaitForInterrupt(int interruptHandle, double timeout, boolean ignorePrevious) Waits for the defined interrupt to occur.static longwaitForMultipleInterrupts(int interruptHandle, long mask, double timeout, boolean ignorePrevious) Waits for any interrupt covered by the mask to occur.Methods inherited from class edu.wpi.first.hal.JNIWrapper
forceLoad, suppressUnused
-
Field Details
-
HalInvalidHandle
Invalid handle value.- See Also:
-
-
Method Details
-
initializeInterrupts
Initializes an interrupt.- Returns:
- the created interrupt handle
- See Also:
-
- "HAL_InitializeInterrupts"
-
cleanInterrupts
Frees an interrupt.- Parameters:
interruptHandle- the interrupt handle- See Also:
-
- "HAL_CleanInterrupts"
-
waitForInterrupt
Waits for the defined interrupt to occur.- Parameters:
interruptHandle- the interrupt handletimeout- timeout in secondsignorePrevious- if true, ignore interrupts that happened before waitForInterrupt was called- Returns:
- the mask of interrupts that fired
- See Also:
-
- "HAL_WaitForInterrupt"
-
waitForMultipleInterrupts
public static long waitForMultipleInterrupts(int interruptHandle, long mask, double timeout, boolean ignorePrevious) Waits for any interrupt covered by the mask to occur.- Parameters:
interruptHandle- the interrupt handle to use for the contextmask- the mask of interrupts to wait fortimeout- timeout in secondsignorePrevious- if true, ignore interrupts that happened before waitForInterrupt was called- Returns:
- the mask of interrupts that fired
- See Also:
-
- "HAL_WaitForMultipleInterrupts"
-
readInterruptRisingTimestamp
Returns the timestamp for the rising interrupt that occurred most recently.This is in the same time domain as getFPGATime(). It only contains the bottom 32 bits of the timestamp. If your robot has been running for over 1 hour, you will need to fill in the upper 32 bits yourself.
- Parameters:
interruptHandle- the interrupt handle- Returns:
- timestamp in microseconds since FPGA Initialization
-
readInterruptFallingTimestamp
Returns the timestamp for the falling interrupt that occurred most recently.This is in the same time domain as getFPGATime(). It only contains the bottom 32 bits of the timestamp. If your robot has been running for over 1 hour, you will need to fill in the upper 32 bits yourself.
- Parameters:
interruptHandle- the interrupt handle- Returns:
- timestamp in microseconds since FPGA Initialization
-
requestInterrupts
public static void requestInterrupts(int interruptHandle, int digitalSourceHandle, int analogTriggerType) Requests interrupts on a specific digital source.- Parameters:
interruptHandle- the interrupt handledigitalSourceHandle- the digital source handle (either a HAL_AnalogTriggerHandle or a HAL_DigitalHandle)analogTriggerType- the trigger type if the source is an AnalogTrigger- See Also:
-
- "HAL_RequestInterrupts"
-
setInterruptUpSourceEdge
public static void setInterruptUpSourceEdge(int interruptHandle, boolean risingEdge, boolean fallingEdge) Sets the edges to trigger the interrupt on.Note that both edges triggered is a valid configuration.
- Parameters:
interruptHandle- the interrupt handlerisingEdge- true for triggering on rising edgefallingEdge- true for triggering on falling edge- See Also:
-
- "HAL_SetInterruptUpSourceEdge"
-
releaseWaitingInterrupt
Releases a waiting interrupt.This will release both rising and falling waiters.
- Parameters:
interruptHandle- the interrupt handle to release- See Also:
-
- "HAL_ReleaseWaitingInterrupt"
-