Skip to content

Commit

Permalink
samples: boards: nordic: add nrf_sys_event sample
Browse files Browse the repository at this point in the history
Add sample for nrf system events.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
  • Loading branch information
bjarki-andreasen committed Oct 25, 2024
1 parent 0210b25 commit 77d584a
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
9 changes: 9 additions & 0 deletions samples/boards/nordic/nrf_sys_event/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(soc_sys_event)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
4 changes: 4 additions & 0 deletions samples/boards/nordic/nrf_sys_event/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

CONFIG_NRF_SYS_EVENT=y
28 changes: 28 additions & 0 deletions samples/boards/nordic/nrf_sys_event/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
sample:
name: nRF System events
tests:
sample.boards.nordic.nrf_sys_event:
harness: console
harness_config:
type: one_line
regex:
- "constant latency mode disabled"
platform_allow:
- nrf52dk/nrf52810
- nrf52dk/nrf52832
- nrf52833dk/nrf52820
- nrf52833dk/nrf52833
- nrf52840dk/nrf52811
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf5340dk/nrf5340/cpunet
- nrf54h20dk/nrf54h20/cpuapp
- nrf54h20dk/nrf54h20/cpurad
- nrf54l15dk/nrf54l15/cpuapp
integration_platforms:
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
- nrf5340dk/nrf5340/cpunet
- nrf54h20dk/nrf54h20/cpuapp
- nrf54h20dk/nrf54h20/cpurad
- nrf54l15dk/nrf54l15/cpuapp
41 changes: 41 additions & 0 deletions samples/boards/nordic/nrf_sys_event/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <nrf_sys_event.h>
#include <stdio.h>

int main(void)
{
printf("request global constant latency mode\n");
if (nrf_sys_event_request_global_constlat()) {
printf("failed to request global constant latency mode\n");
return 0;
}
printf("constant latency mode enabled\n");

printf("request global constant latency mode again\n");
if (nrf_sys_event_request_global_constlat()) {
printf("failed to request global constant latency mode\n");
return 0;
}

printf("release global constant latency mode\n");
printf("constant latency mode will remain enabled\n");
if (nrf_sys_event_release_global_constlat()) {
printf("failed to release global constant latency mode\n");
return 0;
}

printf("release global constant latency mode again\n");
printf("constant latency mode will be disabled\n");
if (nrf_sys_event_release_global_constlat()) {
printf("failed to release global constant latency mode\n");
return 0;
}

printf("constant latency mode disabled\n");
return 0;
}

0 comments on commit 77d584a

Please sign in to comment.