Documentation/iio/adxl345.rst

Source file repositories/reference/linux-study-clean/Documentation/iio/adxl345.rst

File Facts

System
Linux kernel
Corpus path
Documentation/iio/adxl345.rst
Extension
.rst
Size
24699 bytes
Lines
467
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0

===============
ADXL345 driver
===============

This driver supports Analog Device's ADXL345/375 on SPI/I2C bus.

1. Supported Devices
====================

* `ADXL345 <https://www.analog.com/ADXL345>`_
* `ADXL375 <https://www.analog.com/ADXL375>`_

The ADXL345 is a general-purpose, low-power, 3-axis accelerometer with selectable
measurement ranges. The ADXL345 supports the following ranges:

- ±2g  (approx. ±19.61 m/s^2)
- ±4g  (approx. ±39.23 m/s^2)
- ±8g  (approx. ±78.45 m/s^2)
- ±16g (approx. ±156.91 m/s^2)

2. Device Attributes
====================

Each IIO device has a device folder under ``/sys/bus/iio/devices/iio:deviceX``,
where X is the IIO index of the device. Under these folders reside a set of
device files, depending on the characteristics and features of the hardware
device in question. These files are consistently generalized and documented in
the IIO ABI documentation.

The following table shows the ADXL345 related device files, found in the
specific device folder path ``/sys/bus/iio/devices/iio:deviceX``.

+-------------------------------------------+----------------------------------------------------------+
| 3-Axis Accelerometer related device files | Description                                              |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_sampling_frequency               | Currently selected sample rate.                          |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_sampling_frequency_available     | Available sampling frequency configurations.             |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_scale                            | Scale/range for the accelerometer channels.              |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_scale_available                  | Available scale ranges for the accelerometer channel.    |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_x_calibbias                      | Calibration offset for the X-axis accelerometer channel. |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_x_raw                            | Raw X-axis accelerometer channel value.                  |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_y_calibbias                      | Y-axis acceleration offset correction                    |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_y_raw                            | Raw Y-axis accelerometer channel value.                  |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_z_calibbias                      | Calibration offset for the Z-axis accelerometer channel. |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_z_raw                            | Raw Z-axis accelerometer channel value.                  |
+-------------------------------------------+----------------------------------------------------------+

Channel Processed Values
-------------------------

A channel value can be read from its _raw attribute. The value returned is the
raw value as reported by the devices. To get the processed value of the channel,
apply the following formula:

.. code-block:: bash

        processed value = (_raw + _offset) * _scale

Where _offset and _scale are device attributes. If no _offset attribute is

Annotation

Implementation Notes