zephyr/samples/drivers/counter/alarm
TOKITA Hiroshi 70fc4a3e57 boards: pimoroni: pico_plus2: Add Pimoroni Pico Plus2 board
Pinoroni Pico Plus2 is an RP2350B based board that has
more rich I/O, RAM, and Flash than the original Raspberry Pi Pico2.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-03-10 11:20:30 +01:00
..
boards samples: drivers: counter: Add support alarm for ek_ra4m1 2025-02-13 09:11:33 +01:00
socs samples: Simplify ESP32 overlays moving to socs 2025-02-05 01:12:26 +01:00
src boards: pimoroni: pico_plus2: Add Pimoroni Pico Plus2 board 2025-03-10 11:20:30 +01: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

.. 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>