-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
samples: boards: nordic: add nrf_sys_event sample
Add sample for nrf system events. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
- Loading branch information
1 parent
305d3b7
commit f8557b9
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
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: | ||
- nrf54h20dk/nrf54h20/cpuapp | ||
- nrf54l15dk/nrf54l15/cpuapp | ||
- nrf5340dk/nrf5340/cpuapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |