WPILibC++ 2023.4.3-108-ge5452e3
Interrupts Functions

Functions

HAL_InterruptHandle HAL_InitializeInterrupts (int32_t *status)
 Initializes an interrupt. More...
 
void HAL_CleanInterrupts (HAL_InterruptHandle interruptHandle)
 Frees an interrupt. More...
 
int64_t HAL_WaitForInterrupt (HAL_InterruptHandle interruptHandle, double timeout, HAL_Bool ignorePrevious, int32_t *status)
 Waits for the defined interrupt to occur. More...
 
int64_t HAL_WaitForMultipleInterrupts (HAL_InterruptHandle interruptHandle, int64_t mask, double timeout, HAL_Bool ignorePrevious, int32_t *status)
 Waits for any interrupt covered by the mask to occur. More...
 
int64_t HAL_ReadInterruptRisingTimestamp (HAL_InterruptHandle interruptHandle, int32_t *status)
 Returns the timestamp for the rising interrupt that occurred most recently. More...
 
int64_t HAL_ReadInterruptFallingTimestamp (HAL_InterruptHandle interruptHandle, int32_t *status)
 Returns the timestamp for the falling interrupt that occurred most recently. More...
 
void HAL_RequestInterrupts (HAL_InterruptHandle interruptHandle, HAL_Handle digitalSourceHandle, HAL_AnalogTriggerType analogTriggerType, int32_t *status)
 Requests interrupts on a specific digital source. More...
 
void HAL_SetInterruptUpSourceEdge (HAL_InterruptHandle interruptHandle, HAL_Bool risingEdge, HAL_Bool fallingEdge, int32_t *status)
 Sets the edges to trigger the interrupt on. More...
 
void HAL_ReleaseWaitingInterrupt (HAL_InterruptHandle interruptHandle, int32_t *status)
 Releases a waiting interrupt. More...
 

Detailed Description

Function Documentation

◆ HAL_CleanInterrupts()

void HAL_CleanInterrupts ( HAL_InterruptHandle  interruptHandle)

Frees an interrupt.

Parameters
interruptHandlethe interrupt handle

◆ HAL_InitializeInterrupts()

HAL_InterruptHandle HAL_InitializeInterrupts ( int32_t *  status)

Initializes an interrupt.

Parameters
[out]statusError status variable. 0 on success.
Returns
the created interrupt handle

◆ HAL_ReadInterruptFallingTimestamp()

int64_t HAL_ReadInterruptFallingTimestamp ( HAL_InterruptHandle  interruptHandle,
int32_t *  status 
)

Returns the timestamp for the falling interrupt that occurred most recently.

This is in the same time domain as HAL_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
[in]interruptHandlethe interrupt handle
[out]statusError status variable. 0 on success.
Returns
timestamp in microseconds since FPGA Initialization

◆ HAL_ReadInterruptRisingTimestamp()

int64_t HAL_ReadInterruptRisingTimestamp ( HAL_InterruptHandle  interruptHandle,
int32_t *  status 
)

Returns the timestamp for the rising interrupt that occurred most recently.

This is in the same time domain as HAL_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
[in]interruptHandlethe interrupt handle
[out]statusError status variable. 0 on success.
Returns
timestamp in microseconds since FPGA Initialization

◆ HAL_ReleaseWaitingInterrupt()

void HAL_ReleaseWaitingInterrupt ( HAL_InterruptHandle  interruptHandle,
int32_t *  status 
)

Releases a waiting interrupt.

This will release both rising and falling waiters.

Parameters
[in]interruptHandlethe interrupt handle to release
[out]statusError status variable. 0 on success.

◆ HAL_RequestInterrupts()

void HAL_RequestInterrupts ( HAL_InterruptHandle  interruptHandle,
HAL_Handle  digitalSourceHandle,
HAL_AnalogTriggerType  analogTriggerType,
int32_t *  status 
)

Requests interrupts on a specific digital source.

Parameters
[in]interruptHandlethe interrupt handle
[in]digitalSourceHandlethe digital source handle (either a HAL_AnalogTriggerHandle or a HAL_DigitalHandle)
[in]analogTriggerTypethe trigger type if the source is an AnalogTrigger
[out]statusError status variable. 0 on success.

◆ HAL_SetInterruptUpSourceEdge()

void HAL_SetInterruptUpSourceEdge ( HAL_InterruptHandle  interruptHandle,
HAL_Bool  risingEdge,
HAL_Bool  fallingEdge,
int32_t *  status 
)

Sets the edges to trigger the interrupt on.

Note that both edges triggered is a valid configuration.

Parameters
[in]interruptHandlethe interrupt handle
[in]risingEdgetrue for triggering on rising edge
[in]fallingEdgetrue for triggering on falling edge
[out]statusError status variable. 0 on success.

◆ HAL_WaitForInterrupt()

int64_t HAL_WaitForInterrupt ( HAL_InterruptHandle  interruptHandle,
double  timeout,
HAL_Bool  ignorePrevious,
int32_t *  status 
)

Waits for the defined interrupt to occur.

Parameters
[in]interruptHandlethe interrupt handle
[in]timeouttimeout in seconds
[in]ignorePreviousif true, ignore interrupts that happened before waitForInterrupt was called
[out]statusError status variable. 0 on success.
Returns
the mask of interrupts that fired

◆ HAL_WaitForMultipleInterrupts()

int64_t HAL_WaitForMultipleInterrupts ( HAL_InterruptHandle  interruptHandle,
int64_t  mask,
double  timeout,
HAL_Bool  ignorePrevious,
int32_t *  status 
)

Waits for any interrupt covered by the mask to occur.

Parameters
[in]interruptHandlethe interrupt handle to use for the context
[in]maskthe mask of interrupts to wait for
[in]timeouttimeout in seconds
[in]ignorePreviousif true, ignore interrupts that happened before waitForInterrupt was called
[out]statusError status variable. 0 on success.
Returns
the mask of interrupts that fired