-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sample/board: add SensorTile.box Pro sample for testing sensors
Add sample to test SensorTile.box Pro sensors on board. Signed-off-by: Armando Visconti <armando.visconti@st.com>
- Loading branch information
Showing
5 changed files
with
474 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
samples/boards/sensortile_box_pro/sensors-on-board/CMakeLists.txt
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,10 @@ | ||
# Copyright (c) 2023 STMicroelectronics | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(sensortile_box_pro) | ||
|
||
target_sources(app PRIVATE src/main.c) |
73 changes: 73 additions & 0 deletions
73
samples/boards/sensortile_box_pro/sensors-on-board/README.rst
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,73 @@ | ||
.. _sensortile_box_pro_sample_sensors: | ||
|
||
ST SensorTile.box Pro on-board sensors test | ||
########################################### | ||
|
||
Overview | ||
******** | ||
This sample provides an example of how to read sensors data | ||
from the SensorTile.box Pro board. | ||
|
||
This sample enables all sensors of SensorTile.box Pro board, and then | ||
periodically reads and displays data on the console from the following | ||
sensors: | ||
|
||
- HTS221: ambient temperature and relative humidity | ||
- LPS22DF: ambient temperature and atmospheric pressure | ||
- LSM6DSV16X: 6-Axis acceleration and angular velocity | ||
|
||
Requirements | ||
************ | ||
|
||
The application requires a SensorTile.box Pro board connected to the PC | ||
through USB. The board shows up as a USB CDC class standard device. | ||
|
||
References | ||
********** | ||
|
||
- :ref:`sensortile_box_pro_board` | ||
|
||
Building and Running | ||
******************** | ||
|
||
Build and flash the sample in the following way: | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/boards/sensortile_box_pro/sensors-on-board | ||
:board: sensortile_box_pro | ||
:goals: build flash | ||
|
||
Please note that flashing the board requires a few preliminary steps described | ||
in :ref:`sensortile_box_pro_board`. | ||
|
||
Then, power cycle the board by disconnecting and reconnecting the USB cable. | ||
Run your favorite terminal program to listen for output. | ||
|
||
.. code-block:: console | ||
$ minicom -D <tty_device> -b 115200 | ||
Replace :code:`<tty_device>` with the correct device path automatically created on | ||
the host after the SensorTile.box Pro board gets connected to it, | ||
usually :code:`/dev/ttyUSBx` or :code:`/dev/ttyACMx` (with x being 0, 1, 2, ...). | ||
The ``-b`` option sets baud rate ignoring the value from config. | ||
|
||
Sample Output | ||
============= | ||
|
||
The sample code outputs sensors data on the SensorTile.box Pro console. | ||
|
||
.. code-block:: console | ||
SensorTile.box Pro dashboard | ||
HTS221: Temperature: 26.4 C | ||
HTS221: Relative Humidity: 60.5% | ||
LPS22DF: Temperature: 28.4 C | ||
LPS22DF: Pressure:99.694 kpa | ||
LSM6DSV16X: Accel (m.s-2): x: -0.158, y: 0.158, z: 9.811 | ||
LSM6DSV16X: GYro (dps): x: 0.003, y: 0.000, z: -0.005 | ||
1:: lsm6dsv16x acc trig 836 | ||
1:: lsm6dsv16x gyr trig 836 | ||
<repeats endlessly every 2s> |
15 changes: 15 additions & 0 deletions
15
samples/boards/sensortile_box_pro/sensors-on-board/prj.conf
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,15 @@ | ||
CONFIG_LOG=y | ||
CONFIG_PRINTK=y | ||
CONFIG_SPI=y | ||
CONFIG_I2C=y | ||
CONFIG_GPIO=y | ||
|
||
# config sensors | ||
CONFIG_SENSOR=y | ||
CONFIG_SENSOR_LOG_LEVEL_DBG=y | ||
CONFIG_HTS221_TRIGGER_NONE=y | ||
CONFIG_LPS22DF_TRIGGER_NONE=y | ||
CONFIG_LSM6DSV16X_TRIGGER_OWN_THREAD=y | ||
CONFIG_LIS2MDL_TRIGGER_OWN_THREAD=y | ||
|
||
CONFIG_CBPRINTF_FP_SUPPORT=y |
12 changes: 12 additions & 0 deletions
12
samples/boards/sensortile_box_pro/sensors-on-board/sample.yaml
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,12 @@ | ||
sample: | ||
description: SensorTile.box Pro board testing | ||
name: SensorTile.box Pro test | ||
tests: | ||
sample.board.sensortile_box_pro.sensors-on-board: | ||
harness: sensor | ||
platform_allow: sensortile_box_pro | ||
tags: sensors | ||
depends_on: | ||
- i2c | ||
- spi | ||
- gpio |
Oops, something went wrong.