Skip to content

Commit 016f455

Browse files
pyhyskartben
authored andcommitted
Boards: Shields: Add Adafruit LIS3DH accelerometer shield
Add the Adafruit LIS3DH I2C accelerometer shield. The picture is from the Adafruit product page. Signed-off-by: Jonas Berg <[email protected]>
1 parent 8de9e05 commit 016f455

File tree

6 files changed

+111
-0
lines changed

6 files changed

+111
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Jonas Berg
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SHIELD_ADAFRUIT_LIS3DH
5+
def_bool $(shields_list_contains,adafruit_lis3dh)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2025 Jonas Berg
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/ {
7+
aliases {
8+
accel0 = &adafruit_lis3dh;
9+
};
10+
};
11+
12+
&zephyr_i2c {
13+
status = "okay";
14+
15+
adafruit_lis3dh: lis3dh@18 {
16+
compatible = "st,lis3dh", "st,lis2dh";
17+
reg = <0x18>;
18+
};
19+
};
Binary file not shown.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
.. _adafruit_lis3dh:
2+
3+
Adafruit LIS3DH Shield
4+
######################
5+
6+
Overview
7+
********
8+
9+
The `Adafruit LIS3DH Triple-Axis Accelerometer Sensor Shield`_ features
10+
a `ST LIS3DH 3-axis accelerometer`_ and two STEMMA QT connectors.
11+
12+
.. figure:: adafruit_lis3dh.webp
13+
:align: center
14+
:alt: Adafruit LIS3DH Shield
15+
16+
Adafruit LIS3DH Shield (Credit: Adafruit)
17+
18+
19+
Requirements
20+
************
21+
22+
This shield can be used with boards which provide an I2C connector, for
23+
example STEMMA QT or Qwiic connectors.
24+
The target board must define a ``zephyr_i2c`` node label.
25+
See :ref:`shields` for more details.
26+
27+
28+
Pin Assignments
29+
===============
30+
31+
+--------------+------------------------------------------------------+
32+
| Shield Pin | Function |
33+
+==============+======================================================+
34+
| SDA | LIS3DH I2C SDA |
35+
+--------------+------------------------------------------------------+
36+
| SCL | LIS3DH I2C SCL |
37+
+--------------+------------------------------------------------------+
38+
| INT | LIS3DH Interrupt out |
39+
+--------------+------------------------------------------------------+
40+
| SDO | LIS3DH I2C address selection. Pull down by default. |
41+
+--------------+------------------------------------------------------+
42+
| CS | LIS3DH Force I2C mode by setting it to high level. |
43+
+--------------+------------------------------------------------------+
44+
| I2 | LIS3DH Second interrupt out |
45+
+--------------+------------------------------------------------------+
46+
| A1-A3 | LIS3DH Analog-to-digital converter inputs. Not used. |
47+
+--------------+------------------------------------------------------+
48+
49+
In order to use interrupts you need to connect a separate wire from the
50+
shield to a GPIO pin on your microcontroller board. See
51+
:dtcompatible:`st,lis3dh` for documentation on how to adjust the
52+
devicetree file.
53+
54+
55+
Programming
56+
***********
57+
58+
Set ``--shield adafruit_lis3dh`` when you invoke ``west build``. For example
59+
when running the :zephyr:code-sample:`accel_polling` sample:
60+
61+
.. zephyr-app-commands::
62+
:zephyr-app: samples/sensor/accel_polling
63+
:board: adafruit_qt_py_rp2040
64+
:shield: adafruit_lis3dh
65+
:goals: build
66+
67+
.. _Adafruit LIS3DH Triple-Axis Accelerometer Sensor Shield:
68+
https://learn.adafruit.com/adafruit-lis3dh-triple-axis-accelerometer-breakout
69+
70+
.. _ST LIS3DH 3-axis accelerometer:
71+
https://www.st.com/en/mems-and-sensors/lis3dh.html
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2025, Jonas Berg
4+
5+
shield:
6+
name: adafruit_lis3dh
7+
full_name: Adafruit LIS3DH Triple-Axis Accelerometer Sensor Shield
8+
vendor: adafruit
9+
supported_features:
10+
- sensor

samples/sensor/accel_polling/sample.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@ tests:
5959
- SNIPPET="rtt-tracing;rtt-console"
6060
platform_allow:
6161
- apard32690/max32690/m4
62+
sample.sensor.accel_polling.shields:
63+
build_only: true
64+
platform_allow:
65+
- adafruit_qt_py_rp2040/rp2040
66+
extra_args:
67+
- platform:adafruit_qt_py_rp2040/rp2040:SHIELD="adafruit_lis3dh"

0 commit comments

Comments
 (0)