Sensor Clock

Browse source code on GitHub

Overview

This sample application demonstrates how to select the sensor clock source and utilize the Sensor Clock API.

Building and Running

The sample below uses the nRF52840 DK and nRF52833 DK boards.

To run this sample, ensure the following configurations:

Build and run the sample with the following command:

# From the root of the zephyr repository
west build -b <board to use> samples/sensor/clock
west flash

Sample Output

The application will print the current sensor clock cycles and their corresponding time in nanoseconds.

Cycles: 143783087
Nanoseconds: 8986442937
Cycles: 159776386
Nanoseconds: 9986024125
Cycles: 175772543
Nanoseconds: 10985783937
Cycles: 191771203
Nanoseconds: 11985700187
Cycles: 207758870
Nanoseconds: 12984929375
Cycles: 223752074
Nanoseconds: 13984504625

...

See also

Sensor Interface