• Home
  • Annotate
  • current directory
Name Date Size #Lines LOC

..22-Aug-2025-

boards/22-Aug-2025-

src/22-Aug-2025-

CMakeLists.txt A D22-Aug-2025279 1310

Kconfig A D22-Aug-2025556 3222

README.rst A D22-Aug-20252.8 KiB7455

prj.conf A D22-Aug-2025461 186

sample.yaml A D22-Aug-2025232 109

README.rst

1.. zephyr:code-sample:: pressure_interrupt
2   :name: Barometric pressure and temperature sensor interrupt example
3   :relevant-api: sensor_interface
4
5   Manage interrupts from a barometric pressure and temperature sensor.
6
7Overview
8********
9
10This sample application uses a pressure sensor interrupt line to:
11
12* Inform when a measure is available in the sensor FIFO.
13  Temperature and pressure data are read and displayed in terminal.
14  If floats are supported, estimated altitude is also displayed.
15* Inform when the pressure value crosses a specified threshold.
16  Threshold corresponds to around a 50cm altitude increase.
17  A message is displayed in the terminal.
18* Inform when the pressure value changed more than the specified
19  value between two consecutive samples.
20  Change value corresponds to a finger pressing the sensor.
21  A message is displayed in the terminal.
22
23Wiring
24*******
25
26This sample uses an external breakout for the sensor.  A devicetree
27overlay must be provided to identify the I2C/SPI bus and GPIO used to
28control the sensor.
29
30Building and Running
31********************
32
33This sample supports pressure sensor devices. Device needs
34to be aliased as ``pressure-sensor``. For example:
35
36.. code-block:: devicetree
37
38	/ {
39		aliases {
40			pressure-sensor = &icp201xx;
41		};
42	};
43
44Make sure the aliases are in devicetree, then build and run with:
45
46.. zephyr-app-commands::
47   :zephyr-app: samples/sensor/pressure_interrupt
48   :board: nrf52dk/nrf52832
49   :goals: build flash
50
51Sample Output
52=============
53
54.. code-block:: console
55
56## Default configuration
57
58   [00:00:00.266,479] <inf> PRESS_INT_SAMPLE: Starting ICP201xx sample.
59   [00:00:00.273,803] <inf> PRESS_INT_SAMPLE: temp 25.49 Cel, pressure 96.271438 kPa, altitude 447.208465 m
60   [00:00:00.280,914] <inf> PRESS_INT_SAMPLE: temp 25.50 Cel, pressure 96.271331 kPa, altitude 447.234161 m
61   [00:00:00.288,024] <inf> PRESS_INT_SAMPLE: temp 25.49 Cel, pressure 96.266685 kPa, altitude 447.636077 m
62   [00:00:00.295,135] <inf> PRESS_INT_SAMPLE: temp 25.50 Cel, pressure 96.267951 kPa, altitude 447.537078 m
63   [00:00:00.302,246] <inf> PRESS_INT_SAMPLE: temp 25.51 Cel, pressure 96.268577 kPa, altitude 447.488281 m
64   [00:00:00.309,356] <inf> PRESS_INT_SAMPLE: temp 25.50 Cel, pressure 96.269340 kPa, altitude 447.414978 m
65   [00:00:00.316,467] <inf> PRESS_INT_SAMPLE: temp 25.50 Cel, pressure 96.268562 kPa, altitude 447.473663 m
66   [00:00:00.323,547] <inf> PRESS_INT_SAMPLE: temp 25.50 Cel, pressure 96.267341 kPa, altitude 447.596496 m
67   <repeats endlessly>
68
69   <when sensor is pressed>
70   [00:00:09.819,061] <inf> PRESS_INT_SAMPLE: PRESSURE CHANGE INTERRUPT
71
72   <when the sensor pressure crosses defined threhold>
73   [00:00:09.859,039] <inf> PRESS_INT_SAMPLE: PRESSURE THRESHOLD INTERRUPT
74