esp-idf/examples/peripherals/timer_group
Konstantin Kondrashov 399d2d2605 all: Using xxx_periph.h
Using xxx_periph.h in whole IDF instead of xxx_reg.h, xxx_struct.h, xxx_channel.h ... .

Cleaned up header files from unnecessary headers (releated to soc/... headers).
2019-06-03 14:15:08 +08:00
..
main all: Using xxx_periph.h 2019-06-03 14:15:08 +08:00
CMakeLists.txt cmake: make main a component again 2018-09-11 09:44:12 +08:00
Makefile Moved examples to new folders / categories. Removed example numbers from example names 2017-01-16 23:08:35 +01:00
README.md Timer API docs update, refactored example 2017-10-27 07:13:59 +02:00

Example: timer_group

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

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:
    Example timer with auto reload
Group[0], timer[1] alarm event
------- EVENT TIME --------
Counter: 0x000000000000000a
Time   : 0.00000200 s
-------- TASK TIME --------
Counter: 0x00000000000107ff
Time   : 0.01351660 s

    Example timer without reload
Group[0], timer[0] alarm event
------- EVENT TIME --------
Counter: 0x00000000092ae316
Time   : 30.76111800 s
-------- TASK TIME --------
Counter: 0x00000000092bd535
Time   : 30.77351460 s