This is a P8X32A/Propeller, P2X8C4M64P/Propeller 2 driver object for the ST LSM6DSL 6DoF IMU.
IMPORTANT: This software is meant to be used with the spin-standard-library (P8X32A) or p2-spin-standard-library (P2X8C4M64P). Please install the applicable library first before attempting to use this code, otherwise you will be missing several files required to build the project.
- SPI connection at 4MHz (P1), up to 10MHz (P2)
- Set accelerometer and gyroscope full-scale, data rate
- Read accelerometer raw data, or scaled to micro-G's (live or from FIFO)
- Read gyroscope raw data, or scaled to micro-dps (live or from FIFO)
- Data ready flags
- Manually or automatically set accel/gyro bias offsets (accel: on-chip, gyro: in MCU RAM)
- Soft-reset
- Gyroscope sleep mode
- Set gyroscope low-pass filter
- Set INT1 interrupt mask
- Click/tap-detection (single): set threshold, time, latency, per-axis detection
- Free-fall detection: set threshold, time
- Auto-sleep/wake/(in)activity detection
- FIFO functionality: empty, full, overrun, watermark flags, unread sample count, set decimation of data entries to FIFO, set mode, set data rate, set watermark level
- Pedometer (step counter) embedded functionality support
P1/SPIN1:
- spin-standard-library
- 1 extra core/cog for the PASM I2C engine
- sensor.accel.common.spinh (provided by spin-standard-library)
- sensor.gyroscope.common.spinh (provided by spin-standard-library)
P2/SPIN2:
- p2-spin-standard-library
- sensor.accel.common.spinh (provided by spin-standard-library)
- sensor.gyroscope.common.spinh (provided by spin-standard-library)
Processor | Language | Compiler | Backend | Status |
---|---|---|---|---|
P1 | SPIN1 | FlexSpin (6.8.0) | Bytecode | OK |
P1 | SPIN1 | FlexSpin (6.8.0) | Native/PASM | OK |
P2 | SPIN2 | FlexSpin (6.8.0) | NuCode | Runtime issues |
P2 | SPIN2 | FlexSpin (6.8.0) | Native/PASM2 | OK |
(other versions or toolchains not listed are not supported, and may or may not work)
- Click detection currently only supports single-click
- When
gyro_scale()
is set to 2000dps, it is technically possible (though unlikely in practice) for the measurements returned bygyro_dps()
to overflow 32-bit signed integer max - this isn't protected against