mpu9250

package
v3.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package mpu9250 MPU-9250 is a 9-axis MotionTracking device that combines a 3-axis gyroscope, 3-axis accelerometer, 3-axis magnetometer and a Digital Motion Processor™ (DMP)

Datasheet

https://www.invensense.com/wp-content/uploads/2015/02/PS-MPU-9250A-01-v1.1.pdf https://www.invensense.com/wp-content/uploads/2015/02/MPU-9250-Register-Map.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccelerometerData

type AccelerometerData struct {
	X, Y, Z int16
}

AccelerometerData the values for x/y/z axises.

type DebugF

type DebugF func(string, ...interface{})

DebugF the debug function type.

type Deviation

type Deviation struct {
	X, Y, Z float64
}

Deviation defines the standard deviation for major axises.

type GyroscopeData

type GyroscopeData struct {
	X, Y, Z int16
}

GyroscopeData the values for x/y/z axises.

type MPU9250

type MPU9250 struct {
	// contains filtered or unexported fields
}

MPU9250 defines the structure to keep reference to the transport.

func New

func New(transport Proto) (*MPU9250, error)

New Creates the new instance of the driver.

transport the transport interface.

func (*MPU9250) AccelerometerXIsEnabled

func (m *MPU9250) AccelerometerXIsEnabled() (bool, error)

AccelerometerXIsEnabled Get the X accelerometer status.

func (*MPU9250) AccelerometerYIsEnabled

func (m *MPU9250) AccelerometerYIsEnabled() (bool, error)

AccelerometerYIsEnabled Get the X accelerometer status.

func (*MPU9250) AccelerometerZIsEnabled

func (m *MPU9250) AccelerometerZIsEnabled() (bool, error)

AccelerometerZIsEnabled Get the Z accelerometer status.

func (*MPU9250) Calibrate

func (m *MPU9250) Calibrate() error

Calibrate Calibrates the device using maximum precision for both Gyroscope and Accelerometer.

func (*MPU9250) Debug

func (m *MPU9250) Debug(f DebugF)

Debug sets the debug logger implementation.

func (*MPU9250) DisableAccelerometerAxis

func (m *MPU9250) DisableAccelerometerAxis(axis byte) error

DisableAccelerometerAxis Accelerometer functions

axis MPU9250_DISABLE_XA_MASK, MPU9250_DISABLE_YA_MASK, MPU9250_DISABLE_ZA_MASK

func (*MPU9250) DisableGyro

func (m *MPU9250) DisableGyro() error

DisableGyro Disables the gyroscope.

func (*MPU9250) DisableTemperature

func (m *MPU9250) DisableTemperature() error

DisableTemperature Disables the internal temperature sensor.

func (*MPU9250) EnableAccelerometer

func (m *MPU9250) EnableAccelerometer() error

EnableAccelerometer enables the accelerometer.

func (*MPU9250) EnableAccelerometerAxis

func (m *MPU9250) EnableAccelerometerAxis(axis byte) error

EnableAccelerometerAxis Accelerometer functions

axis MPU9250_DISABLE_XA_MASK, MPU9250_DISABLE_YA_MASK, MPU9250_DISABLE_ZA_MASK

func (*MPU9250) EnableGyro

func (m *MPU9250) EnableGyro() error

EnableGyro Enables the gyroscope.

func (*MPU9250) EnableTemperature

func (m *MPU9250) EnableTemperature() error

EnableTemperature Enable internal temperature sensor.

func (*MPU9250) GetAccelFIFOEnabled

func (m *MPU9250) GetAccelFIFOEnabled() (bool, error)

GetAccelFIFOEnabled Get accelerometer FIFO enabled value.

When set to 1, this bit enables ACCEL_XOUT_H, ACCEL_XOUT_L, ACCEL_YOUT_H, ACCEL_YOUT_L, ACCEL_ZOUT_H, and ACCEL_ZOUT_L (Registers 59 to 64) to be written into the FIFO buffer.

func (*MPU9250) GetAccelRange

func (m *MPU9250) GetAccelRange() (byte, error)

GetAccelRange Get full-scale accelerometer range.

The FS_SEL parameter allows setting the full-scale range of the accelerometer sensors, as described in the table below.

0 = +/- 2g 1 = +/- 4g 2 = +/- 8g 3 = +/- 16g

func (*MPU9250) GetAcceleration

func (m *MPU9250) GetAcceleration() (*AccelerometerData, error)

GetAcceleration Get 3-axis accelerometer readings.

These registers store the most recent accelerometer measurements. Accelerometer measurements are written to these registers at the Sample Rate as defined in Register 25.

The accelerometer measurement registers, along with the temperature measurement registers, gyroscope measurement registers, and external sensor data registers, are composed of two sets of registers: an internal register set and a user-facing read register set.

The data within the accelerometer sensors' internal register set is always updated at the Sample Rate. Meanwhile, the user-facing read register set duplicates the internal register set's data values whenever the serial interface is idle. This guarantees that a burst read of sensor registers will read measurements from the same sampling instant. Note that if burst reads are not used, the user is responsible for ensuring a set of single byte reads correspond to a single sampling instant by checking the Data Ready interrupt.

Each 16-bit accelerometer measurement has a full scale defined in ACCEL_FS (Register 28). For each full scale setting, the accelerometers' sensitivity per LSB in ACCEL_xOUT is shown in the table below:

AFS_SEL | Full Scale Range | LSB Sensitivity --------+------------------+---------------- 0 | +/- 2g | 8192 LSB/mg 1 | +/- 4g | 4096 LSB/mg 2 | +/- 8g | 2048 LSB/mg 3 | +/- 16g | 1024 LSB/mg

func (*MPU9250) GetAccelerationX

func (m *MPU9250) GetAccelerationX() (int16, error)

GetAccelerationX Get X-axis accelerometer reading.

func (*MPU9250) GetAccelerationY

func (m *MPU9250) GetAccelerationY() (int16, error)

GetAccelerationY Get Y-axis accelerometer reading.

func (*MPU9250) GetAccelerationZ

func (m *MPU9250) GetAccelerationZ() (int16, error)

GetAccelerationZ Get Z-axis accelerometer reading.

func (*MPU9250) GetAccelerometerTestData

func (m *MPU9250) GetAccelerometerTestData() (*AccelerometerData, error)

GetAccelerometerTestData Get the self-test data values from the registers.

