2023-09-06 16:25:28 +08:00
|
|
|
.. zephyr:code-sample:: sensing
|
|
|
|
:name: Sensing subsystem
|
|
|
|
:relevant-api: sensing_api
|
2023-05-19 10:28:56 +08:00
|
|
|
|
2023-09-06 16:25:28 +08:00
|
|
|
Get high-level sensor data in defined intervals.
|
2023-05-19 10:28:56 +08:00
|
|
|
|
|
|
|
Overview
|
|
|
|
********
|
|
|
|
|
|
|
|
A simple sample that shows how to use the sensors with sensing subsystem APIs. It defines
|
|
|
|
two sensors, with the underlying device bmi160 emulator, and gets the sensor
|
|
|
|
data in defined interval.
|
|
|
|
|
|
|
|
The program runs in the following sequence:
|
|
|
|
|
|
|
|
#. Define the sensor in the dts
|
|
|
|
|
|
|
|
#. Open the sensor
|
|
|
|
|
|
|
|
#. Register call back.
|
|
|
|
|
|
|
|
#. Set sample interval
|
|
|
|
|
|
|
|
#. Run forever and get the sensor data.
|
|
|
|
|
|
|
|
Building and Running
|
|
|
|
********************
|
|
|
|
|
2023-11-10 18:36:34 +08:00
|
|
|
This application can be built and executed on :ref:`native_sim <native_sim>` as follows:
|
2023-05-19 10:28:56 +08:00
|
|
|
|
|
|
|
.. zephyr-app-commands::
|
|
|
|
:zephyr-app: samples/subsys/sensing/simple
|
|
|
|
:host-os: unix
|
2023-11-10 18:36:34 +08:00
|
|
|
:board: native_sim
|
2023-05-19 10:28:56 +08:00
|
|
|
:goals: run
|
|
|
|
:compact:
|
|
|
|
|
2023-11-10 18:36:34 +08:00
|
|
|
To build for another board, change "native_sim" above to that board's name.
|
|
|
|
At the current stage, it only support native sim.
|