Chapter 2. API Reference
Warning Idle callbacks MUST NOT, UNDER ANY CIRCUMSTANCES, CALL A FUNCTION THAT
MIGHT BLOCK.
Return
• ESP_OK: Callback registered to the specified core’s idle hook
• ESP_ERR_NO_MEM: No more space on the specified core’s idle hook to register callback
• ESP_ERR_INVALID_ARG: cpuid is invalid
Parameters
• [in] new_idle_cb: Callback to be called
• [in] cpuid: id of the core
esp_err_t esp_register_freertos_idle_hook(esp_freertos_idle_cb_t new_idle_cb)
Register a callback to the idle hook of the core that calls this function. The callback should return true if it
should be called by the idle hook once per interrupt (or FreeRTOS tick), and return false if it should be called
repeatedly as fast as possible by the idle hook.
Warning Idle callbacks MUST NOT, UNDER ANY CIRCUMSTANCES, CALL A FUNCTION THAT
MIGHT BLOCK.
Return
• ESP_OK: Callback registered to the calling core’s idle hook
• ESP_ERR_NO_MEM: No more space on the calling core’s idle hook to register callback
Parameters
• [in] new_idle_cb: Callback to be called
esp_err_t esp_register_freertos_tick_hook_for_cpu(esp_freertos_tick_cb_t new_tick_cb,
UBaseType_t cpuid)
Register a callback to be called from the specified core’s tick hook.
Return
• ESP_OK: Callback registered to specified core’s tick hook
• ESP_ERR_NO_MEM: No more space on the specified core’s tick hook to register the callback
• ESP_ERR_INVALID_ARG: cpuid is invalid
Parameters
• [in] new_tick_cb: Callback to be called
• [in] cpuid: id of the core
esp_err_t esp_register_freertos_tick_hook(esp_freertos_tick_cb_t new_tick_cb)
Register a callback to be called from the calling core’s tick hook.
Return
• ESP_OK: Callback registered to the calling core’s tick hook
• ESP_ERR_NO_MEM: No more space on the calling core’s tick hook to register the callback
Parameters
• [in] new_tick_cb: Callback to be called
void esp_deregister_freertos_idle_hook_for_cpu(esp_freertos_idle_cb_t old_idle_cb,
UBaseType_t cpuid)
Unregister an idle callback from the idle hook of the specified core.
Parameters
• [in] old_idle_cb: Callback to be unregistered
• [in] cpuid: id of the core
void esp_deregister_freertos_idle_hook(esp_freertos_idle_cb_t old_idle_cb)
Unregister an idle callback. If the idle callback is registered to the idle hooks of both cores, the idle hook will
be unregistered from both cores.
Parameters
• [in] old_idle_cb: Callback to be unregistered
void esp_deregister_freertos_tick_hook_for_cpu(esp_freertos_tick_cb_t old_tick_cb,
UBaseType_t cpuid)
Unregister a tick callback from the tick hook of the specified core.
Parameters
• [in] old_tick_cb: Callback to be unregistered
Espressif Systems 971
Submit Document Feedback
Release v4.4