WPILibC++  2020.3.2-60-g3011ebe
Interrupts Functions

Typedefs

typedef void(* HAL_InterruptHandlerFunction) (uint32_t interruptAssertedMask, void *param)
 

Functions

HAL_InterruptHandle HAL_InitializeInterrupts (HAL_Bool watcher, int32_t *status)
 Initializes an interrupt. More...
 
void * HAL_CleanInterrupts (HAL_InterruptHandle interruptHandle, int32_t *status)
 Frees an interrupt. More...
 
int64_t HAL_WaitForInterrupt (HAL_InterruptHandle interruptHandle, double timeout, HAL_Bool ignorePrevious, int32_t *status)
 In synchronous mode, waits for the defined interrupt to occur. More...
 
void HAL_EnableInterrupts (HAL_InterruptHandle interruptHandle, int32_t *status)
 Enables interrupts to occur on this input. More...
 
void HAL_DisableInterrupts (HAL_InterruptHandle interruptHandle, int32_t *status)
 Disables interrupts without without deallocating structures. 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_AttachInterruptHandler (HAL_InterruptHandle interruptHandle, HAL_InterruptHandlerFunction handler, void *param, int32_t *status)
 Attaches an asynchronous interrupt handler to the interrupt. More...
 
void HAL_AttachInterruptHandlerThreaded (HAL_InterruptHandle interruptHandle, HAL_InterruptHandlerFunction handler, void *param, int32_t *status)
 Attaches an asynchronous interrupt handler to the interrupt. 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_AttachInterruptHandler()

void HAL_AttachInterruptHandler ( HAL_InterruptHandle  interruptHandle,
HAL_InterruptHandlerFunction  handler,
void *  param,
int32_t *  status 
)

Attaches an asynchronous interrupt handler to the interrupt.

This interrupt gets called directly on the FPGA interrupt thread, so will block other interrupts while running.

Parameters
interruptHandlethe interrupt handle
handlerthe handler function for the interrupt to call
parama parameter to be passed to the handler

◆ HAL_AttachInterruptHandlerThreaded()

void HAL_AttachInterruptHandlerThreaded ( HAL_InterruptHandle  interruptHandle,
HAL_InterruptHandlerFunction  handler,
void *  param,
int32_t *  status 
)

Attaches an asynchronous interrupt handler to the interrupt.

This interrupt gets called on a thread specific to the interrupt, so will not block other interrupts.

Parameters
interruptHandlethe interrupt handle
handlerthe handler function for the interrupt to call
parama parameter to be passed to the handler

◆ HAL_CleanInterrupts()

void* HAL_CleanInterrupts ( HAL_InterruptHandle  interruptHandle,
int32_t *  status 
)

Frees an interrupt.

Parameters
interruptHandlethe interrupt handle
Returns
the param passed to the interrupt, or nullptr if one wasn't passed.

◆ HAL_DisableInterrupts()

void HAL_DisableInterrupts ( HAL_InterruptHandle  interruptHandle,
int32_t *  status 
)

Disables interrupts without without deallocating structures.

Parameters
interruptHandlethe interrupt handle

◆ HAL_EnableInterrupts()

void HAL_EnableInterrupts ( HAL_InterruptHandle  interruptHandle,
int32_t *  status 
)

Enables interrupts to occur on this input.

Interrupts are disabled when the RequestInterrupt call is made. This gives time to do the setup of the other options before starting to field interrupts.

Parameters
interruptHandlethe interrupt handle

◆ HAL_InitializeInterrupts()

HAL_InterruptHandle HAL_InitializeInterrupts ( HAL_Bool  watcher,
int32_t *  status 
)

Initializes an interrupt.

Parameters
watchertrue for synchronous interrupts, false for asynchronous
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
interruptHandlethe interrupt handle
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
interruptHandlethe interrupt handle
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
interruptHandlethe interrupt handle to release

◆ 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
interruptHandlethe interrupt handle
digitalSourceHandlethe digital source handle (either a HAL_AnalogTriggerHandle of a HAL_DigitalHandle)
analogTriggerTypethe trigger type if the source is an AnalogTrigger

◆ 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
interruptHandlethe interrupt handle
risingEdgetrue for triggering on rising edge
fallingEdgetrue for triggering on falling edge

◆ HAL_WaitForInterrupt()

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

In synchronous mode, waits for the defined interrupt to occur.

Parameters
interruptHandlethe interrupt handle
timeouttimeout in seconds
ignorePreviousif true, ignore interrupts that happened before waitForInterrupt was called
Returns
the mask of interrupts that fired