Skip to content

Commit

Permalink
boards: shields: Add Seeed Grove Accelerometer
Browse files Browse the repository at this point in the history
Add Seed Grove 3-Axis Digital Accelerometer

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

```
west build -p -b m5stack_atoms3/esp32s3/procpu samples/sensor/lis2dh/
--shield=seeed_grove_digital_accelerometer_lis3dhtr@grove_i2c1
```

Signed-off-by: TOKITA Hiroshi <[email protected]>
  • Loading branch information
soburi committed Jan 9, 2025
1 parent 7cc63ca commit f6a2a6e
Show file tree
Hide file tree
Showing 5 changed files with 106 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,59 @@
.. _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_[sensor_model]`` when you invoke ``west build``.
For example:

.. zephyr-app-commands::
:zephyr-app: samples/sensor/sensor_shell
:board: wio_terminal/samd51p19a
:shield: seeed_grove_adxl345
:goals: build

This shield can take a option to select grove bus.

.. zephyr-app-commands::
:zephyr-app: samples/sensor/sensor_shell
:board: wio_terminal/samd51p19a
:shield: seeed_grove_adxl345@grove_i2c1
: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,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 {
SHIELD_CONVENTIONAL_LABEL(lis3dh): lis3dh@SHIELD_ADDR_HEX {
compatible = "st,lis3dh", "st,lis2dh";
reg = <SHIELD_0X_ADDR>;

#if SHIELD_OPTION_DEFINED(IRQ_GPIO_PIN) || SHIELD_OPTION_DEFINED(IRQ_GPIO_PORT)
irq-gpios = <&SHIELD_OPTION(IRQ_GPIO_PORT)
SHIELD_OPTION(IRQ_GPIO_PIN)
SHIELD_OPTION(IRQ_GPIO_FLAG)>;
#endif
};
};
22 changes: 22 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,22 @@
shield:
name: seeed_grove_accel
full_name: Seeed Studio Grove 3-Axis Digital Accelerometer
vendor: seeed
variants:
- name: lis3dhtr
options:
conn:
type: string
default: "grove_i2c"
addr:
type: int
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"

0 comments on commit f6a2a6e

Please sign in to comment.