Skip to content

Commit

Permalink
boards: shields: Add Seeed Grove Accelerometer (LIS3DHTR)
Browse files Browse the repository at this point in the history
Add shield definition for Seeed's LIS3DHTR accelerometer.

This shield can take option to select connecting bus, so such like
following example.

```
west build -p -b m5stack_atoms3/esp32s3/procpu
--shield=seeed_grove_accel_lis3dhtr@1:addr=0x18 samples/sensor/lis2dh/
```

Signed-off-by: TOKITA Hiroshi <[email protected]>
  • Loading branch information
soburi committed Jan 12, 2025
1 parent b5e318f commit 8c6e421
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0

config SHIELD_SEEED_GROVE_LIS3DHTR
def_bool $(shields_list_contains,seeed_grove_lis3dhtr)
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.. _seeed_grove_3axis_digital_accelerometer:

Seeed Studio Grove 3-Axis Digital Accelerometer
###############################################

Overview
********

The Seeed Studio Grove 3-Axis Digital Accelerometer is a compact sensor module
that provides digital output of 3-axis acceleration.
There are several variations by the measurement range and chip.

.. figure:: img/grove_3axis_digital_accelerometer_lis3dhtr.webp
:align: center
:alt: Grove - 3-Axis Digital Accelerometer (LIS3DHTR)

Grove - 3-Axis Digital Accelerometer (LIS3DHTR) (Credit: Seeed Studio)

These allows for easy integration with Grove connector system.
More information about the Grove connector system can be found at the
`Grove Ecosystem Introduction`_.

Hardware
********

Currently the following models are supported:

- seeed_grove_lis3dhtr: see `Grove - 3-Axis Digital Accelerometer (LIS3DHTR)`_

Programming
***********

Set ``--shield seeed_grove_accel_[sensor_model]`` when you invoke ``west build``.
For example:

.. zephyr-app-commands::
:zephyr-app: samples/sensor/sensor_shell
:board: m5stack_core2/esp32/procpu
:shield: seeed_grove_accel_lis3dhtr
:goals: build

This shield can take a option to tweaking.
Such as connecting bus selection, i2c address, and etc.

.. zephyr-app-commands::
:zephyr-app: samples/sensor/sensor_shell
:board: wio_terminal/samd51p19a
:shield: seeed_grove_accel_lis3dhtr@1:addr=0x18
:goals: build

References
**********

.. target-notes::

.. _Grove Ecosystem Introduction:
https://wiki.seeedstudio.com/Grove_System/

.. _Grove - 3-Axis Digital Accelerometer (LIS3DHTR):
https://wiki.seeedstudio.com/Grove-3-Axis-Digital-Accelerometer-LIS3DHTR/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

/* For convenience, we use the same definitions as LIS3DHTR as the default for this series. */

#include "seeed_grove_accel.overlay"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/sensor/lis2dh.h>

&SHIELD_CONN_N {
SHIELD_CONVENTIONAL_LABEL(lis3dh): lis3dh@SHIELD_ADDR_HEX {
compatible = "st,lis3dh", "st,lis2dh";
reg = <SHIELD_0X_ADDR>;

#if SHIELD_OPTION_EXISTS(IRQ_GPIO_PIN) || SHIELD_OPTION_EXISTS(IRQ_GPIO_PORT)
irq-gpios = <&SHIELD_OPTION_STRING_UNQUOTED(IRQ_GPIO_PORT)
SHIELD_OPTION(IRQ_GPIO_PIN)
SHIELD_OPTION_STRING_UNQUOTED(IRQ_GPIO_FLAG)>;
#endif
};
};
26 changes: 26 additions & 0 deletions boards/shields/seeed_grove_3axis_digital_accelerometer/shield.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
shield:
name: seeed_grove_accel
full_name: Seeed Studio Grove - 3-Axis Digital Accelerometer
vendor: seeed
variants:
- name: lis3dhtr
full_name: Seeed Studio Grove - 3-Axis Digital Accelerometer (LIS3DHTR)
options:
addr:
default: 0x19
irq-gpio-pin:
type: int
default: 0
irq-gpio-port:
type: string
default: "gpio0"
irq-gpio-flag:
type: string
default: "GPIO_ACTIVE_HIGH"
options:
conn:
type: string
default: "grove_i2c"
addr:
type: int
default: 0x19

0 comments on commit 8c6e421

Please sign in to comment.