samples: boards: nordic: add nrf_sys_event sample

Add sample for nrf system events.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
This commit is contained in:
Bjarki Arge Andreasen 2024-10-16 16:31:10 +02:00 committed by Anas Nashif
parent 3e6d6033bb
commit 9df88e62fc
4 changed files with 82 additions and 0 deletions

View File

@ -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})

View File

@ -0,0 +1,4 @@
# Copyright 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
CONFIG_NRF_SYS_EVENT=y

View File

@ -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

View File

@ -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;
}