Skip to content

Commit

Permalink
samples: drivers: rtc application runs on stm32 targets
Browse files Browse the repository at this point in the history
Check that rtc has, at least, incremented second counter
one time to validated the sample.

Signed-off-by: Francois Ramu <[email protected]>
  • Loading branch information
FRASTM committed Dec 9, 2024
1 parent 3f60489 commit d88cb03
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 6 additions & 3 deletions samples/drivers/rtc/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ and can be built and executed on boards supporting RTC.
Building and Running
********************

Be sure that the rtc node is enabled.

The sample runs when rtc is aliased by *rtc* or on stm32-compatible *st,stm32-rtc*

Build and flash as follows, replacing ``stm32f3_disco`` with your board:

.. zephyr-app-commands::
Expand All @@ -27,8 +31,7 @@ Sample Output

.. code-block:: console
RTC date and time: 2024-11-17 04:21:47
RTC date and time: 2024-11-17 04:21:48
RTC date and time: 2024-11-17 04:21:49
RTC date and time: 2024-11-17 04:19:00
RTC date and time: 2024-11-17 04:19:01
<repeats endlessly>
8 changes: 7 additions & 1 deletion samples/drivers/rtc/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ sample:
name: Real-Time Clock Sample
tests:
sample.drivers.rtc:
platform_allow:
integration_platforms:
- stm32f3_disco
tags:
- samples
- rtc
- api
depends_on:
- rtc
filter: dt_alias_exists("rtc") or dt_compat_enabled("st,stm32-rtc")
harness: console
harness_config:
type: one_line
regex:
- "RTC date and time: 2024-11-17 04:19:01"
2 changes: 1 addition & 1 deletion samples/drivers/rtc/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <zephyr/drivers/rtc.h>
#include <zephyr/sys/util.h>

const struct device *const rtc = DEVICE_DT_GET(DT_ALIAS(rtc));
const struct device *const rtc = DEVICE_DT_GET(DT_NODELABEL(rtc));

static int set_date_time(const struct device *rtc)
{
Expand Down

0 comments on commit d88cb03

Please sign in to comment.