mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-02 22:57:18 +00:00
Introduce a new counter API function for reading the current counter value (counter_get_value()) and deprecate the former counter_read() in favor of this. Update all drivers and calling code to match the new counter API. The previous counter driver API function for reading the current value of the counter (counter_read()) did not support indicating whether the read suceeded. This is fine for counters internal to the SoC where the read always succeeds but insufficient for external counters (e.g. I2C or SPI slaves). Fixes #21846. Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk> |
||
---|---|---|
.. | ||
src | ||
CMakeLists.txt | ||
Kconfig | ||
prj.conf | ||
README.rst | ||
sample.yaml |
.. _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. 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>