Part 1
요약·해설
prj.conf 선택, #ifdef 조건부 compile, 2초 polling과 ARGONKEY_TEST_LOG를 설명합니다.
VL53L0x · LPS22HB · HTS221
LSM6DSL · LIS2MDL
Poll · Trigger
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
16903A174ECDA16FC3E914C32ADCB9EE8BB73B08A9775EAAC34B301BDF9DCF3A
.. _ArgonKey_Sensors:
ArgonKey Board Sensors
######################
Overview
********
This sample provides an example of how to read sensor data
from the ArgonKey board. The result is displayed on the console.
It makes use of both the trigger and poll methods.
Requirements
************
This sample just requires the ArgonKey board. The board can be powered
in either one of the following two ways:
- mezzanine mode, plugging the ArgonKey to HiKey board through its 96Board
low-speed connector
- standalone mode, supplying 5V directly on P1 connector
The user may select or unselect the sensors from
:zephyr_file:`samples/boards/96b_argonkey/sensors/prj.conf`.
Please note that all sensor related code is conditionally compiled
using the ``#ifdef`` directive, so this sample is supposed to always
build correctly. Example:
.. code-block:: c
#ifdef CONFIG_HTS221
struct device *hum_dev = DEVICE_DT_GET_ONE(st_hts221);
if (!device_is_ready(hum_dev)) {
printk("%s: device not ready.\n", hum_dev->name);
return;
}
#endif
References
**********
- :ref:`96b_argonkey`
Building and Running
********************
.. zephyr-app-commands::
:zephyr-app: samples/boards/96b_argonkey/sensors
:host-os: unix
:board: 96b_argonkey
:goals: run
:compact:
Sample Output
=============
A USB to TTL 1V8 serial cable may be attached to the low speed connector on
the back of the board on P3.5 (TX) and P3.7 (RX). User may use a simple
terminal emulator, such as minicom, to capture the output.
.. code-block:: console
proxy: 1 ;
distance: 0 m -- 09 cm;
temp: 30.35 C; press: 97.466259
humidity: 43.500000
accel (0.004000 -0.540000 9.757000) m/s2
gyro (0.065000 -0.029000 -0.001000) dps
magn (0.049500 0.208500 -0.544500) gauss
- (6) (trig_cnt: 1878)
<repeats endlessly every 2s>
In this example the output is generated polling the sensor every 2 seconds.
Sensor data is printed in the following order (no data is printed for
sensors that are not enabled):
#. *VL53L0x* proximity
#. *LPS22HB* baro/temp
#. *HTS221* humidity
#. *LSM6DSL* accel
#. *LSM6DSL* gyro
#. *LIS2MDL* magnetometer (attached to *LSM6DSL*)
The proximity sensor displays two lines:
- a flag (proxy) that goes on when the distance is below 10cm
- the absolute distance from the obstacle
The last line displays a counter of how many trigger interrupts
has been received. It is possible to display the sensor data
read for each trigger by enabling the **ARGONKEY_TEST_LOG** macro.
Part 3
한국어 전문 번역
개요
이 sample은 ArgonKey board에서 sensor data를 읽는 방법을 보여줍니다. 결과는 console에 표시되며 trigger 방식과 polling 방식을 모두 사용합니다.
요구사항
이 sample에는 ArgonKey board만 필요합니다. Board에는 다음 두 방법 가운데 하나로 전원을 공급할 수 있습니다.
- Mezzanine mode: ArgonKey를 96Boards low-speed connector로 HiKey board에 연결합니다.
- Standalone mode: P1 connector에 5 V를 직접 공급합니다.
사용자는 samples/boards/96b_argonkey/sensors/prj.conf에서 사용할 sensor를 선택하거나 해제할 수 있습니다.
모든 sensor 관련 code는 #ifdef directive로 조건부 compile됩니다. 따라서 어떤 sensor 조합을 선택해도 이 sample은 정상적으로 build되도록 설계되어 있습니다. 예:
#ifdef CONFIG_HTS221
struct device *hum_dev = DEVICE_DT_GET_ONE(st_hts221);
if (!device_is_ready(hum_dev)) {
printk("%s: device not ready.\n", hum_dev->name);
return;
}
#endif
참고 자료
- 96Boards ArgonKey board 문서
Build와 실행
west build -b 96b_argonkey samples/boards/96b_argonkey/sensors
west build -t run
Sample 출력
USB-to-TTL 1.8 V serial cable을 board 뒷면 low-speed connector의 P3.5(TX)와 P3.7(RX)에 연결할 수 있습니다. Minicom 같은 간단한 terminal emulator로 출력을 수집할 수 있습니다.
proxy: 1 ;
distance: 0 m -- 09 cm;
temp: 30.35 C; press: 97.466259
humidity: 43.500000
accel (0.004000 -0.540000 9.757000) m/s2
gyro (0.065000 -0.029000 -0.001000) dps
magn (0.049500 0.208500 -0.544500) gauss
- (6) (trig_cnt: 1878)
<repeats endlessly every 2s>
이 예제에서는 2초마다 sensor를 polling해 출력을 생성합니다.
활성화되지 않은 sensor의 data는 출력하지 않으며, sensor data는 다음 순서로 표시됩니다.
- VL53L0x proximity
- LPS22HB barometer/temperature
- HTS221 humidity
- LSM6DSL accelerometer
- LSM6DSL gyroscope
- LIS2MDL magnetometer(LSM6DSL에 연결됨)
Proximity sensor는 두 줄을 표시합니다.
- 거리가 10 cm보다 짧을 때 켜지는 flag(
proxy) - 장애물까지의 절대 거리
마지막 줄은 수신한 trigger interrupt 수를 나타내는 counter입니다. ARGONKEY_TEST_LOG macro를 활성화하면 각 trigger에서 읽은 sensor data를 표시할 수 있습니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.