zephyr/samples/drivers/counter/alarm
Khoa Nguyen 992db7d1e8 samples: drivers: counter: Support test alarm for RA6, RA4, RA2
Add overlay to support test alarm for:
ek_ra6m1, ek_ra6m2, ek_ra6m3, ek_ra6m4, ek_ra6m5, fpb_ra6e1,
ek_ra4w1, ek_ra4m2, ek_ra4m3, ek_ra2a1.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2024-11-25 10:07:37 +01:00
..
boards samples: drivers: counter: Support test alarm for RA6, RA4, RA2 2024-11-25 10:07:37 +01:00
socs samples: esp32c3: Move config files from boards to socs 2024-08-13 18:21:10 -04:00
src drivers: counter: Add AGT counter driver support for Renesas RA8 2024-10-21 12:41:00 +02:00
CMakeLists.txt
Kconfig
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>