lis2hh – accelerometer device driver

LIS2HH Driver - i2c Accelerometer

This module provides high-level functions to access the basic accelerometer features, and low-level functions to allow access to the full register set for advanced usage.

Many advanced features are available - see datasheet

class lis2hh.LIS2HH(addr=30, int1_pin=machine.Pin)[source]

Device driver for LIS2HH accelerometer, controlled via i2c bus.

ctrl(reg, cmd)[source]

Set control registers

dump_axes()[source]

Debug - send axis values to stdout

enable_int1(threshold=20, duration=5, cb=None)[source]

Enable inertial interrupt on all axes. Threshold is upper byte of 16-bit value, 0 disables.

read()[source]

Read current XYZ axis values and update ‘self.orientation’ tuple

Returns

tuple of (x, y, z) axis values.

  • Default full-scale range is ±2g.

  • Values are signed 16-bit integer (-32767 to +32768)

reset()[source]

Init registers to default config

self_test()[source]

Run self-test and return device to default state. Return True if passed

set_byte(reg, val)[source]

Set byte register

sleep()[source]

Shutdown operation - draws about 5uA

static test_exceeds(a, b, delta)[source]

Test each iterable value: a[0..n] - b[0..n] > delta

verify_id()[source]

Verify device ID - return True if correct

wake()[source]

Recover from sleep