zephyr/samples/drivers/counter/alarm
Glauber Maroto Ferreira c344d0d74d esp32: drivers: counter: add support for general-purpose counters
Adds support for ESP32 general-purpose Counters

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-03-03 13:02:02 +01:00
..
boards esp32: drivers: counter: add support for general-purpose counters 2021-03-03 13:02:02 +01:00
src esp32: drivers: counter: add support for general-purpose counters 2021-03-03 13:02:02 +01:00
CMakeLists.txt
Kconfig esp32: drivers: counter: add support for general-purpose counters 2021-03-03 13:02:02 +01:00
README.rst
prj.conf
sample.yaml

README.rst

.. _alarm_sample:

Counter Alarm Sample
#####################

Overview
********
This sample provides an example of alarm application using counter API.
It sets an alarm with an initial delay of 2 seconds. At each alarm
expiry, a new alarm is configured with a delay multiplied by 2.

.. note::
   In case of 1Hz frequency (RTC for example), precision is 1 second.
   Therefore, the sample output may differ in 1 second

Requirements
************

This sample requires the support of a timer IP compatible with alarm setting.

References
**********

- :ref:`disco_l475_iot1_board`

Building and Running
********************

 .. zephyr-app-commands::
    :zephyr-app: samples/drivers/counter/alarm
    :host-os: unix
    :board: disco_l475_iot1
    :goals: run
    :compact:

Sample Output
=============

 .. code-block:: console

    Counter alarm sample

    Set alarm in 2 sec
    !!! Alarm !!!
    Now: 2
    Set alarm in 4 sec
    !!! Alarm !!!
    Now: 6
    Set alarm in 8 sec
    !!! Alarm !!!
    Now: 14
    Set alarm in 16 sec
    !!! Alarm !!!
    Now: 30

    <repeats endlessly>