Documentation
¶
Overview ¶
Package bma42x provides a driver for the BMA421 and BMA425 accelerometer chips.
Here is a reasonably good datasheet: https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf
This driver was originally written for the PineTime, using the datasheet as a guide. There is an open source C driver provided by Bosch, but unfortunately it needs some small modifications to work with other chips (most importantly, the "config file"). The InfiniTime and Wasp-OS drivers for this accelerometer have also been used to figure out some driver details (especially step counting).
Index ¶
Constants ¶
const Address = 0x18 // BMA421/BMA425 address
const (
FeatureStepCounting = 1 << iota
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Which devices to support (OR the device types together as needed). Device DeviceType // Which features to enable. With Features == 0, only the accelerometer will // be enabled. Features Features }
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func (*Device) Acceleration ¶
Acceleration returns the last read acceleration in µg (micro-gravity). When one of the axes is pointing straight to Earth and the sensor is not moving the returned value will be around 1000000 or -1000000.
func (*Device) Steps ¶
Steps returns the number of steps counted since the BMA42x sensor was initialized.
func (*Device) Temperature ¶
Temperature returns the last read temperature in celsius milli degrees (1°C is 1000).
type DeviceType ¶
type DeviceType uint8
const ( DeviceBMA421 DeviceType = 1 << iota DeviceBMA425 AnyDevice = DeviceBMA421 | DeviceBMA425 )