ADXL355 Python Driver
Typed, transport-agnostic Python 3.10+ support for the Analog Devices ADXL355.
from adxl355 import ADXL355, PowerMode, Range
from adxl355.testing import MockTransport
transport = MockTransport()
transport.set_identity_ok()
device = ADXL355(transport)
device.probe()
device.set_range(Range.G2)
device.set_power_mode(PowerMode.MEASUREMENT)
print(device.read_acceleration_g())
Install optional Linux adapters with adxl355[spi] or adxl355[i2c].
Add adxl355[gpio] only for the Linux libgpiod v2 DRDY reference. The core
package remains dependency-free when no extra is selected.
See the repository root documentation for lifecycle, hardware wiring, and
cross-language behavior details.
Data-ready routing and bounded GPIO acquisition
from adxl355 import ADXL355, DataReadyConfig, InterruptPolarity
# Dedicated DRDY is a separate always-active-high output. INT polarity applies
# only when DATA_RDY is routed through INT1 or INT2.
device.configure_data_ready(
DataReadyConfig(
dedicated_drdy_enabled=True,
route_to_int1=False,
route_to_int2=False,
interrupt_polarity=InterruptPolarity.ACTIVE_LOW,
)
)
print(device.get_data_ready_config())
The maintained configuration API accepts only internal synchronization
(SYNC timing bits equal zero). External clock/synchronization modes multiplex
DRDY or INT2 differently and raise UnsupportedConfigurationError. The method
preserves unrelated INT_MAP, RANGE, and POWER_CTL bits, changes state in
standby, restores measurement mode, and attempts exact rollback after a failed
write. It does not read STATUS, so configuration itself does not clear a
pending DATA_RDY condition.
The repository's Linux reference uses the official libgpiod v2 Python binding and blocking rising-edge waits rather than GPIO polling:
python -m pip install -e 'python[i2c,gpio]'
cd python
PYTHONPATH=src python -m examples.linux_drdy \
--transport i2c --bus 1 --address 0x1D \
--gpio-chip /dev/gpiochip0 --gpio-line 17 \
--samples 32 --timeout-s 5 --max-missed-events 0
Every sample carries the kernel monotonic edge timestamp and GPIO line sequence
number. Sequence gaps, overall timeout, GPIO source failure, sensor bus failure,
and STATUS.FIFO_OVR are distinct and retain completed samples. The example is
finite, restores standby/±2 g/default ODR/default DRDY routing, and closes both
GPIO and bus resources. It is a reference command, not a background service.
The dedicated Raspberry Pi 5 I2C fixture physically passed this flow at commit
002173d0c8dae8b15261b6d00cf011011cf8db7c: 32/32 unique samples, GPIO line
sequence 1 through 32, zero missed events, zero FIFO overruns, and independent
readback of standby, ±2 g, default ODR, default interrupt mapping, internal sync,
and enabled dedicated DRDY. This result does not claim SPI or INT1/INT2-routed
interrupt validation.
Hardware offset calibration
from adxl355 import ADXL355, Axis, calculate_offset
current = device.read_offset(Axis.X)
offset = calculate_offset(measured_raw=1200, expected_raw=0, current_offset=current)
device.write_offset(Axis.X, offset)
print(device.read_offset(Axis.X))
One offset count equals 16 raw acceleration LSB. Writes are volatile, require a
successful probe, enter standby when necessary, and restore the prior power mode.
See ../docs/calibration.md for orientation, sampling, temperature, rollback,
and accuracy limitations.
Electrostatic self-test response
from adxl355 import ADXL355, SelfTestConfig
result = device.run_self_test(SelfTestConfig(sample_count=64, settle_samples=8))
print(result.abs_delta_g)
The sequence measures an ST1-only baseline followed by ST1+ST2 stimulation using
bounded DATA_RDY polling. The driver temporarily uses ±2 g and 125 Hz, then
restores SELF_TEST, RANGE, FILTER, POWER_CTL, and the cached range.
Default configuration reports the measured response without inventing normative
pass/fail limits. Applications may provide fixture-specific thresholds when they
own and document that policy.
Bounded FIFO sample reads
from adxl355 import FifoReadError
try:
result = device.read_fifo_samples(max_samples=8)
for sample in result.samples:
print(sample)
except FifoReadError as exc:
print("valid prefix:", exc.partial_samples)
print("exactly consumed locations:", exc.consumed_locations)
FIFO_ENTRIES counts axis locations, not XYZ samples: three locations form one
complete X/Y/Z sample and the hardware FIFO holds at most 96 locations (32
samples). One or two trailing locations are valid but remain unread until a
complete sample exists. The call is non-blocking and reads at most the
caller-provided bound.
Empty, overrun, marker-order, virtual-bit, truncated, and overlong conditions use
typed errors. When a later sample fails, already popped locations cannot be
restored; decode errors carry the valid prefix and exact consumed count. A bus
failure during FIFO_DATA sets consumption_indeterminate=True, requiring reset or
flush before the caller trusts FIFO alignment again.
Metadata
Release files for adxl355 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| adxl355-0.1.0.tar.gz | 19.3 kB | With provenance | Details for adxl355-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adxl355-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for adxl355-0.1.0-py3-none-any.whl |
Total release size: 43.4 kB
Release files / adxl355-0.1.0.tar.gz
| Download URL | adxl355-0.1.0.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c20107c2bf409adf0710594480605a116faa1cd6afb09b9ced03ee01a676e23f
|
|
BLAKE2b-256 checksum How to use checksums |
98295c32f34f0fec5d50b29b0cf7650c504fb12b37f2473167966a60538902f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logRelease files / adxl355-0.1.0-py3-none-any.whl
| Download URL | adxl355-0.1.0-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43905891d0bd497c97a4ca60f0c13d8797d6012c3fe66fb419fd8d099399917c
|
|
BLAKE2b-256 checksum How to use checksums |
ced2338a06434dfd6cb2a32775c9cef1c15c4279f2b393599a48ec6480c0d548
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logSecurity for adxl355 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for adxl355-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.