Function esp_idf_sys::pcnt_isr_handler_add

source ·
pub unsafe extern "C" fn pcnt_isr_handler_add(
    unit: pcnt_unit_t,
    isr_handler: Option<unsafe extern "C" fn(arg1: *mut c_void)>,
    args: *mut c_void,
) -> esp_err_t
Expand description

@brief Add ISR handler for specified unit.

Call this function after using pcnt_isr_service_install() to install the PCNT driver’s ISR handler service.

The ISR handlers do not need to be declared with IRAM_ATTR, unless you pass the ESP_INTR_FLAG_IRAM flag when allocating the ISR in pcnt_isr_service_install().

This ISR handler will be called from an ISR. So there is a stack size limit (configurable as “ISR stack size” in menuconfig). This limit is smaller compared to a global PCNT interrupt handler due to the additional level of indirection.

@param unit PCNT unit number @param isr_handler Interrupt handler function. @param args Parameter for handler function

@return - ESP_OK Success - ESP_ERR_INVALID_STATE pcnt driver has not been initialized - ESP_ERR_INVALID_ARG Parameter error