Skip to content

Commit

Permalink
samples: sensor: Update sensor shell documentation
Browse files Browse the repository at this point in the history
Updates the sensor shell sample documentation to reflect the currently
supported sensor shell commands. The list and list_channels commands
were removed in commit 95b4d37 but the
documentation wasn't updated at the time.

Signed-off-by: Maureen Helm <[email protected]>
  • Loading branch information
MaureenHelm authored and carlescufi committed Oct 31, 2022
1 parent 97defe7 commit eef0e1a
Showing 1 changed file with 21 additions and 59 deletions.
80 changes: 21 additions & 59 deletions samples/sensor/sensor_shell/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,82 +13,44 @@ Building and Running
Build the sample app by choosing the target board that has sensors drivers
enabled, for example:

.. code-block:: console
cmake -DBOARD=reel_board
.. zephyr-app-commands::
:zephyr-app: samples/subsys/shell/sensor_module
:goals: run

:board: reel_board
:goals: build flash

Shell Module Command Help
=========================

.. code-block:: console
sensor - Sensor commands
Options:
-h, --help :Show command help.
Subcommands:
get :<device_name> [chanel_idx]
list :List configured sensors
list_channels :<device_name>
**list**: lists all the initialized devices on the system.

Output example (reel_board):

.. code-block:: console
uart:~$ sensor list
devices:
- clk_k32src
- clk_m16src
- UART_0
- ENTROPY_0
- GPIO_0
- GPIO_1
- I2C_0
- APDS9960
- MMA8652FC
- HDC1008
sensor - Sensor commands
Subcommands:
get :Get sensor data. Channel names are optional. All channels are read when
no channels are provided. Syntax:
<device_name> <channel name 0> .. <channel name N>
**list_channels**: lists the supported channels (index and name) for a given
sensor device name.
**get**: prints all the sensor channels data for a given sensor device name.
Optionally, a single channel name or index can be passed to be printed out. The
device name and channel name are autocompleted.

Output example (reel_board):

.. code-block:: console
uart:~$ sensor list_channels MMA8652FC
idx=0 name=accel_x
idx=1 name=accel_y
idx=2 name=accel_z
idx=3 name=accel_xyz
.. note:: A valid sensor device name should be passed otherwise you will get an
undefined behavior like hardware exception. This happens because the shell
subsystem runs in supervisor mode where API callbacks are not checked before
being called.

**get**: prints all the sensor channels data for a given sensor device name.
Optionally, a single channel index can be passed to be printed out.
uart:~$ sensor get mma8652fc@1d
channel idx=0 accel_x = 0.000000
channel idx=1 accel_y = 0.268150
channel idx=2 accel_z = 9.959878
channel idx=3 accel_xyz x = 0.000000 y = 0.268150 z = 9.959878
Output example (reel_board):

.. code-block:: console
uart:~$ sensor get mma8652fc@1d accel_z
channel idx=2 accel_z = 9.959878
uart:~$ sensor get MMA8652FC
channel idx=0 accel_x = -1.379061
channel idx=1 accel_y = 1.991975
channel idx=2 accel_z = -9.576807
channel idx=3 accel_xyz = -1.379061
channel idx=3 accel_xyz = 1.991975
channel idx=3 accel_xyz = -9.576807
uart:~$ sensor get mma8652fc@1d 2
channel idx=2 accel_z = 9.959878
.. note:: A valid sensor device name should be passed otherwise you will get an
.. note::
A valid sensor device name should be passed otherwise you will get an
undefined behavior like hardware exception. This happens because the shell
subsystem runs in supervisor mode where API callbacks are not checked before
being called.

0 comments on commit eef0e1a

Please sign in to comment.