Function esp_idf_svc::hal::sys::gpio_isr_handler_add
source · pub unsafe extern "C" fn gpio_isr_handler_add(
gpio_num: i32,
isr_handler: Option<unsafe extern "C" fn(_: *mut c_void)>,
args: *mut c_void,
) -> i32
Expand description
@brief Add ISR handler for the corresponding GPIO pin.
Call this function after using gpio_install_isr_service() to install the driver’s GPIO ISR handler service.
The pin ISR handlers no longer need to be declared with IRAM_ATTR, unless you pass the ESP_INTR_FLAG_IRAM flag when allocating the ISR in gpio_install_isr_service().
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 GPIO interrupt handler due to the additional level of indirection.
@param gpio_num GPIO number @param isr_handler ISR handler function for the corresponding GPIO number. @param args parameter for ISR handler.
@return - ESP_OK Success - ESP_ERR_INVALID_STATE Wrong state, the ISR service has not been initialized. - ESP_ERR_INVALID_ARG Parameter error