WPILibC++ 2024.3.2
Notifier Functions

Functions

HAL_NotifierHandle HAL_InitializeNotifier (int32_t *status)
 Initializes a notifier. More...
 
HAL_Bool HAL_SetNotifierThreadPriority (HAL_Bool realTime, int32_t priority, int32_t *status)
 Sets the HAL notifier thread priority. More...
 
void HAL_SetNotifierName (HAL_NotifierHandle notifierHandle, const char *name, int32_t *status)
 Sets the name of a notifier. More...
 
void HAL_StopNotifier (HAL_NotifierHandle notifierHandle, int32_t *status)
 Stops a notifier from running. More...
 
void HAL_CleanNotifier (HAL_NotifierHandle notifierHandle, int32_t *status)
 Cleans a notifier. More...
 
void HAL_UpdateNotifierAlarm (HAL_NotifierHandle notifierHandle, uint64_t triggerTime, int32_t *status)
 Updates the trigger time for a notifier. More...
 
void HAL_CancelNotifierAlarm (HAL_NotifierHandle notifierHandle, int32_t *status)
 Cancels the next notifier alarm. More...
 
WPI_NODISCARD uint64_t HAL_WaitForNotifierAlarm (HAL_NotifierHandle notifierHandle, int32_t *status)
 Waits for the next alarm for the specific notifier. More...
 

Detailed Description

Function Documentation

◆ HAL_CancelNotifierAlarm()

void HAL_CancelNotifierAlarm ( HAL_NotifierHandle  notifierHandle,
int32_t *  status 
)

Cancels the next notifier alarm.

This does not cause HAL_WaitForNotifierAlarm to return.

Parameters
[in]notifierHandlethe notifier handle
[out]statusError status variable. 0 on success.

◆ HAL_CleanNotifier()

void HAL_CleanNotifier ( HAL_NotifierHandle  notifierHandle,
int32_t *  status 
)

Cleans a notifier.

Note this also stops a notifier if it is already running.

Parameters
[in]notifierHandlethe notifier handle
[out]statusError status variable. 0 on success.

◆ HAL_InitializeNotifier()

HAL_NotifierHandle HAL_InitializeNotifier ( int32_t *  status)

Initializes a notifier.

A notifier is an FPGA controller timer that triggers at requested intervals based on the FPGA time. This can be used to make precise control loops.

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

◆ HAL_SetNotifierName()

void HAL_SetNotifierName ( HAL_NotifierHandle  notifierHandle,
const char *  name,
int32_t *  status 
)

Sets the name of a notifier.

Parameters
[in]notifierHandlethe notifier handle
[in]namename
[out]statusError status variable. 0 on success.

◆ HAL_SetNotifierThreadPriority()

HAL_Bool HAL_SetNotifierThreadPriority ( HAL_Bool  realTime,
int32_t  priority,
int32_t *  status 
)

Sets the HAL notifier thread priority.

The HAL notifier thread is responsible for managing the FPGA's notifier interrupt and waking up user's Notifiers when it's their time to run. Giving the HAL notifier thread real-time priority helps ensure the user's real-time Notifiers, if any, are notified to run in a timely manner.

Parameters
[in]realTimeSet to true to set a real-time priority, false for standard priority.
[in]priorityPriority to set the thread to. For real-time, this is 1-99 with 99 being highest. For non-real-time, this is forced to 0. See "man 7 sched" for more details.
[out]statusError status variable. 0 on success.
Returns
True on success.

◆ HAL_StopNotifier()

void HAL_StopNotifier ( HAL_NotifierHandle  notifierHandle,
int32_t *  status 
)

Stops a notifier from running.

This will cause any call into HAL_WaitForNotifierAlarm to return with time = 0.

Parameters
[in]notifierHandlethe notifier handle
[out]statusError status variable. 0 on success.

◆ HAL_UpdateNotifierAlarm()

void HAL_UpdateNotifierAlarm ( HAL_NotifierHandle  notifierHandle,
uint64_t  triggerTime,
int32_t *  status 
)

Updates the trigger time for a notifier.

Note that this time is an absolute time relative to HAL_GetFPGATime()

Parameters
[in]notifierHandlethe notifier handle
[in]triggerTimethe updated trigger time
[out]statusError status variable. 0 on success.

◆ HAL_WaitForNotifierAlarm()

WPI_NODISCARD uint64_t HAL_WaitForNotifierAlarm ( HAL_NotifierHandle  notifierHandle,
int32_t *  status 
)

Waits for the next alarm for the specific notifier.

This is a blocking call until either the time elapses or HAL_StopNotifier gets called. If the latter occurs, this function will return zero and any loops using this function should exit. Failing to do so can lead to use-after-frees.

Parameters
[in]notifierHandlethe notifier handle
[out]statusError status variable. 0 on success.
Returns
the FPGA time the notifier returned