adxl345

package
v0.2.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package adxl345 implements the MovementSensor interface for the ADXL345 accelerometer attached to an I2C bus on the robot (the chip supports communicating over SPI as well, but this package does not support that interface). The datasheet for this chip is available at: https://www.analog.com/media/en/technical-documentation/data-sheets/adxl345.pdf

We support reading the accelerometer data off of the chip. We do not yet support using the digital interrupt pins to notify on events (freefall, collision, etc.).

Because we only support I2C interaction, the CS pin must be wired to hot (which tells the chip which communication interface to use). The chip has two possible I2C addresses, which can be selected by wiring the SDO pin to either hot or ground:

  • if SDO is wired to ground, it uses the default I2C address of 0x53
  • if SDO is wired to hot, it uses the alternate I2C address of 0x1D

If you use the alternate address, your config file for this component must set its "use_alternate_i2c_address" boolean to true.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdxl345

func NewAdxl345(
	ctx context.Context,
	deps registry.Dependencies,
	rawConfig config.Component,
	logger golog.Logger,
) (movementsensor.MovementSensor, error)

NewAdxl345 is a constructor to create a new object representing an ADXL345 accelerometer.

Types

type AttrConfig

type AttrConfig struct {
	BoardName              string `json:"board"`
	I2cBus                 string `json:"i2c_bus"`
	UseAlternateI2CAddress bool   `json:"use_alternate_i2c_address,omitempty"`
}

AttrConfig is a description of how to find an ADXL345 accelerometer on the robot.

func (*AttrConfig) Validate

func (cfg *AttrConfig) Validate(path string) ([]string, error)

Validate ensures all parts of the config are valid, and then returns the list of things we depend on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL