Skip to main content

Module timer

Module timer 

Source
Expand description

Timer driver for the Timer Group peripheral.

This timer can select different clock sources and prescalers to meet the requirements of nanosecond-level resolution. Additionally, it has flexible timeout alarm functions and allows automatic updating of the count value at the alarm moment, achieving very precise timing cycles.

Based on the high resolution, high count range, and high response capabilities of the hardware timer, the main application scenarios of this driver include:

  • Running freely as a calendar clock to provide timestamp services for other modules
  • Generating periodic alarms to complete periodic tasks
  • Generating one-shot alarms, which can be used to implement a monotonic software timer list with asynchronous updates of alarm values
  • Working with the GPIO module to achieve PWM signal output and input capture

§Driver redesign in ESP-IDF 5.0

In ESP-IDF 5.0, the timer API was redesigned to simplify and unify the usage of general purpose timer.

It is recommended to use the new API, but for now the old API is available through the timer-legacy feature. The ESP-IDF 6.0 release will remove support for the legacy API.

§Force enabling debug logs

The CONFIG_GPTIMER_ENABLE_DEBUG_LOG option in the sdkconfig forces the GPTimer driver to enable all debug logs, regardless of the global log level settings. Enabling this option helps developers obtain more detailed log information during debugging, making it easier to locate and solve problems.

Modules§

config
Timer configuration

Structs§

AlarmEventData
GPTimer alarm event data.
TimerDriver
General Purpose Timer driver.

Constants§

ERR_EOVERFLOW
This might not always be available in the generated esp-idf-sys bindings, which is why it is defined here.