func (*MPU9250) GetClockSource

func (m *MPU9250) GetClockSource() (byte, error)

GetClockSource Get clock source setting.

func (*MPU9250) GetDeviceID

func (m *MPU9250) GetDeviceID() (byte, error)

GetDeviceID Returns the devide ID

func (*MPU9250) GetFIFOByte

func (m *MPU9250) GetFIFOByte() (byte, error)

GetFIFOByte Get byte from FIFO buffer.

This register is used to read and write data from the FIFO buffer. Data is written to the FIFO in order of register number (from lowest to highest). If all the FIFO enable flags (see below) are enabled and all External Sensor Data registers (Registers 73 to 96) are associated with a Slave device, the contents of registers 59 through 96 will be written in order at the Sample Rate.

The contents of the sensor data registers (Registers 59 to 96) are written into the FIFO buffer when their corresponding FIFO enable flags are set to 1 in FIFO_EN (Register 35). An additional flag for the sensor data registers associated with I2C Slave 3 can be found in I2C_MST_CTRL (Register 36).

If the FIFO buffer has overflowed, the status bit FIFO_OFLOW_INT is automatically set to 1. This bit is located in INT_STATUS (Register 58). When the FIFO buffer has overflowed, the oldest data will be lost and new data will be written to the FIFO.

If the FIFO buffer is empty, reading this register will return the last byte that was previously read from the FIFO until new data is available. The user should check FIFO_COUNT to ensure that the FIFO buffer is not read when empty.

func (*MPU9250) GetFIFOCount

func (m *MPU9250) GetFIFOCount() (uint16, error)

GetFIFOCount Get current FIFO buffer size.

This value indicates the number of bytes stored in the FIFO buffer. This number is in turn the number of bytes that can be read from the FIFO buffer and it is directly proportional to the number of samples available given the set of sensor data bound to be stored in the FIFO (register 35 and 36).

func (*MPU9250) GetFIFOEnabled

func (m *MPU9250) GetFIFOEnabled() (bool, error)

GetFIFOEnabled Get FIFO enabled status.

When this bit is set to 0, the FIFO buffer is disabled. The FIFO buffer cannot be written to or read from while disabled. The FIFO buffer's state does not change unless the MPU-60X0 is power cycled.

func (*MPU9250) GetFSyncInterruptEnabled

func (m *MPU9250) GetFSyncInterruptEnabled() (bool, error)

GetFSyncInterruptEnabled Get FSYNC pin interrupt enabled setting.

Will be set 0 for disabled, 1 for enabled.

func (*MPU9250) GetFSyncInterruptLevel

func (m *MPU9250) GetFSyncInterruptLevel() (bool, error)

GetFSyncInterruptLevel Get FSYNC interrupt logic level mode.

func (*MPU9250) GetGyroRange

func (m *MPU9250) GetGyroRange() (byte, error)

GetGyroRange Get gyroscope range.

The FS_SEL parameter allows setting the full-scale range of the gyro sensors, as described in the table below.

0 = +/- 250 degrees/sec 1 = +/- 500 degrees/sec 2 = +/- 1000 degrees/sec 3 = +/- 2000 degrees/sec

func (*MPU9250) GetGyroTestData

func (m *MPU9250) GetGyroTestData() (*GyroscopeData, error)

GetGyroTestData Get the test data from self-test registers, factory settings.

func (*MPU9250) GetI2CBypassEnabled

func (m *MPU9250) GetI2CBypassEnabled() (bool, error)

GetI2CBypassEnabled Get I2C bypass enabled status.

When this bit is equal to 1 and I2C_MST_EN (Register 106 bit[5]) is equal to 0, the host application processor will be able to directly access the auxiliary I2C bus of the MPU-60X0. When this bit is equal to 0, the host application processor will not be able to directly access the auxiliary I2C bus of the MPU-60X0 regardless of the state of I2C_MST_EN (Register 106 bit[5]).

func (*MPU9250) GetI2CMasterModeEnabled

func (m *MPU9250) GetI2CMasterModeEnabled() (bool, error)

GetI2CMasterModeEnabled Get I2C Master Mode enabled status.

When this mode is enabled, the MPU-60X0 acts as the I2C Master to the external sensor slave devices on the auxiliary I2C bus. When this bit is cleared to 0, the auxiliary I2C bus lines (AUX_DA and AUX_CL) are logically driven by the primary I2C bus (SDA and SCL). This is a precondition to enabling Bypass Mode. For further information regarding Bypass Mode, please refer to Register 55.

func (*MPU9250) GetIntEnabled

func (m *MPU9250) GetIntEnabled() (byte, error)

GetIntEnabled Get full interrupt enabled status.

Full register byte for all interrupts, for quick reading. Each bit will be set 0 for disabled, 1 for enabled.

func (*MPU9250) GetIntFIFOBufferOverflowEnabled

func (m *MPU9250) GetIntFIFOBufferOverflowEnabled() (bool, error)

GetIntFIFOBufferOverflowEnabled Get FIFO Buffer Overflow interrupt enabled status.

Will be set 0 for disabled, 1 for enabled.

func (*MPU9250) GetIntI2CMasterEnabled

func (m *MPU9250) GetIntI2CMasterEnabled() (bool, error)

GetIntI2CMasterEnabled Get I2C Master interrupt enabled status.

This enables any of the I2C Master interrupt sources to generate an interrupt. Will be set 0 for disabled, 1 for enabled.

func (*MPU9250) GetIntStatus

func (m *MPU9250) GetIntStatus() (byte, error)

GetIntStatus Get full set of interrupt status bits.

These bits clear to 0 after the register has been read. Very useful for getting multiple INT statuses, since each single bit read clears all of them because it has to read the whole byte.

func (*MPU9250) GetInterruptDrive

func (m *MPU9250) GetInterruptDrive() (bool, error)

GetInterruptDrive Get interrupt drive mode.

Will be set false for push-pull, true for open-drain. @return Current interrupt drive mode (false=push-pull, true=open-drain)

func (*MPU9250) GetInterruptLatch

func (m *MPU9250) GetInterruptLatch() (bool, error)

GetInterruptLatch Get interrupt latch mode. (0=50us-pulse, 1=latch-until-int-cleared) Will be set 0 for 50us-pulse, 1 for latch-until-int-cleared.

func (*MPU9250) GetInterruptLatchClear

