2019-02-08 02:39:04 +08:00
|
|
|
.. _alarm_sample:
|
2018-11-30 17:17:22 +08:00
|
|
|
|
2019-02-08 02:39:04 +08:00
|
|
|
Counter Alarm Sample
|
2018-11-30 17:17:22 +08:00
|
|
|
#####################
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Requirements
|
|
|
|
************
|
|
|
|
|
|
|
|
This sample requires the support of a timer IP compatible with alarm setting.
|
|
|
|
|
|
|
|
References
|
|
|
|
**********
|
|
|
|
|
2019-02-08 02:39:04 +08:00
|
|
|
- :ref:`disco_l475_iot1_board`
|
2018-11-30 17:17:22 +08:00
|
|
|
|
|
|
|
Building and Running
|
|
|
|
********************
|
|
|
|
|
|
|
|
.. zephyr-app-commands::
|
2019-10-08 01:12:11 +08:00
|
|
|
:zephyr-app: samples/drivers/counter/alarm
|
2018-11-30 17:17:22 +08:00
|
|
|
: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>
|