1.. zephyr:code-sample:: lps22hh_i3c
2   :name: LPSS22HH Temperature and Pressure Sensor (I3C)
3   :relevant-api: sensor_interface
4
5   Get pressure and temperature data from an LPS22HH sensor over I3C (polling &
6   trigger mode).
7
8Overview
9********
10This sample periodically reads pressure from the LPS22HH MEMS pressure
11sensor and displays it on the console.
12
13Requirements
14************
15
16This sample uses the LPS22HH sensor controlled using the I3C interface.
17It has been tested using the LPS22HH on the evaluation board
18STEVALMKI192-V1 connected to the I3C header on :zephyr:board:`mimxrt685_evk`.
19
20References
21**********
22
23- LPS22HH: https://www.st.com/en/mems-and-sensors/lps22hh.html
24
25Building and Running
26********************
27
28This project outputs sensor data to the console. It requires an LPS22HH
29sensor (for example, the one on evaluation board STEVALMKI192-V1).
30
31.. note::
32
33   If ``CONFIG_LPS22HH_TRIGGER`` is enabled, the trigger is using
34   I3C In-Band Interrupt (IBI) to signal new data being available.
35   Since IBI is initiated by the sensor, it will take over the I3C
36   bus. Therefore, when flashing a new image, a power cycle is needed
37   to reset the sensor so that it will not generate IBIs anymore.
38   Or else the I3C controller will not be able to be initialized,
39   resulting in the sample not being able to communicate with
40   the sensor.
41
42Building on mimxrt685_evk board
43====================================
44
45.. zephyr-app-commands::
46   :zephyr-app: samples/sensor/lps22hh_i3c
47   :host-os: unix
48   :board: mimxrt685_evk/mimxrt685s/cm33
49   :goals: build
50   :compact:
51
52Board Preparations
53==================
54
55mimxrt685_evk
56------------------
57
58On the board :zephyr:board:`mimxrt685_evk`, the I3C pins are exposed on the J18
59header, where:
60
61  * SCL is on pin 1
62  * SDA is on pin 2
63  * Internal pull-up is on pin 3 (which is connected to pin 2 already)
64  * Ground is on pin4
65
66LPS22HH
67^^^^^^^
68
69A LPS22HH sensor needs to be connected to this header. For example,
70the evaluation board STEVAL-MKI192V1 can be used. This needs to be
71prepared so that the LPS22HH sensor has address 0x5D (i.e. 0xBA,
72left-shifed).
73
74Sample Output
75=============
76
77.. code-block:: console
78
79   Configured for triggered collection at 1 Hz
80   Observation: 1
81   Pressure: 97.474 kPa
82   Temperature: 22.19 C
83   Observation: 2
84   Pressure: 97.466 kPa
85   Temperature: 22.21 C
86   Observation: 3
87   Pressure: 97.473 kPa
88   Temperature: 22.21 C
89   Observation: 4
90   Pressure: 97.455 kPa
91   Temperature: 22.21 C
92
93   <repeats endlessly every second>
94