zephyr/boards/shields/x_nucleo_iks02a1/doc/index.rst
Gerard Marull-Paretas e81e92dbb9 boards: convert images to JPEG and reduce image size
The boards folder uses ~142.8 MB, being the largest in the repository.
This is due mostly to board images, which are in most cases not
optimized for web content. This patch tries to address this problem by
converting all pictures to JPEG (quality 75) and by adjusting its size
up to 750 px (the width of the documentation content). Images that
specified a fixed width in rst files are converted down to that value
instead.

With this patch, folder goes down to ~53.5 MB from 142.8 MB (-~63%).
Note that this patch introduces a new set of binary files to git
history, though (bad).

The process has been automated using this quickly crafted Python script:

```python
from pathlib import Path
import re
import subprocess

def process(doc, image, image_jpeg, size):
    subprocess.run(
        (
	     f"convert {image}"
	     "-background white -alpha remove -alpha off -quality 75"
	     f"-resize {size}\> {image_jpeg}"
	),
        shell=True,
        check=True,
        cwd=doc.parent,
    )
    if image != image_jpeg:
        (doc.parent / image).unlink()

for doc in Path(".").glob("boards/**/*.rst"):
    with open(doc) as f:
        content = ""
        image = None
        for line in f:
            m = re.match(r"^(\s*)\.\. (image|figure):: (.*)$", line)
            if m:
                if image:
                    process(doc, image, image_jpeg, size)

                image = Path(m.group(3))
                if image.suffix not in (".jpg", ".jpeg", ".png"):
                    content += line
                    image = None
                    continue

                image_jpeg = image.parent / (image.stem + ".jpg")
                size = 750
                content += (
                    f"{m.group(1)}.. {m.group(2)}:: {image_jpeg}\n"
                )
            elif image:
                m = re.match(r"\s*:height:\s*[0-9]+.*$", line)
                if m:
                    continue

                m = re.match(r"\s*:width:\s*([0-9]+).*$", line)
                if m:
                    size = min(int(m.group(1)), size)
                    continue

                content += line
                if line == "\n":
                    process(doc, image, image_jpeg, size)
                    image = None
            else:
                content += line

    with open(doc, "w") as f:
        f.write(content)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-29 10:18:18 +02:00

103 lines
3.3 KiB
ReStructuredText

.. _x-nucleo-iks02a1:
X-NUCLEO-IKS02A1: MEMS Inertial and Environmental Multi sensor shield
#####################################################################
Overview
********
The X-NUCLEO-IKS02A1 is a motion MEMS expansion board for the STM32 Nucleo,
fitting the requirements of industrial applications.
It is equipped with Arduino UNO R3 connector layout, and
is designed around the ISM330DHCX 3-axis accelerometer and 3-axis gyroscope,
the IIS2MDC 3-axis magnetometer, the IIS2DLPC 3-axis accelerometer and
the IMP34DT05 digital microphone.
The X-NUCLEO-IKS02A1 interfaces with the STM32 microcontroller via the I2C pin,
and it is possible to change the default I2C port.
.. image:: img/x-nucleo-iks02a1.jpg
:align: center
:alt: X-NUCLEO-IKS02A1
More information about the board can be found at the
`X-NUCLEO-IKS02A1 website`_.
Hardware Description
********************
X-NUCLEO-IKS02A1 provides the following key features:
- ISM330DHCX MEMS 3D accelerometer (±2/±4/±8/±16 g) and
3D gyroscope (±125/±250/±500/±1000/±2000 dps)
- IIS2MDC MEMS 3D magnetometer (±50 gauss)
- IIS2DLPC MEMS 3D accelerometer low power (±2/±4/±8/±16 g)
- IMP34DT05 MEMS digital omnidirectional microphone (-26 dBFS, ±3 dB sensitivity)
- DIL24 socket for additional MEMS adapters and other sensors (configurable in I2C or SPI)
- I2C sensor hub features on ISM330DHCX available
- Compatible with STM32 Nucleo boards
- Equipped with Arduino UNO R3 connector
- RoHS compliant
- WEEE compliant
Hardware Configuration
**********************
X-NUCLEO-IKS02A1 board connects the various devices on two separate I2C bus:
- IIS2DLPC and ISM330DHCX are on I2C2
- IIS2MDC is on I2C1
X-NUCLEO-IKS02A1 board can be configured in two different hardware modes, Mode 1 and Mode 2,
using the JP7/JP8 jumpers to modify to what the I2C1 bus connects to.
Mode 1: Standard Mode
=====================
In standard I2C mode the two buses are connected together. As a consequence, all devices on the shield
reside on the same I2C bus and are accessible from the main board mcu.
The jumper configuration to activate this mode is:
- JP7 => 1-2, 3-4 (I2C1 = I2C2, I2Cx=GND)
- JP8 => 1-2, 3-4 (I2C1 = I2C2, I2Cx=GND)
Mode 2: SensorHub Mode
======================
In SensorHub mode ISM330DHCX and IIS2DLPC are connected to I2C2 and are accessible from the main board mcu.
Instead, the IIS2MDC device is connected only to ISM330DHCX sensor through its SCx/SDX (I2Cx) pins.
The jumper configuration to activate this mode is:
- JP7 => 2-3 (I2C1 = I2Cx)
- JP8 => 2-3 (I2C1 = I2Cx)
More information about X-NUCLEO-IKS02A1 configuration modes can be found in the
`X-NUCLEO-IKS02A1 user manual`_
Programming
***********
Three samples are provided as examples for ``x-nucleo-iks02a1`` shield:
- :ref:`x-nucleo-iks02a1-std-sample` application, to be used when the shield is configured
in Standard Mode
- :ref:`x-nucleo-iks02a1-shub-sample` application, to be used when the shield is configured
in SensorHub Mode
- :ref:`x-nucleo-iks02a1-mic-sample` application, to be used to acquire data through the
on-board PDM microphone
See also :ref:`shields` for more details.
References
**********
.. target-notes::
.. _X-NUCLEO-IKS02A1 website:
http://www.st.com/en/ecosystems/x-nucleo-iks02a1.html
.. _X-NUCLEO-IKS02A1 user manual:
https://www.st.com/resource/en/user_manual/DM00651686.pdf