pub unsafe extern "C" fn hat_interrupt_callback_enable(
function: Option<unsafe extern "C" fn(arg1: *mut c_void)>,
user_data: *mut c_void,
) -> c_int
Expand description
Enable an interrupt callback function.
Set a function that will be called when a DAQ HAT interrupt occurs. The function must have a void return type and void * argument, such as:
void function(void* user_data)
The function will be called when the DAQ HAT interrupt signal becomes active, and cannot be called again until the interrupt signal becomes inactive. Active sources become inactive when manually cleared (such as reading the digital I/O inputs or clearing the interrupt enable.) If not latched, an active source also becomes inactive when the value returns to the original value (the value at the source before the interrupt was generated.)
The user_data argument can be used for passing a reference to anything needed by the callback function. It will be passed to the callback function when the interrupt occurs. Set it to NULL if not needed.
There may only be one callback function at a time; if you call this when a function is already set as the callback function then it will be replaced with the new function and the old function will no longer be called if an interrupt occurs.
The callback function may be disabled with hat_interrupt_callback_disable().
This function only applies when using devices that can generate an interrupt: - MCC 152
@param function The callback function. @param user_data The data to pass to the callback function. @return [RESULT_SUCCESS](@ref RESULT_SUCCESS) or [RESULT_UNDEFINED](@ref RESULT_UNDEFINED).