system_api: add esp_unregister_shutdown_handler

This commit is contained in:
Ivan Grokhotkov
2019-04-08 19:29:44 +08:00
parent b94fcb192e
commit bd309a133f
2 changed files with 22 additions and 0 deletions

View File

@@ -221,6 +221,17 @@ esp_err_t esp_register_shutdown_handler(shutdown_handler_t handler)
return ESP_FAIL;
}
esp_err_t esp_unregister_shutdown_handler(shutdown_handler_t handler)
{
for (int i = 0; i < SHUTDOWN_HANDLERS_NO; i++) {
if (shutdown_handlers[i] == handler) {
shutdown_handlers[i] = NULL;
return ESP_OK;
}
}
return ESP_ERR_INVALID_STATE;
}
void esp_restart_noos() __attribute__ ((noreturn));
void IRAM_ATTR esp_restart(void)