From 5dd50f92321590cf6444b90afbc7698d51f81dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20J=C3=A4ger?= Date: Mon, 24 Oct 2022 18:31:19 +0200 Subject: [PATCH] samples: subsys: lorawan: class_a: add clock sync option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an option to build the sample with application-layer clock sync service running in the background. This will also add a build-check for the clock sync service in CI. Signed-off-by: Martin Jäger --- samples/subsys/lorawan/class_a/README.rst | 16 ++++++++++++++++ .../lorawan/class_a/overlay-clock-sync.conf | 3 +++ samples/subsys/lorawan/class_a/sample.yaml | 5 +++++ samples/subsys/lorawan/class_a/src/main.c | 4 ++++ 4 files changed, 28 insertions(+) create mode 100644 samples/subsys/lorawan/class_a/overlay-clock-sync.conf diff --git a/samples/subsys/lorawan/class_a/README.rst b/samples/subsys/lorawan/class_a/README.rst index e08db8092dc..4d923903fdf 100644 --- a/samples/subsys/lorawan/class_a/README.rst +++ b/samples/subsys/lorawan/class_a/README.rst @@ -24,3 +24,19 @@ The following commands build and flash the sample. :board: nucleo_wl55jc :goals: build flash :compact: + +Extended Configuration +********************** + +This sample can be configured to run the application-layer clock +synchronization service in the background. + +The following commands build and flash the sample with clock synchronization +enabled. + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/lorawan/class_a + :board: nucleo_wl55jc + :goals: build flash + :gen-args: -DOVERLAY_CONFIG=overlay-clock-sync.conf + :compact: diff --git a/samples/subsys/lorawan/class_a/overlay-clock-sync.conf b/samples/subsys/lorawan/class_a/overlay-clock-sync.conf new file mode 100644 index 00000000000..e19b01a42a6 --- /dev/null +++ b/samples/subsys/lorawan/class_a/overlay-clock-sync.conf @@ -0,0 +1,3 @@ +CONFIG_LORAWAN_SERVICES=y +CONFIG_LORAWAN_SERVICES_LOG_LEVEL_DBG=y +CONFIG_LORAWAN_APP_CLOCK_SYNC=y diff --git a/samples/subsys/lorawan/class_a/sample.yaml b/samples/subsys/lorawan/class_a/sample.yaml index c617ec5feb4..fb0a3c0de30 100644 --- a/samples/subsys/lorawan/class_a/sample.yaml +++ b/samples/subsys/lorawan/class_a/sample.yaml @@ -44,3 +44,8 @@ tests: extra_configs: - CONFIG_LORAMAC_REGION_EU868=y - CONFIG_LORAMAC_REGION_US915=y + sample.lorawan.class_a.clock_sync: + extra_args: OVERLAY_CONFIG="overlay-clock-sync.conf" + filter: CONFIG_ENTROPY_HAS_DRIVER + integration_platforms: + - nucleo_wl55jc diff --git a/samples/subsys/lorawan/class_a/src/main.c b/samples/subsys/lorawan/class_a/src/main.c index 10e40d74db4..31f3c8b68b0 100644 --- a/samples/subsys/lorawan/class_a/src/main.c +++ b/samples/subsys/lorawan/class_a/src/main.c @@ -98,6 +98,10 @@ void main(void) return; } +#ifdef CONFIG_LORAWAN_APP_CLOCK_SYNC + lorawan_clock_sync_run(); +#endif + LOG_INF("Sending data..."); while (1) { ret = lorawan_send(2, data, sizeof(data),