func (m *MPU9250) GetInterruptLatchClear() (bool, error)

GetInterruptLatchClear Get interrupt latch clear mode.

Will be set 0 for status-read-only, 1 for any-register-read.

func (*MPU9250) GetInterruptMode

func (m *MPU9250) GetInterruptMode() (bool, error)

GetInterruptMode Get interrupt logic level mode (false=active-high, true=active-low)

func (*MPU9250) GetLostArbitration

func (m *MPU9250) GetLostArbitration() (bool, error)

GetLostArbitration Get master arbitration lost status.

This bit automatically sets to 1 when the I2C Master has lost arbitration of the auxiliary I2C bus (an error condition). This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

func (*MPU9250) GetMasterClockSpeed

func (m *MPU9250) GetMasterClockSpeed() (byte, error)

GetMasterClockSpeed Get I2C master clock speed.

I2C_MST_CLK is a 4 bit unsigned value which configures a divider on the MPU-60X0 internal 8MHz clock. It sets the I2C master clock speed according to the following table:

I2C_MST_CLK | I2C Master Clock Speed | 8MHz Clock Divider ------------+------------------------+------------------- 0 | 348kHz | 23 1 | 333kHz | 24 2 | 320kHz | 25 3 | 308kHz | 26 4 | 296kHz | 27 5 | 286kHz | 28 6 | 276kHz | 29 7 | 267kHz | 30 8 | 258kHz | 31 9 | 500kHz | 16 10 | 471kHz | 17 11 | 444kHz | 18 12 | 421kHz | 19 13 | 400kHz | 20 14 | 381kHz | 21 15 | 364kHz | 22

func (*MPU9250) GetMotion6

func (m *MPU9250) GetMotion6() (*AccelerometerData, *RotationData, error)

GetMotion6 Get the motion data - accelerometer and rotation(gyroscope).

func (*MPU9250) GetMultiMasterEnabled

func (m *MPU9250) GetMultiMasterEnabled() (bool, error)

GetMultiMasterEnabled Get multi-master enabled value.

Multi-master capability allows multiple I2C masters to operate on the same bus. In circuits where multi-master capability is required, set MULT_MST_EN to 1. This will increase current drawn by approximately 30uA.

In circuits where multi-master capability is required, the state of the I2C bus must always be monitored by each separate I2C Master. Before an I2C Master can assume arbitration of the bus, it must first confirm that no other I2C Master has arbitration of the bus. When MULT_MST_EN is set to 1, the MPU-60X0's bus arbitration detection logic is turned on, enabling it to detect when the bus is available.

func (*MPU9250) GetPassthroughStatus

func (m *MPU9250) GetPassthroughStatus() (bool, error)

GetPassthroughStatus Get FSYNC interrupt status.

This bit reflects the status of the FSYNC interrupt from an external device into the MPU-60X0. This is used as a way to pass an external interrupt through the MPU-60X0 to the host application processor. When set to 1, this bit will cause an interrupt if FSYNC_INT_EN is asserted in INT_PIN_CFG (Register 55).

func (*MPU9250) GetRotation

func (m *MPU9250) GetRotation() (*RotationData, error)

GetRotation Get 3-axis gyroscope readings.

These gyroscope measurement registers, along with the accelerometer measurement registers, temperature measurement registers, and external sensor data registers, are composed of two sets of registers: an internal register set and a user-facing read register set. The data within the gyroscope sensors' internal register set is always updated at the Sample Rate. Meanwhile, the user-facing read register set duplicates the internal register set's data values whenever the serial interface is idle. This guarantees that a burst read of sensor registers will read measurements from the same sampling instant. Note that if burst reads are not used, the user is responsible for ensuring a set of single byte reads correspond to a single sampling instant by checking the Data Ready interrupt.

Each 16-bit gyroscope measurement has a full scale defined in FS_SEL (Register 27). For each full scale setting, the gyroscopes' sensitivity per LSB in GYRO_xOUT is shown in the table below:

FS_SEL | Full Scale Range | LSB Sensitivity -------+--------------------+---------------- 0 | +/- 250 degrees/s | 131 LSB/deg/s 1 | +/- 500 degrees/s | 65.5 LSB/deg/s 2 | +/- 1000 degrees/s | 32.8 LSB/deg/s 3 | +/- 2000 degrees/s | 16.4 LSB/deg/s

func (*MPU9250) GetRotationX

func (m *MPU9250) GetRotationX() (int16, error)

GetRotationX Get X-axis gyroscope reading.

func (*MPU9250) GetRotationY

func (m *MPU9250) GetRotationY() (int16, error)

GetRotationY Get Y-axis gyroscope reading.

func (*MPU9250) GetRotationZ

func (m *MPU9250) GetRotationZ() (int16, error)

GetRotationZ Get Z-axis gyroscope reading.

func (*MPU9250) GetSlave0FIFOEnabled

func (m *MPU9250) GetSlave0FIFOEnabled() (bool, error)

GetSlave0FIFOEnabled Get Slave 0 FIFO enabled value.

When set to 1, this bit enables EXT_SENS_DATA registers (Registers 73 to 96) associated with Slave 0 to be written into the FIFO buffer.

func (*MPU9250) GetSlave0Nack

func (m *MPU9250) GetSlave0Nack() (bool, error)

GetSlave0Nack Get Slave 0 NACK status.

This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 0. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

func (*MPU9250) GetSlave1FIFOEnabled

func (m *MPU9250) GetSlave1FIFOEnabled() (bool, error)

GetSlave1FIFOEnabled Get Slave 1 FIFO enabled value.

When set to 1, this bit enables EXT_SENS_DATA registers (Registers 73 to 96) associated with Slave 1 to be written into the FIFO buffer.

func (*MPU9250) GetSlave1Nack

func (m *MPU9250) GetSlave1Nack() (bool, error)

GetSlave1Nack Get Slave 1 NACK status.

This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 1. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

func (*MPU9250) GetSlave2FIFOEnabled

func (m *MPU9250) GetSlave2FIFOEnabled() (bool, error)

GetSlave2FIFOEnabled Get Slave 2 FIFO enabled value.

When set to 1, this bit enables EXT_SENS_DATA registers (Registers 73 to 96) associated with Slave 2 to be written into the FIFO buffer.

func (*MPU9250) GetSlave2Nack

