mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 10:00:57 +02:00
change(esp_timer): esp_timer_init_os now returns ESP_OK if already initialized
Previously it would return ESP_ERR_INVALID_STATE, which meant that if called from user-code before the system tries to initialize the timer then esp-idf would fail to boot. This could happen if a user wanted to use esp-timer from a cpp constructor. Closes https://github.com/espressif/esp-idf/issues/9679
This commit is contained in:
@@ -564,7 +564,13 @@ esp_err_t esp_timer_init(void)
|
|||||||
*/
|
*/
|
||||||
ESP_SYSTEM_INIT_FN(esp_timer_init_os, SECONDARY, ESP_TIMER_INIT_MASK, 100)
|
ESP_SYSTEM_INIT_FN(esp_timer_init_os, SECONDARY, ESP_TIMER_INIT_MASK, 100)
|
||||||
{
|
{
|
||||||
return esp_timer_init();
|
esp_err_t err = ESP_OK;
|
||||||
|
if (is_initialized()) {
|
||||||
|
err = ESP_OK;
|
||||||
|
} else {
|
||||||
|
err = esp_timer_init();
|
||||||
|
}
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t esp_timer_deinit(void)
|
esp_err_t esp_timer_deinit(void)
|
||||||
|
Reference in New Issue
Block a user