icm20789

package
v0.0.0-...-5f4f8ce Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ADDRESS_ACCEL_CONFIG  byte = 0x1C
	ADDRESS_ACCEL_CONFIG2 byte = 0x1D

	DATA_READ_SEGMENT byte = 0x3B

	ADDRESS_XA_OFFSH byte = 0x77
	ADDRESS_XA_OFFSL byte = 0x78
	ADDRESS_YA_OFFSH byte = 0x7A
	ADDRESS_YA_OFFSL byte = 0x7B
	ADDRESS_ZA_OFFSH byte = 0x7D
	ADDRESS_ZA_OFFSL byte = 0x7E
)
View Source
const (
	ADRESS_GYRO_CONFIG byte = 0x1B
	ADDRESS_XG_OFFSH   byte = 0x13
	ADDRESS_XG_OFFSL   byte = 0x14
	ADDRESS_YG_OFFSH   byte = 0x15
	ADDRESS_YG_OFFSL   byte = 0x16
	ADDRESS_ZG_OFFSH   byte = 0x17
	ADDRESS_ZG_OFFSL   byte = 0x18
)
View Source
const (
	ADDRESS_PWR_MGMT_1 byte = 0x6B
	ADDRESS_PWR_MGMT_2 byte = 0x6C
	ADDRESS_WHO_AM_I   byte = 0x75
)
View Source
const (
	PWR_MGMT_1_CONFIG_DEVICE_RESET byte = 0b10000000
	PWR_MGMT_1_CONFIG              byte = 0b00000000
	PWR_MGMT_2_CONFIG              byte = 0b00000000
)
View Source
const (
	ACCEL_CONFIG_DISABLE_SELF_TESTS byte = 0b00000000
)
View Source
const (
	RAW_DATA_SIZE int = 14
)

Variables

View Source
var ACCEL_CONFIG2_DEC2_CFG_N_SAMPLE = map[int]byte{
	4:  0b00000000,
	8:  0b00010000,
	16: 0b00100000,
	32: 0b00110000,
}
View Source
var ACCEL_CONFIG2_DLPF_CFG_3dB_BW = map[string]byte{
	"1046.0hz": 0b00001000,
	"523.0hz":  0b00000000,
	"218.1hz":  0b00000001,
	"99.0hz":   0b00000010,
	"44.8hz":   0b00000011,
	"21.2hz":   0b00000100,
	"10.2hz":   0b00000101,
	"5.1hz":    0b00000110,
	"420.0hz":  0b00000111,
}
View Source
var ACCEL_CONFIG2_FIFO_SIZE = map[int]byte{
	512:  0b00000000,
	1024: 0b01000000,
	2048: 0b10000000,
	4096: 0b11000000,
}
View Source
var ACCEL_CONFIG_G = map[string]byte{
	"2g":  0b00000000,
	"4g":  0b00001000,
	"8g":  0b00010000,
	"16g": 0b00011000,
}
View Source
var ACCEL_FULL_SCALE_G = map[string]float64{
	"2g":  16384,
	"4g":  8192,
	"8g":  4096,
	"16g": 2048,
}
View Source
var GYRO_CONFIG_DPS = map[string]byte{
	"250dps":  0b00000000,
	"500dps":  0b00001000,
	"1000dps": 0b00010000,
	"2000dps": 0b00011000,
}
View Source
var GYRO_FULL_SCALE_DPS = map[string]float64{
	"250dps":  131,
	"500dps":  65.5,
	"1000dps": 32.8,
	"2000dps": 16.4,
}

Functions

func AccHLtoOffset

func AccHLtoOffset(higherBits, lowerBits byte) uint16

func AccOffsetToHL

func AccOffsetToHL(offset uint16) (higherBits, lowerBits byte)

func GyroHLtoOffset

func GyroHLtoOffset(higherBits, lowerBits byte) uint16

func GyroOffsetToHL

func GyroOffsetToHL(offset uint16) (higherBits, lowerBits byte)

func NewICM20789

func NewICM20789(configs Configs) *memsIcm20789

Types

type AccelerometerConfigs

type AccelerometerConfigs struct {
	FullScale              string  `json:"full_scale"`
	Offsets                Offsets `json:"offsets"`
	LowPassFilterFrequency string  `json:"lowpass_filter_frequency"`
	NumberOfSamples        int     `json:"number_of_samples"`
}

type Configs

type Configs struct {
	Accelerometer AccelerometerConfigs    `json:"accelerometer"`
	Gyroscope     GyroscopeConfigs        `json:"gyroscope"`
	SPI           hardware.SPIConnConfigs `json:"spi"`
}

func ReadConfigs

func ReadConfigs(configPath string) Configs

type GyroscopeConfigs

type GyroscopeConfigs struct {
	FullScale string  `json:"full-scale"`
	Offsets   Offsets `json:"offsets"`
}

type HardwareConfigs

type HardwareConfigs struct {
	Configs Configs `json:"icm20789"`
}

type Offsets

type Offsets struct {
	X uint16 `json:"x"`
	Y uint16 `json:"y"`
	Z uint16 `json:"z"`
}

Jump to

Keyboard shortcuts

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