Function esp_idf_svc::hal::sys::timer_isr_callback_add

source ·
pub unsafe extern "C" fn timer_isr_callback_add(
    group_num: u32,
    timer_num: u32,
    isr_handler: Option<unsafe extern "C" fn(_: *mut c_void) -> bool>,
    arg: *mut c_void,
    intr_alloc_flags: i32,
) -> i32
Expand description

@brief Add ISR handle callback for the corresponding timer.

@param group_num Timer group number @param timer_num Timer index of timer group @param isr_handler Interrupt handler function, it is a callback 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.

@note This ISR handler will be called from an ISR. This ISR handler do not need to handle interrupt status, and should be kept short. If you want to realize some specific applications or write the whole ISR, you can call timer_isr_register(…) to register ISR.

  The callback should return a bool value to determine whether need to do YIELD at
  the end of the ISR.

  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.

@return - ESP_OK Success - ESP_ERR_INVALID_ARG Parameter error