func (m *MPU9250) GetSlave2Nack() (bool, error)

GetSlave2Nack Get Slave 2 NACK status.

This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 2. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

func (*MPU9250) GetSlave3FIFOEnabled

func (m *MPU9250) GetSlave3FIFOEnabled() (bool, error)

GetSlave3FIFOEnabled Get Slave 3 FIFO enabled value.

When set to 1, this bit enables EXT_SENS_DATA registers (Registers 73 to 96) associated with Slave 3 to be written into the FIFO buffer.

func (*MPU9250) GetSlave3Nack

func (m *MPU9250) GetSlave3Nack() (bool, error)

GetSlave3Nack Get Slave 3 NACK status.

This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 3. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

func (*MPU9250) GetSlave4Address

func (m *MPU9250) GetSlave4Address() (byte, error)

GetSlave4Address Get the I2C address of Slave 4.

Note that Bit 7 (MSB) controls read/write mode. If Bit 7 is set, it's a read operation, and if it is cleared, then it's a write operation. The remaining bits (6-0) are the 7-bit device address of the slave device.

func (*MPU9250) GetSlave4Enabled

func (m *MPU9250) GetSlave4Enabled() (bool, error)

GetSlave4Enabled Get the enabled value for the Slave 4.

When set to 1, this bit enables Slave 4 for data transfer operations. When cleared to 0, this bit disables Slave 4 from data transfer operations.

func (*MPU9250) GetSlave4InputByte

func (m *MPU9250) GetSlave4InputByte() (byte, error)

GetSlave4InputByte Get last available byte read from Slave 4.

This register stores the data read from Slave 4. This field is populated after a read transaction.

func (*MPU9250) GetSlave4InterruptEnabled

func (m *MPU9250) GetSlave4InterruptEnabled() (bool, error)

GetSlave4InterruptEnabled Get the enabled value for Slave 4 transaction interrupts.

When set to 1, this bit enables the generation of an interrupt signal upon completion of a Slave 4 transaction. When cleared to 0, this bit disables the generation of an interrupt signal upon completion of a Slave 4 transaction. The interrupt status can be observed in Register 54.

func (*MPU9250) GetSlave4IsDone

func (m *MPU9250) GetSlave4IsDone() (bool, error)

GetSlave4IsDone Get Slave 4 transaction done status.

Automatically sets to 1 when a Slave 4 transaction has completed. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted and if the SLV_4_DONE_INT bit is asserted in the I2C_SLV4_CTRL register (Register 52).

func (*MPU9250) GetSlave4MasterDelay

func (m *MPU9250) GetSlave4MasterDelay() (byte, error)

GetSlave4MasterDelay Get Slave 4 master delay value.

This configures the reduced access rate of I2C slaves relative to the Sample Rate. When a slave's access rate is decreased relative to the Sample Rate, the slave is accessed every:

1 / (1 + I2C_MST_DLY) samples

This base Sample Rate in turn is determined by SMPLRT_DIV (register 25) and DLPF_CFG (register 26). Whether a slave's access rate is reduced relative to the Sample Rate is determined by I2C_MST_DELAY_CTRL (register 103). For further information regarding the Sample Rate, please refer to register 25.

func (*MPU9250) GetSlave4Nack

func (m *MPU9250) GetSlave4Nack() (bool, error)

GetSlave4Nack Get Slave 4 NACK status.

This bit automatically sets to 1 when the I2C Master receives a NACK in a transaction with Slave 4. This triggers an interrupt if the I2C_MST_INT_EN bit in the INT_ENABLE register (Register 56) is asserted.

func (*MPU9250) GetSlave4Register

func (m *MPU9250) GetSlave4Register() (byte, error)

GetSlave4Register Get the active internal register for the Slave 4.

Read/write operations for this slave will be done to whatever internal register address is stored in this MPU register.

func (*MPU9250) GetSlave4WriteMode

func (m *MPU9250) GetSlave4WriteMode() (bool, error)

GetSlave4WriteMode Get write mode for Slave 4.

When set to 1, the transaction will read or write data only. When cleared to 0, the transaction will write a register address prior to reading or writing data. This should equal 0 when specifying the register address within the Slave device to/from which the ensuing data transaction will take place.

func (*MPU9250) GetSlaveAddress

func (m *MPU9250) GetSlaveAddress(num byte) (byte, error)

GetSlaveAddress Get the I2C address of the specified slave (0-3).

Note that Bit 7 (MSB) controls read/write mode. If Bit 7 is set, it's a read operation, and if it is cleared, then it's a write operation. The remaining bits (6-0) are the 7-bit device address of the slave device.

In read mode, the result of the read is placed in the lowest available EXT_SENS_DATA register. For further information regarding the allocation of read results, please refer to the EXT_SENS_DATA register description (Registers 73 - 96).

The MPU-6050 supports a total of five slaves, but Slave 4 has unique characteristics, and so it has its own functions (getSlave4* and setSlave4*).

I2C data transactions are performed at the Sample Rate, as defined in Register 25. The user is responsible for ensuring that I2C data transactions to and from each enabled Slave can be completed within a single period of the Sample Rate.

The I2C slave access rate can be reduced relative to the Sample Rate. This reduced access rate is determined by I2C_MST_DLY (Register 52). Whether a slave's access rate is reduced relative to the Sample Rate is determined by I2C_MST_DELAY_CTRL (Register 103).

The processing order for the slaves is fixed. The sequence followed for processing the slaves is Slave 0, Slave 1, Slave 2, Slave 3 and Slave 4. If a particular Slave is disabled it will be skipped.

Each slave can either be accessed at the sample rate or at a reduced sample rate. In a case where some slaves are accessed at the Sample Rate and some slaves are accessed at the reduced rate, the sequence of accessing the slaves (Slave 0 to Slave 4) is still followed. However, the reduced rate slaves will be skipped if their access rate dictates that they should not be accessed during that particular cycle. For further information regarding the reduced access rate, please refer to Register 52. Whether a slave is accessed at the Sample Rate or at the reduced rate is determined by the Delay Enable bits in Register 103.

func (*MPU9250) GetSlaveDataLength

func (m *MPU9250) GetSlaveDataLength(num byte) (byte, error)

GetSlaveDataLength Get number of bytes to read for the specified slave (0-3).

Specifies the number of bytes transferred to and from Slave 0. Clearing this bit to 0 is equivalent to disabling the register by writing 0 to I2C_SLV0_EN.

num Slave number (0-3)

func (*MPU9250) GetSlaveEnabled

func (m *MPU9250) GetSlaveEnabled(num byte) (bool, error)

GetSlaveEnabled Get the enabled value for the specified slave (0-3).

When set to 1, this bit enables Slave 0 for data transfer operations. When cleared to 0, this bit disables Slave 0 from data transfer operations. @param num Slave number (0-3)

func (*MPU9250) GetSlaveReadWriteTransitionEnabled

func (m *MPU9250) GetSlaveReadWriteTransitionEnabled() (bool, error)

GetSlaveReadWriteTransitionEnabled Get slave read/write transition enabled value.

The I2C_MST_P_NSR bit configures the I2C Master's transition from one slave read to the next slave read. If the bit equals 0, there will be a restart between reads. If the bit equals 1, there will be a stop followed by a start of the following read. When a write transaction follows a read transaction, the stop followed by a start of the successive write will be always used.

func (*MPU9250) GetSlaveRegister

func (m *MPU9250) GetSlaveRegister(num byte) (byte, error)

GetSlaveRegister Get the active internal register for the specified slave (0-3).

Read/write operations for this slave will be done to whatever internal register address is stored in this MPU register.

The MPU-6050 supports a total of five slaves, but Slave 4 has unique characteristics, and so it has its own functions.

num Slave number (0-3)

func (*MPU9250) GetSlaveWordByteSwap

func (m *MPU9250) GetSlaveWordByteSwap(num byte) (bool, error)

GetSlaveWordByteSwap Get word pair byte-swapping enabled for the specified slave (0-3).

When set to 1, this bit enables byte swapping. When byte swapping is enabled, the high and low bytes of a word pair are swapped. Please refer to I2C_SLV0_GRP for the pairing convention of the word pairs. When cleared to 0, bytes transferred to and from Slave 0 will be written to EXT_SENS_DATA registers in the order they were transferred.

num Slave number (0-3)

func (*MPU9250) GetSlaveWordGroupOffset

func (m *MPU9250) GetSlaveWordGroupOffset(num byte) (bool, error)

GetSlaveWordGroupOffset Get word pair grouping order offset for the specified slave (0-3).

This sets specifies the grouping order of word pairs received from registers. When cleared to 0, bytes from register addresses 0 and 1, 2 and 3, etc (even, then odd register addresses) are paired to form a word. When set to 1, bytes from register addresses are paired 1 and 2, 3 and 4, etc. (odd, then even register addresses) are paired to form a word.

num Slave number (0-3)
Current word pair grouping order offset for specified slave

func (*MPU9250) GetSlaveWriteMode

func (m *MPU9250) GetSlaveWriteMode(num byte) (bool, error)

GetSlaveWriteMode Get write mode for the specified slave (0-3).

When set to 1, the transaction will read or write data only. When cleared to 0, the transaction will write a register address prior to reading or writing data. This should equal 0 when specifying the register address within the Slave device to/from which the ensuing data transaction will take place.

num Slave number (0-3)

func (*MPU9250) GetSleepEnabled

func (m *MPU9250) GetSleepEnabled() (bool, error)

GetSleepEnabled Get sleep mode status.

Setting the SLEEP bit in the register puts the device into very low power sleep mode. In this mode, only the serial interface and internal registers remain active, allowing for a very low standby current. Clearing this bit puts the device back into normal mode. To save power, the individual standby selections for each of the gyros should be used if any gyro axis is not used by the application.

func (*MPU9250) GetTempFIFOEnabled

func (m *MPU9250) GetTempFIFOEnabled() (bool, error)

GetTempFIFOEnabled Get temperature FIFO enabled value.

When set to 1, this bit enables TEMP_OUT_H and TEMP_OUT_L (Registers 65 and 66) to be written into the FIFO buffer.

func (*MPU9250) GetTemperature

func (m *MPU9250) GetTemperature() (uint16, error)

GetTemperature Get the current temperature. ((Temp_out - room_temp_offset)/temp_sensitivity) + 21; //celcius

func (*MPU9250) GetWaitForExternalSensorEnabled

func (m *MPU9250) GetWaitForExternalSensorEnabled() (bool, error)

GetWaitForExternalSensorEnabled Get wait-for-external-sensor-data enabled value.

When the WAIT_FOR_ES bit is set to 1, the Data Ready interrupt will be delayed until External Sensor data from the Slave Devices are loaded into the EXT_SENS_DATA registers. This is used to ensure that both the internal sensor data (i.e. from gyro and accel) and external sensor data have been loaded to their respective data registers (i.e. the data is synced) when the Data Ready interrupt is triggered.

func (*MPU9250) GetWakeCycleEnabled

func (m *MPU9250) GetWakeCycleEnabled() (bool, error)

GetWakeCycleEnabled Get wake cycle enabled status.

When this bit is set to 1 and SLEEP is disabled, the MPU-60X0 will cycle between sleep mode and waking up to take a single sample of data from active sensors at a rate determined by LP_WAKE_CTRL (register 108).

func (*MPU9250) GetXGyroFIFOEnabled

func (m *MPU9250) GetXGyroFIFOEnabled() (bool, error)

GetXGyroFIFOEnabled Get gyroscope X-axis FIFO enabled value.

When set to 1, this bit enables GYRO_XOUT_H and GYRO_XOUT_L (Registers 67 and 68) to be written into the FIFO buffer.

func (*MPU9250) GetXGyroOffset

func (m *MPU9250) GetXGyroOffset() (uint16, error)

GetXGyroOffset Returns the offset of X gyroscope.

func (*MPU9250) GetYGyroFIFOEnabled

func (m *MPU9250) GetYGyroFIFOEnabled() (bool, error)

GetYGyroFIFOEnabled Get gyroscope Y-axis FIFO enabled value.

When set to 1, this bit enables GYRO_YOUT_H and GYRO_YOUT_L (Registers 69 and 70) to be written into the FIFO buffer. @return Current gyroscope Y-axis FIFO enabled value @see MPU9250_RA_FIFO_EN /

func (*MPU9250) GetYGyroOffset

func (m *MPU9250) GetYGyroOffset() (uint16, error)

GetYGyroOffset Returns the offset of y gyroscope.

func (*MPU9250) GetZGyroFIFOEnabled

func (m *MPU9250) GetZGyroFIFOEnabled() (bool, error)

GetZGyroFIFOEnabled Get gyroscope Z-axis FIFO enabled value.

When set to 1, this bit enables GYRO_ZOUT_H and GYRO_ZOUT_L (Registers 71 and 72) to be written into the FIFO buffer.

func (*MPU9250) GetZGyroOffset

func (m *MPU9250) GetZGyroOffset() (uint16, error)

GetZGyroOffset Returns the offset of Z gyroscope.

func (*MPU9250) GyroXIsEnabled

func (m *MPU9250) GyroXIsEnabled() (bool, error)

GyroXIsEnabled Get the X axis enabled flag.

func (*MPU9250) GyroYIsEnabled

func (m *MPU9250) GyroYIsEnabled() (bool, error)

GyroYIsEnabled Get the Y axis enabled flag.

func (*MPU9250) GyroZIsEnabled

func (m *MPU9250) GyroZIsEnabled() (bool, error)

GyroZIsEnabled Get the Z axis enabled flag.

func (*MPU9250) Init

func (m *MPU9250) Init() error

Init initializes the device

func (*MPU9250) ReadSignedWord

func (m *MPU9250) ReadSignedWord(hi, lo byte) (int16, error)

ReadSignedWord Reads signed word from the provided high/low registers addresses.

func (*MPU9250) ReadWord

func (m *MPU9250) ReadWord(hi, lo byte) (uint16, error)

ReadWord Reads unsigned int from the provided addresses.

hi high 8 bit address
lo low 8 bit address

func (*MPU9250) Reset

func (m *MPU9250) Reset() error

Reset Trigger a full device reset.

A small delay of ~50ms may be desirable after triggering a reset.

func (*MPU9250) ResetAccelerometerPath

func (m *MPU9250) ResetAccelerometerPath() error

ResetAccelerometerPath Reset accelerometer signal path.

The reset will revert the signal path analog to digital converters and filters to their power up configurations.

func (*MPU9250) ResetFIFO

func (m *MPU9250) ResetFIFO() error

ResetFIFO Reset the FIFO.

This bit resets the FIFO buffer when set to 1 while FIFO_EN equals 0. This bit automatically clears to 0 after the reset has been triggered.

func (*MPU9250) ResetGyroscopePath

func (m *MPU9250) ResetGyroscopePath() error

ResetGyroscopePath Reset gyroscope signal path.

The reset will revert the signal path analog to digital converters and filters to their power up configurations.

func (*MPU9250) ResetI2CMaster

func (m *MPU9250) ResetI2CMaster() error

ResetI2CMaster Reset the I2C Master.

This bit resets the I2C Master when set to 1 while I2C_MST_EN equals 0. This bit automatically clears to 0 after the reset has been triggered.

func (*MPU9250) ResetSensors

func (m *MPU9250) ResetSensors() error

ResetSensors Reset all sensor registers and signal paths.

When set to 1, this bit resets the signal paths for all sensors (gyroscopes, accelerometers, and temperature sensor). This operation will also clear the sensor registers. This bit automatically clears to 0 after the reset has been triggered.

When resetting only the signal path (and not the sensor registers), please use Register 104, SIGNAL_PATH_RESET.

func (*MPU9250) ResetTemperaturePath

func (m *MPU9250) ResetTemperaturePath() error

ResetTemperaturePath Reset temperature sensor signal path.

The reset will revert the signal path analog to digital converters and filters to their power up configurations.

func (*MPU9250) SelfTest

func (m *MPU9250) SelfTest() (*SelfTestResult, error)

SelfTest runs the self test on the device.

returns the accelerator and gyroscope deviations from the factory defaults.

func (*MPU9250) SetAccelFIFOEnabled

func (m *MPU9250) SetAccelFIFOEnabled(enabled bool) error

SetAccelFIFOEnabled Set accelerometer FIFO enabled value.

enabled New accelerometer FIFO enabled value

func (*MPU9250) SetAccelRange

func (m *MPU9250) SetAccelRange(rangeVal byte) error

SetAccelRange Set full-scale accelerometer range.

The masked value is 11000

range New full-scale accelerometer range setting

func (*MPU9250) SetAccelerationOffsetX

func (m *MPU9250) SetAccelerationOffsetX(offset uint16) error

SetAccelerationOffsetX Set the acceleration trim offset for X axis.

func (*MPU9250) SetAccelerationOffsetY

func (m *MPU9250) SetAccelerationOffsetY(offset uint16) error

SetAccelerationOffsetY Set the acceleration trim offset for Y axis.

func (*MPU9250) SetAccelerationOffsetZ

func (m *MPU9250) SetAccelerationOffsetZ(offset uint16) error

SetAccelerationOffsetZ Set the acceleration trim offset for Z axis.

func (*MPU9250) SetClockSource

func (m *MPU9250) SetClockSource(src byte) error

SetClockSource Set clock source setting.

An internal 8MHz oscillator, gyroscope based clock, or external sources can be selected as the MPU-60X0 clock source. When the internal 8 MHz oscillator or an external source is chosen as the clock source, the MPU-60X0 can operate in low power modes with the gyroscopes disabled.

Upon power up, the MPU-60X0 clock source defaults to the internal oscillator. However, it is highly recommended that the device be configured to use one of the gyroscopes (or an external clock source) as the clock reference for improved stability. The clock source can be selected according to the following table:

CLK_SEL | Clock Source --------+-------------------------------------- 0 | Internal oscillator 1 | PLL with X Gyro reference 2 | PLL with Y Gyro reference 3 | PLL with Z Gyro reference 4 | PLL with external 32.768kHz reference 5 | PLL with external 19.2MHz reference 6 | Reserved 7 | Stops the clock and keeps the timing generator in reset

func (*MPU9250) SetFIFOByte

func (m *MPU9250) SetFIFOByte(data byte) error

SetFIFOByte Write byte to FIFO buffer.

func (*MPU9250) SetFIFOEnabled

func (m *MPU9250) SetFIFOEnabled(enabled bool) error

SetFIFOEnabled Set FIFO enabled status.

enabled New FIFO enabled status

func (*MPU9250) SetFSyncInterruptEnabled

func (m *MPU9250) SetFSyncInterruptEnabled(enabled bool) error

SetFSyncInterruptEnabled Set FSYNC pin interrupt enabled setting.

