Function esp_idf_sys::pcnt_unit_set_glitch_filter

source ·
pub unsafe extern "C" fn pcnt_unit_set_glitch_filter(
    unit: pcnt_unit_handle_t,
    config: *const pcnt_glitch_filter_config_t,
) -> esp_err_t
Expand description

@brief Set glitch filter for PCNT unit

@note The glitch filter module is clocked from APB, and APB frequency can be changed during DFS, which in return make the filter out of action. So this function will lazy-install a PM lock internally when the power management is enabled. With this lock, the APB frequency won’t be changed. The PM lock can be uninstalled in pcnt_del_unit(). @note This function should be called when the PCNT unit is in the init state (i.e. before calling pcnt_unit_enable())

@param[in] unit PCNT unit handle created by pcnt_new_unit() @param[in] config PCNT filter configuration, set config to NULL means disabling the filter function @return - ESP_OK: Set glitch filter successfully - ESP_ERR_INVALID_ARG: Set glitch filter failed because of invalid argument (e.g. glitch width is too big) - ESP_ERR_INVALID_STATE: Set glitch filter failed because the unit is not in the init state - ESP_FAIL: Set glitch filter failed because of other error