esp-idf/examples/peripherals/timer_group
pedro.minatel da471dfcd1 Examples README's updated on peripherals, system and wifi
Updated main examples README to add missing examples folders and Getting Started links
Updated wifi/fastscan example README
Updated wifi examples README
Updated wifi main examples README
Added instructions and removed obviousness from examples README
Updates on example README in peripherals, system and wifi
Updates on example README in peripherals and added wave form pictures on wave_gen example
Updates and review on example README
Revision on unit style convention
Added the getting started link for each supported version
Readme review and recommended enhancements
Added the default note on the wave form option info
Added the ESP32-C3 support information on the temperature sensor example README
Added Getting Started information for ESP32-S2 and ESP32-C3
Issue fixed on the supported target on README
Resolved merge conflict
2021-04-07 14:24:38 +00:00
..
main timer_group: using isr callback in example 2021-03-16 17:56:37 +08:00
CMakeLists.txt build_app: make multi target support readable 2020-04-09 16:40:57 +08:00
example_test.py timer_group: added example test 2021-03-16 17:56:37 +08:00
Makefile Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
README.md Examples README's updated on peripherals, system and wifi 2021-04-07 14:24:38 +00:00

Example: General Purpose Timer

This example uses the timer group driver to generate timer interrupts at two specified alarm intervals.

How to Use Example

Hardware Required

  • A development board with ESP SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.)
  • A USB cable for Power supply and programming

Build and Flash

Run idf.py -p PORT flash monitor to build, flash and monitor the project.

(To exit the serial monitor, type Ctrl-].)

See the Getting Started Guide for all the steps to configure and use the ESP-IDF to build projects.

Example Output

Timer Group with auto reload
Group[0], timer[0] alarm event
------- EVENT TIME --------
Counter: 0x0000000000000008
Time   : 0.00000160 s
-------- TASK TIME --------
Counter: 0x0000000000004ed8
Time   : 0.00403680 s
Timer Group without auto reload
Group[1], timer[0] alarm event
------- EVENT TIME --------
Counter: 0x00000000017d7848
Time   : 5.00000160 s
-------- TASK TIME --------
Counter: 0x00000000017dcb32
Time   : 5.00424680 s
Timer Group with auto reload
Group[0], timer[0] alarm event
------- EVENT TIME --------
Counter: 0x0000000000000008
Time   : 0.00000160 s
-------- TASK TIME --------
Counter: 0x0000000000004dd4
Time   : 0.00398480 s

Functionality Overview

  • Two timers are configured
  • Each timer is set with some sample alarm interval
  • On reaching the interval value each timer will generate an alarm
  • One of the timers is configured to automatically reload it's counter value on the alarm
  • The other timer is configured to keep incrementing and is reloaded by the application each time the alarm happens
  • Alarms trigger subsequent interrupts, that is tracked with messages printed on the terminal:

Troubleshooting

For any technical queries, please open an issue on GitHub. We will get back to you soon.