Skip to content

Parallax P8X32A/Propeller, P2X8C4M64P/Propeller 2 driver object for the ST L3GD20H 3DoF Gyroscope

License

Notifications You must be signed in to change notification settings

avsa242/l3gd20h-spin

Repository files navigation

l3gd20h-spin


This is a P8X32A/Propeller, P2X8C4M64P/Propeller 2 driver object for the ST L3GD20H 3DoF Gyroscope.

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.

Salient Features

  • I2C connection at up to 400kHz (default and alternate I2C address)
  • SPI (4-wire) connection at up to 4MHz (P1), ~6MHz (P2)
  • Read Gyroscope data (raw, or calculated in millionths of a degree per second)
  • Read flags for data ready or overrun
  • Set operation mode (power down, sleep, normal/active)
  • Set output data rate
  • Set high-pass filter freq for ODR, configure high-pass filter mode
  • Set interrupt mask (int1 & int2), active pin state, output type
  • Enable individual axes

Requirements

P1/SPIN1:

  • spin-standard-library
  • 1 extra core/cog for the PASM I2C or SPI engine, as applicable (or none, if bytecode-based engine is used)
  • sensor.gyroscope.common.spinh (provided by spin-standard-library)

P2/SPIN2:

  • p2-spin-standard-library
  • sensor.gyroscope.common.spin2h (provided by p2-spin-standard-library)

Compiler Compatibility

Processor Language Compiler Backend Status
P1 SPIN1 FlexSpin (6.9.4) Bytecode OK
P1 SPIN1 FlexSpin (6.9.4) Native/PASM OK
P2 SPIN2 FlexSpin (6.9.4) NuCode Some runtime issues
P2 SPIN2 FlexSpin (6.9.4) Native/PASM2 OK

(other versions or toolchains not listed are not supported, and may or may not work)

Limitations

  • TBD