Chapter 2. API Reference
Parameters
• timer: timer handle created using esp_timer_create
• period: timer period, in microseconds
esp_err_t esp_timer_stop(esp_timer_handle_t
Stop the timer.
This function stops the timer previously started using esp_timer_start_once or esp_timer_start_periodic.
Return
• ESP_OK on success
• ESP_ERR_INVALID_STATE if the timer is not running
Parameters
• timer: timer handle created using esp_timer_create
esp_err_t esp_timer_delete(esp_timer_handle_t
Delete an esp_timer instance.
The timer must be stopped before deleting. A one-shot timer which has expired does not need to be stopped.
Return
• ESP_OK on success
• ESP_ERR_INVALID_STATE if the timer is running
Parameters
• timer: timer handle allocated using esp_timer_create
int64_t esp_timer_get_time(void)
Get time in microseconds since boot.
Return number of microseconds since underlying timer has been started
int64_t esp_timer_get_next_alarm(void)
Get the timestamp when the next timeout is expected to occur.
Return Timestamp of the nearest timer event, in microseconds. The timebase is the same as for the values
returned by esp_timer_get_time.
int64_t esp_timer_get_next_alarm_for_wake_up(void)
Get the timestamp when the next timeout is expected to occur skipping those which have
skip_unhandled_events flag.
Return Timestamp of the nearest timer event, in microseconds. The timebase is the same as for the values
returned by esp_timer_get_time.
esp_err_t
esp_timer_dump(FILE *stream)
Dump the list of timers to a stream.
If CONFIG_ESP_TIMER_PROFILING option is enabled, this prints the list of all the existing timers. Oth-
erwise, only the list active timers is printed.
The format is:
name period alarm times_armed times_triggered total_callback_run_time
where:
name —timer name (if CONFIG_ESP_TIMER_PROFILING is defined), or timer pointer period —period
of timer, in microseconds, or 0 for one-shot timer alarm - time of the next alarm, in microseconds since boot,
or 0 if the timer is not started
The following fields are printed if CONFIG_ESP_TIMER_PROFILING is defined:
times_armed —number of times the timer was armed via esp_timer_start_X times_triggered - number of
times the callback was called total_callback_run_time - total time taken by callback to execute, across all calls
Return
• ESP_OK on success
• ESP_ERR_NO_MEM if can not allocate temporary buffer for the output
Parameters
Espressif Systems
timer)
timer)
997
Submit Document Feedback
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers