Function esp_idf_sys::timer_isr_register

source ·
pub unsafe extern "C" fn timer_isr_register(
    group_num: timer_group_t,
    timer_num: timer_idx_t,
    fn_: Option<unsafe extern "C" fn(arg1: *mut c_void)>,
    arg: *mut c_void,
    intr_alloc_flags: c_int,
    handle: *mut timer_isr_handle_t,
) -> esp_err_t
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