zephyr/samples/drivers/counter/alarm
Rafał Kuźnia bcc756223f samples: drivers: counter: add nRF54L20 config
Added build configuration for nRF54L20.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2024-12-13 20:04:51 +01:00
..
boards samples: drivers: counter: add nRF54L20 config 2024-12-13 20:04:51 +01:00
socs samples: esp32c3: Move config files from boards to socs 2024-08-13 18:21:10 -04:00
src samples: drivers: counter: add nRF54L20 config 2024-12-13 20:04:51 +01:00
CMakeLists.txt tf-m: Change NS include path for TF-M 2.0.0 2024-01-17 16:52:52 +01:00
Kconfig samples: drivers: counter: alarm: Fix nordic DKs 2023-03-27 22:15:15 +00:00
prj.conf
README.rst boards: st: adopt new zephyr:board directive and role 2024-10-24 17:51:15 +02:00
sample.yaml samples: drivers: counter: alarm: enable on s32z2xxdc2 2024-08-05 07:35:57 -05:00

.. zephyr:code-sample:: alarm
   :name: Counter Alarm
   :relevant-api: counter_interface

   Implement an alarm application using the counter API.

Overview
********
This sample provides an example of alarm application using :ref:`counter API <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
**********

- :zephyr:board:`disco_l475_iot1`

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>