Function esp_idf_svc::sys::timer_isr_register
source · pub unsafe extern "C" fn timer_isr_register(
group_num: u32,
timer_num: u32,
fn_: Option<unsafe extern "C" fn(_: *mut c_void)>,
arg: *mut c_void,
intr_alloc_flags: i32,
handle: *mut *mut intr_handle_data_t,
) -> i32
Expand description
@brief Register Timer interrupt handler, the handler is an ISR. The handler will be attached to the same CPU core that this function is running on.
@param group_num Timer group number @param timer_num Timer index of timer group @param fn Interrupt handler function. @param arg Parameter for handler function @param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred) ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info. @param handle Pointer to return handle. If non-NULL, a handle for the interrupt will be returned here.
@note If use this function to reigster ISR, you need to write the whole ISR. In the interrupt handler, you need to call timer_spinlock_take(..) before your handling, and call timer_spinlock_give(…) after your handling.
If the intr_alloc_flags value ESP_INTR_FLAG_IRAM is set,
the handler function must be declared with IRAM_ATTR attribute
and can only call functions in IRAM or ROM. It cannot call other timer APIs.
Use direct register access to configure timers from inside the ISR in this case.
@return - ESP_OK Success - ESP_ERR_INVALID_ARG Parameter error