enabled New FSYNC pin interrupt enabled setting

func (*MPU9250) SetFSyncInterruptLevel

func (m *MPU9250) SetFSyncInterruptLevel(level bool) error

SetFSyncInterruptLevel Set FSYNC interrupt logic level mode.

mode New FSYNC interrupt mode (0=active-high, 1=active-low)

func (*MPU9250) SetGyroRange

func (m *MPU9250) SetGyroRange(rangeVal byte) error

SetGyroRange Set gyroscope range.

range New gyroscope range value the mask is 11000

func (*MPU9250) SetI2CBypassEnabled

func (m *MPU9250) SetI2CBypassEnabled(enabled bool) error

SetI2CBypassEnabled Set I2C bypass enabled status.

When this bit is equal to 1 and I2C_MST_EN (Register 106 bit[5]) is equal to 0, the host application processor will be able to directly access the auxiliary I2C bus of the MPU-60X0. When this bit is equal to 0, the host application processor will not be able to directly access the auxiliary I2C bus of the MPU-60X0 regardless of the state of I2C_MST_EN (Register 106 bit[5]).

enabled New I2C bypass enabled status

func (*MPU9250) SetI2CMasterModeEnabled

func (m *MPU9250) SetI2CMasterModeEnabled(enabled bool) error

SetI2CMasterModeEnabled Set I2C Master Mode enabled status.

enabled New I2C Master Mode enabled status

func (*MPU9250) SetIntEnabled

func (m *MPU9250) SetIntEnabled(enabled byte) error

SetIntEnabled Set full interrupt enabled status.

Full register byte for all interrupts, for quick reading. Each bit should be set 0 for disabled, 1 for enabled.

enabled New interrupt enabled status

func (*MPU9250) SetIntFIFOBufferOverflowEnabled

func (m *MPU9250) SetIntFIFOBufferOverflowEnabled(enabled bool) error

SetIntFIFOBufferOverflowEnabled Set FIFO Buffer Overflow interrupt enabled status.

enabled New interrupt enabled status

func (*MPU9250) SetIntI2CMasterEnabled

func (m *MPU9250) SetIntI2CMasterEnabled(enabled bool) error

SetIntI2CMasterEnabled Set I2C Master interrupt enabled status.

enabled New interrupt enabled status

func (*MPU9250) SetInterruptDrive

func (m *MPU9250) SetInterruptDrive(drive bool) error

SetInterruptDrive Set interrupt drive mode.

drive New interrupt drive mode (0=push-pull, 1=open-drain)

func (*MPU9250) SetInterruptLatch

func (m *MPU9250) SetInterruptLatch(latch bool) error

SetInterruptLatch Set interrupt latch mode.

latch New latch mode (0=50us-pulse, 1=latch-until-int-cleared)

func (*MPU9250) SetInterruptLatchClear

func (m *MPU9250) SetInterruptLatchClear(clear bool) error

SetInterruptLatchClear Set interrupt latch clear mode.

clear New latch clear mode (0=status-read-only, 1=any-register-read)

func (*MPU9250) SetInterruptMode

func (m *MPU9250) SetInterruptMode(mode bool) error

SetInterruptMode Set interrupt logic level mode.

mode New interrupt mode (false=active-high, true=active-low)

func (*MPU9250) SetMasterClockSpeed

func (m *MPU9250) SetMasterClockSpeed(speed byte) error

SetMasterClockSpeed Set I2C master clock speed.

speed Current I2C master clock speed

func (*MPU9250) SetMultiMasterEnabled

func (m *MPU9250) SetMultiMasterEnabled(enabled bool) error

SetMultiMasterEnabled Set multi-master enabled value.

enabled New multi-master enabled value

func (*MPU9250) SetSlave0FIFOEnabled

func (m *MPU9250) SetSlave0FIFOEnabled(enabled bool) error

SetSlave0FIFOEnabled Set Slave 0 FIFO enabled value.

enabled New Slave 0 FIFO enabled value

func (*MPU9250) SetSlave1FIFOEnabled

func (m *MPU9250) SetSlave1FIFOEnabled(enabled bool) error

SetSlave1FIFOEnabled Set Slave 1 FIFO enabled value.

enabled New Slave 1 FIFO enabled value

func (*MPU9250) SetSlave2FIFOEnabled

func (m *MPU9250) SetSlave2FIFOEnabled(enabled bool) error

SetSlave2FIFOEnabled Set Slave 2 FIFO enabled value.

enabled New Slave 2 FIFO enabled value

func (*MPU9250) SetSlave3FIFOEnabled

func (m *MPU9250) SetSlave3FIFOEnabled(enabled bool) error

SetSlave3FIFOEnabled Set Slave 3 FIFO enabled value.

enabled New Slave 3 FIFO enabled value

func (*MPU9250) SetSlave4Address

func (m *MPU9250) SetSlave4Address(address byte) error

SetSlave4Address Set the I2C address of Slave 4.

address New address for Slave 4

func (*MPU9250) SetSlave4Enabled

func (m *MPU9250) SetSlave4Enabled(enabled bool) error

SetSlave4Enabled Set the enabled value for Slave 4.

enabled New enabled value for Slave 4

func (*MPU9250) SetSlave4InterruptEnabled

func (m *MPU9250) SetSlave4InterruptEnabled(enabled bool) error

SetSlave4InterruptEnabled Set the enabled value for Slave 4 transaction interrupts.

enabled New enabled value for Slave 4 transaction interrupts.

func (*MPU9250) SetSlave4MasterDelay

func (m *MPU9250) SetSlave4MasterDelay(delay byte) error

SetSlave4MasterDelay Set Slave 4 master delay value.

delay New Slave 4 master delay value

func (*MPU9250) SetSlave4OutputByte

func (m *MPU9250) SetSlave4OutputByte(data byte) error

SetSlave4OutputByte Set new byte to write to Slave 4.

This register stores the data to be written into the Slave 4. If I2C_SLV4_RW is set 1 (set to read), this register has no effect.

data New byte to write to Slave 4

func (*MPU9250) SetSlave4Register

func (m *MPU9250) SetSlave4Register(r byte) error

SetSlave4Register Set the active internal register for Slave 4.

reg New active register for Slave 4

func (*MPU9250) SetSlave4WriteMode

func (m *MPU9250) SetSlave4WriteMode(mode bool) error

