Part 1
요약·해설
두 build 경로, command help, 실제 get·info 출력과 device-name 위험을 설명합니다.
get · info
Fake sensor
Valid device name
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
6948A3C33F31B8DFD1E5AA383CC3656975B87D33FC950DC2835430475C97409D
.. _sensor_shell_sample:
Sensor Shell Module Sample
##########################
Overview
********
This is a simple shell module to get data from sensors presented in the system.
Building and Running
********************
Build the sample app by choosing the target board that has sensors drivers
enabled, for example:
.. zephyr-app-commands::
:zephyr-app: samples/sensor/sensor_shell
:board: reel_board
:goals: build flash
For boards that do not have a sensor, a simple fake sensor driver is provided, for example:
.. zephyr-app-commands::
:zephyr-app: samples/sensor/sensor_shell
:board: qemu_riscv64
:goals: run
:gen-args: -DCONFIG_SAMPLES_SENSOR_SHELL_FAKE_SENSOR=y
Shell Module Command Help
=========================
.. code-block:: console
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>
info :Get sensor info, such as vendor and model name, for all sensors.
**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 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
uart:~$ sensor get mma8652fc@1d accel_z
channel idx=2 accel_z = 9.959878
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
undefined behavior like hardware exception. This happens because the shell
subsystem runs in supervisor mode where API callbacks are not checked before
being called.
**info**: prints vendor, model, and friendly name information for all sensors.
This command depends on enabling :kconfig:option:`CONFIG_SENSOR_INFO`.
.. code-block:: console
uart:~$ sensor info
device name: apds9960@39, vendor: Avago Technologies, model: apds9960, friendly name: (null)
device name: mma8652fc@1d, vendor: NXP Semiconductors, model: fxos8700, friendly name: (null)
device name: ti_hdc@43, vendor: Texas Instruments, model: hdc, friendly name: (null)
device name: temp@4000c000, vendor: Nordic Semiconductor, model: nrf-temp, friendly name: (null)
Part 3
한국어 전문 번역
개요
System에 존재하는 sensor에서 data를 가져오는 간단한 shell module입니다.
빌드 및 실행
Sensor driver가 활성화된 target board를 선택해 sample application을 build합니다. 예를 들어 reel_board에서는 다음과 같이 build하고 flash합니다.
# From the root of the zephyr repository
west build -b reel_board samples/sensor/sensor_shell
west flash
Sensor가 없는 board를 위해 간단한 fake sensor driver도 제공합니다. QEMU RISC-V 64에서 다음과 같이 활성화하고 실행할 수 있습니다.
# From the root of the zephyr repository
west build -b qemu_riscv64 samples/sensor/sensor_shell -- -DCONFIG_SAMPLES_SENSOR_SHELL_FAKE_SENSOR=y
west build -t run
Shell module command 도움말
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>
info :Get sensor info, such as vendor and model name, for all sensors.
get은 지정한 sensor device의 모든 channel data를 출력합니다. 선택적으로 channel 이름이나 index 하나를 전달해 그 channel만 출력할 수 있으며, device name과 channel name은 자동 완성됩니다.
reel_board의 출력 예입니다.
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
uart:~$ sensor get mma8652fc@1d accel_z
channel idx=2 accel_z = 9.959878
uart:~$ sensor get mma8652fc@1d 2
channel idx=2 accel_z = 9.959878
info는 모든 sensor의 vendor, model과 friendly name 정보를 출력합니다. 이 command는 CONFIG_SENSOR_INFO 활성화에 의존합니다.
uart:~$ sensor info
device name: apds9960@39, vendor: Avago Technologies, model: apds9960, friendly name: (null)
device name: mma8652fc@1d, vendor: NXP Semiconductors, model: fxos8700, friendly name: (null)
device name: ti_hdc@43, vendor: Texas Instruments, model: hdc, friendly name: (null)
device name: temp@4000c000, vendor: Nordic Semiconductor, model: nrf-temp, friendly name: (null)
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.