SetSlave4WriteMode Set write mode for the Slave 4.

mode New write mode for Slave 4 (0 = register address + data, 1 = data only)

func (*MPU9250) SetSlaveAddress

func (m *MPU9250) SetSlaveAddress(num, address byte) error

SetSlaveAddress Set the I2C address of the specified slave (0-3).

num Slave number (0-3)

func (*MPU9250) SetSlaveDataLength

func (m *MPU9250) SetSlaveDataLength(num byte, length byte) error

SetSlaveDataLength Set number of bytes to read for the specified slave (0-3).

num Slave number (0-3)
length Number of bytes to read for specified slave

func (*MPU9250) SetSlaveEnabled

func (m *MPU9250) SetSlaveEnabled(num byte, enabled bool) error

SetSlaveEnabled Set the enabled value for the specified slave (0-3).

num Slave number (0-3)
enabled New enabled value for specified slave

func (*MPU9250) SetSlaveReadWriteTransitionEnabled

func (m *MPU9250) SetSlaveReadWriteTransitionEnabled(enabled bool) error

SetSlaveReadWriteTransitionEnabled Set slave read/write transition enabled value.

enabled New slave read/write transition enabled value

func (*MPU9250) SetSlaveRegister

func (m *MPU9250) SetSlaveRegister(num, r byte) error

SetSlaveRegister Set the active internal register for the specified slave (0-3).

num Slave number (0-3)
reg New active register for specified slave

func (*MPU9250) SetSlaveWordByteSwap

func (m *MPU9250) SetSlaveWordByteSwap(num byte, enabled bool) error

SetSlaveWordByteSwap Set word pair byte-swapping enabled for the specified slave (0-3).

num Slave number (0-3)
enabled New word pair byte-swapping enabled value for specified slave

func (*MPU9250) SetSlaveWordGroupOffset

func (m *MPU9250) SetSlaveWordGroupOffset(num byte, enabled bool) error

SetSlaveWordGroupOffset Set word pair grouping order offset for the specified slave (0-3).

num Slave number (0-3)
enabled New word pair grouping order offset for specified slave

func (*MPU9250) SetSlaveWriteMode

func (m *MPU9250) SetSlaveWriteMode(num byte, mode bool) error

SetSlaveWriteMode Set write mode for the specified slave (0-3).

num Slave number (0-3)
mode New write mode for specified slave (0 = register address + data, 1 = data only)

func (*MPU9250) SetSleepEnabled

func (m *MPU9250) SetSleepEnabled(enabled bool) error

SetSleepEnabled Set sleep mode status.

enabled New sleep mode enabled status

func (*MPU9250) SetTempFIFOEnabled

func (m *MPU9250) SetTempFIFOEnabled(enabled bool) error

SetTempFIFOEnabled Set temperature FIFO enabled value.

enabled New temperature FIFO enabled value

func (*MPU9250) SetWaitForExternalSensorEnabled

func (m *MPU9250) SetWaitForExternalSensorEnabled(enabled bool) error

SetWaitForExternalSensorEnabled Set wait-for-external-sensor-data enabled value.

enabled New wait-for-external-sensor-data enabled value

func (*MPU9250) SetWakeCycleEnabled

func (m *MPU9250) SetWakeCycleEnabled(enabled bool) error

SetWakeCycleEnabled Set wake cycle enabled status.

enabled New sleep mode enabled status

func (*MPU9250) SetXGyroFIFOEnabled

func (m *MPU9250) SetXGyroFIFOEnabled(enabled bool) error

SetXGyroFIFOEnabled Set gyroscope X-axis FIFO enabled value.

enabled New gyroscope X-axis FIFO enabled value

func (*MPU9250) SetXGyroOffset

func (m *MPU9250) SetXGyroOffset(offset uint16) error

SetXGyroOffset Sets the X gyroscope offset.

offset offset value.

func (*MPU9250) SetYGyroFIFOEnabled

func (m *MPU9250) SetYGyroFIFOEnabled(enabled bool) error

SetYGyroFIFOEnabled Set gyroscope Y-axis FIFO enabled value.

enabled New gyroscope Y-axis FIFO enabled value

func (*MPU9250) SetYGyroOffset

func (m *MPU9250) SetYGyroOffset(offset uint16) error

SetYGyroOffset Sets the Y gyroscope offset.

offset offset value.

func (*MPU9250) SetZGyroFIFOEnabled

func (m *MPU9250) SetZGyroFIFOEnabled(enabled bool) error

SetZGyroFIFOEnabled Set gyroscope Z-axis FIFO enabled value.

enabled New gyroscope Z-axis FIFO enabled value

func (*MPU9250) SetZGyroOffset

func (m *MPU9250) SetZGyroOffset(offset uint16) error

SetZGyroOffset Sets the Z gyroscope offset.

offset offset value.

func (*MPU9250) SwitchSPIEnabled

func (m *MPU9250) SwitchSPIEnabled(enabled bool) error

SwitchSPIEnabled Switch from I2C to SPI mode (MPU-6000 only)

If this is set, the primary SPI interface will be enabled in place of the disabled primary I2C interface.

func (*MPU9250) TemperatureIsEnabled

func (m *MPU9250) TemperatureIsEnabled() (bool, error)

TemperatureIsEnabled Is the temperature sensor enabled.

func (*MPU9250) WriteByteAddress

func (m *MPU9250) WriteByteAddress(address, value byte) error

WriteByteAddress Writes the byte address

type Proto

type Proto interface {
	// contains filtered or unexported methods
}

Proto defines the low-level methods used by different transports.

type RotationData

type RotationData struct {
	X, Y, Z int16
}

RotationData the rotation around X/Y/Z axises.

type SelfTestResult

type SelfTestResult struct {
	AccelDeviation Deviation
	GyroDeviation  Deviation
}

SelfTestResult defines the results for self-test for accelerometer, gyroscope.

type SpiTransport

type SpiTransport struct {
	// contains filtered or unexported fields
}

SpiTransport Encapsulates the SPI transport parameters.

func NewSpiTransport

func NewSpiTransport(path string, cs gpio.PinOut) (*SpiTransport, error)

NewSpiTransport Creates the SPI transport using the provided device path and chip select pin reference.

func (*SpiTransport) EnableDebug

func (s *SpiTransport) EnableDebug(f DebugF)

EnableDebug Sets the debugging output using the local print function.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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