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 ¶
- type AccelerometerData
- type DebugF
- type Deviation
- type GyroscopeData
- type MPU9250
- func (m *MPU9250) AccelerometerXIsEnabled() (bool, error)
- func (m *MPU9250) AccelerometerYIsEnabled() (bool, error)
- func (m *MPU9250) AccelerometerZIsEnabled() (bool, error)
- func (m *MPU9250) Calibrate() error
- func (m *MPU9250) Debug(f DebugF)
- func (m *MPU9250) DisableAccelerometerAxis(axis byte) error
- func (m *MPU9250) DisableGyro() error
- func (m *MPU9250) DisableTemperature() error
- func (m *MPU9250) EnableAccelerometer() error
- func (m *MPU9250) EnableAccelerometerAxis(axis byte) error
- func (m *MPU9250) EnableGyro() error
- func (m *MPU9250) EnableTemperature() error
- func (m *MPU9250) GetAccelFIFOEnabled() (bool, error)
- func (m *MPU9250) GetAccelRange() (byte, error)
- func (m *MPU9250) GetAcceleration() (*AccelerometerData, error)
- func (m *MPU9250) GetAccelerationX() (int16, error)
- func (m *MPU9250) GetAccelerationY() (int16, error)
- func (m *MPU9250) GetAccelerationZ() (int16, error)
- func (m *MPU9250) GetAccelerometerTestData() (*AccelerometerData, error)
- func (m *MPU9250) GetClockSource() (byte, error)
- func (m *MPU9250) GetDeviceID() (byte, error)
- func (m *MPU9250) GetFIFOByte() (byte, error)
- func (m *MPU9250) GetFIFOCount() (uint16, error)
- func (m *MPU9250) GetFIFOEnabled() (bool, error)
- func (m *MPU9250) GetFSyncInterruptEnabled() (bool, error)
- func (m *MPU9250) GetFSyncInterruptLevel() (bool, error)
- func (m *MPU9250) GetGyroRange() (byte, error)
- func (m *MPU9250) GetGyroTestData() (*GyroscopeData, error)
- func (m *MPU9250) GetI2CBypassEnabled() (bool, error)
- func (m *MPU9250) GetI2CMasterModeEnabled() (bool, error)
- func (m *MPU9250) GetIntEnabled() (byte, error)
- func (m *MPU9250) GetIntFIFOBufferOverflowEnabled() (bool, error)
- func (m *MPU9250) GetIntI2CMasterEnabled() (bool, error)
- func (m *MPU9250) GetIntStatus() (byte, error)
- func (m *MPU9250) GetInterruptDrive() (bool, error)
- func (m *MPU9250) GetInterruptLatch() (bool, error)
- func (m *MPU9250) GetInterruptLatchClear() (bool, error)
- func (m *MPU9250) GetInterruptMode() (bool, error)
- func (m *MPU9250) GetLostArbitration() (bool, error)
- func (m *MPU9250) GetMasterClockSpeed() (byte, error)
- func (m *MPU9250) GetMotion6() (*AccelerometerData, *RotationData, error)
- func (m *MPU9250) GetMultiMasterEnabled() (bool, error)
- func (m *MPU9250) GetPassthroughStatus() (bool, error)
- func (m *MPU9250) GetRotation() (*RotationData, error)
- func (m *MPU9250) GetRotationX() (int16, error)
- func (m *MPU9250) GetRotationY() (int16, error)
- func (m *MPU9250) GetRotationZ() (int16, error)
- func (m *MPU9250) GetSlave0FIFOEnabled() (bool, error)
- func (m *MPU9250) GetSlave0Nack() (bool, error)
- func (m *MPU9250) GetSlave1FIFOEnabled() (bool, error)
- func (m *MPU9250) GetSlave1Nack() (bool, error)
- func (m *MPU9250) GetSlave2FIFOEnabled() (bool, error)
- func (m *MPU9250) GetSlave2Nack() (bool, error)
- func (m *MPU9250) GetSlave3FIFOEnabled() (bool, error)
- func (m *MPU9250) GetSlave3Nack() (bool, error)
- func (m *MPU9250) GetSlave4Address() (byte, error)
- func (m *MPU9250) GetSlave4Enabled() (bool, error)
- func (m *MPU9250) GetSlave4InputByte() (byte, error)
- func (m *MPU9250) GetSlave4InterruptEnabled() (bool, error)
- func (m *MPU9250) GetSlave4IsDone() (bool, error)
- func (m *MPU9250) GetSlave4MasterDelay() (byte, error)
- func (m *MPU9250) GetSlave4Nack() (bool, error)
- func (m *MPU9250) GetSlave4Register() (byte, error)
- func (m *MPU9250) GetSlave4WriteMode() (bool, error)
- func (m *MPU9250) GetSlaveAddress(num byte) (byte, error)
- func (m *MPU9250) GetSlaveDataLength(num byte) (byte, error)
- func (m *MPU9250) GetSlaveEnabled(num byte) (bool, error)
- func (m *MPU9250) GetSlaveReadWriteTransitionEnabled() (bool, error)
- func (m *MPU9250) GetSlaveRegister(num byte) (byte, error)
- func (m *MPU9250) GetSlaveWordByteSwap(num byte) (bool, error)
- func (m *MPU9250) GetSlaveWordGroupOffset(num byte) (bool, error)
- func (m *MPU9250) GetSlaveWriteMode(num byte) (bool, error)
- func (m *MPU9250) GetSleepEnabled() (bool, error)
- func (m *MPU9250) GetTempFIFOEnabled() (bool, error)
- func (m *MPU9250) GetTemperature() (uint16, error)
- func (m *MPU9250) GetWaitForExternalSensorEnabled() (bool, error)
- func (m *MPU9250) GetWakeCycleEnabled() (bool, error)
- func (m *MPU9250) GetXGyroFIFOEnabled() (bool, error)
- func (m *MPU9250) GetXGyroOffset() (uint16, error)
- func (m *MPU9250) GetYGyroFIFOEnabled() (bool, error)
- func (m *MPU9250) GetYGyroOffset() (uint16, error)
- func (m *MPU9250) GetZGyroFIFOEnabled() (bool, error)
- func (m *MPU9250) GetZGyroOffset() (uint16, error)
- func (m *MPU9250) GyroXIsEnabled() (bool, error)
- func (m *MPU9250) GyroYIsEnabled() (bool, error)
- func (m *MPU9250) GyroZIsEnabled() (bool, error)
- func (m *MPU9250) Init() error
- func (m *MPU9250) ReadSignedWord(hi, lo byte) (int16, error)
- func (m *MPU9250) ReadWord(hi, lo byte) (uint16, error)
- func (m *MPU9250) Reset() error
- func (m *MPU9250) ResetAccelerometerPath() error
- func (m *MPU9250) ResetFIFO() error
- func (m *MPU9250) ResetGyroscopePath() error
- func (m *MPU9250) ResetI2CMaster() error
- func (m *MPU9250) ResetSensors() error
- func (m *MPU9250) ResetTemperaturePath() error
- func (m *MPU9250) SelfTest() (*SelfTestResult, error)
- func (m *MPU9250) SetAccelFIFOEnabled(enabled bool) error
- func (m *MPU9250) SetAccelRange(rangeVal byte) error
- func (m *MPU9250) SetAccelerationOffsetX(offset uint16) error
- func (m *MPU9250) SetAccelerationOffsetY(offset uint16) error
- func (m *MPU9250) SetAccelerationOffsetZ(offset uint16) error
- func (m *MPU9250) SetClockSource(src byte) error
- func (m *MPU9250) SetFIFOByte(data byte) error
- func (m *MPU9250) SetFIFOEnabled(enabled bool) error
- func (m *MPU9250) SetFSyncInterruptEnabled(enabled bool) error
- func (m *MPU9250) SetFSyncInterruptLevel(level bool) error
- func (m *MPU9250) SetGyroRange(rangeVal byte) error
- func (m *MPU9250) SetI2CBypassEnabled(enabled bool) error
- func (m *MPU9250) SetI2CMasterModeEnabled(enabled bool) error
- func (m *MPU9250) SetIntEnabled(enabled byte) error
- func (m *MPU9250) SetIntFIFOBufferOverflowEnabled(enabled bool) error
- func (m *MPU9250) SetIntI2CMasterEnabled(enabled bool) error
- func (m *MPU9250) SetInterruptDrive(drive bool) error
- func (m *MPU9250) SetInterruptLatch(latch bool) error
- func (m *MPU9250) SetInterruptLatchClear(clear bool) error
- func (m *MPU9250) SetInterruptMode(mode bool) error
- func (m *MPU9250) SetMasterClockSpeed(speed byte) error
- func (m *MPU9250) SetMultiMasterEnabled(enabled bool) error
- func (m *MPU9250) SetSlave0FIFOEnabled(enabled bool) error
- func (m *MPU9250) SetSlave1FIFOEnabled(enabled bool) error
- func (m *MPU9250) SetSlave2FIFOEnabled(enabled bool) error
- func (m *MPU9250) SetSlave3FIFOEnabled(enabled bool) error
- func (m *MPU9250) SetSlave4Address(address byte) error
- func (m *MPU9250) SetSlave4Enabled(enabled bool) error
- func (m *MPU9250) SetSlave4InterruptEnabled(enabled bool) error
- func (m *MPU9250) SetSlave4MasterDelay(delay byte) error
- func (m *MPU9250) SetSlave4OutputByte(data byte) error
- func (m *MPU9250) SetSlave4Register(r byte) error
- func (m *MPU9250) SetSlave4WriteMode(mode bool) error
- func (m *MPU9250) SetSlaveAddress(num, address byte) error
- func (m *MPU9250) SetSlaveDataLength(num byte, length byte) error
- func (m *MPU9250) SetSlaveEnabled(num byte, enabled bool) error
- func (m *MPU9250) SetSlaveReadWriteTransitionEnabled(enabled bool) error
- func (m *MPU9250) SetSlaveRegister(num, r byte) error
- func (m *MPU9250) SetSlaveWordByteSwap(num byte, enabled bool) error
- func (m *MPU9250) SetSlaveWordGroupOffset(num byte, enabled bool) error
- func (m *MPU9250) SetSlaveWriteMode(num byte, mode bool) error
- func (m *MPU9250) SetSleepEnabled(enabled bool) error
- func (m *MPU9250) SetTempFIFOEnabled(enabled bool) error
- func (m *MPU9250) SetWaitForExternalSensorEnabled(enabled bool) error
- func (m *MPU9250) SetWakeCycleEnabled(enabled bool) error
- func (m *MPU9250) SetXGyroFIFOEnabled(enabled bool) error
- func (m *MPU9250) SetXGyroOffset(offset uint16) error
- func (m *MPU9250) SetYGyroFIFOEnabled(enabled bool) error
- func (m *MPU9250) SetYGyroOffset(offset uint16) error
- func (m *MPU9250) SetZGyroFIFOEnabled(enabled bool) error
- func (m *MPU9250) SetZGyroOffset(offset uint16) error
- func (m *MPU9250) SwitchSPIEnabled(enabled bool) error
- func (m *MPU9250) TemperatureIsEnabled() (bool, error)
- func (m *MPU9250) WriteByteAddress(address, value byte) error
- type Proto
- type RotationData
- type SelfTestResult
- type SpiTransport
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 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 (*MPU9250) AccelerometerXIsEnabled ¶
AccelerometerXIsEnabled Get the X accelerometer status.
func (*MPU9250) AccelerometerYIsEnabled ¶
AccelerometerYIsEnabled Get the X accelerometer status.
func (*MPU9250) AccelerometerZIsEnabled ¶
AccelerometerZIsEnabled Get the Z accelerometer status.
func (*MPU9250) Calibrate ¶
Calibrate Calibrates the device using maximum precision for both Gyroscope and Accelerometer.
func (*MPU9250) DisableAccelerometerAxis ¶
DisableAccelerometerAxis Accelerometer functions
axis MPU9250_DISABLE_XA_MASK, MPU9250_DISABLE_YA_MASK, MPU9250_DISABLE_ZA_MASK
func (*MPU9250) DisableGyro ¶
DisableGyro Disables the gyroscope.
func (*MPU9250) DisableTemperature ¶
DisableTemperature Disables the internal temperature sensor.
func (*MPU9250) EnableAccelerometer ¶
EnableAccelerometer enables the accelerometer.
func (*MPU9250) EnableAccelerometerAxis ¶
EnableAccelerometerAxis Accelerometer functions
axis MPU9250_DISABLE_XA_MASK, MPU9250_DISABLE_YA_MASK, MPU9250_DISABLE_ZA_MASK
func (*MPU9250) EnableTemperature ¶
EnableTemperature Enable internal temperature sensor.
func (*MPU9250) GetAccelFIFOEnabled ¶
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 ¶
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 ¶
GetAccelerationX Get X-axis accelerometer reading.
func (*MPU9250) GetAccelerationY ¶
GetAccelerationY Get Y-axis accelerometer reading.
func (*MPU9250) GetAccelerationZ ¶
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 ¶
GetClockSource Get clock source setting.
func (*MPU9250) GetDeviceID ¶
GetDeviceID Returns the devide ID
func (*MPU9250) GetFIFOByte ¶
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 ¶
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 ¶
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 ¶
GetFSyncInterruptEnabled Get FSYNC pin interrupt enabled setting.
Will be set 0 for disabled, 1 for enabled.
func (*MPU9250) GetFSyncInterruptLevel ¶
GetFSyncInterruptLevel Get FSYNC interrupt logic level mode.
func (*MPU9250) GetGyroRange ¶
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 ¶
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 ¶
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 ¶
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 ¶
GetIntFIFOBufferOverflowEnabled Get FIFO Buffer Overflow interrupt enabled status.
Will be set 0 for disabled, 1 for enabled.
func (*MPU9250) GetIntI2CMasterEnabled ¶
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 ¶
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 ¶
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 ¶
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 ¶
GetInterruptLatchClear Get interrupt latch clear mode.
Will be set 0 for status-read-only, 1 for any-register-read.
func (*MPU9250) GetInterruptMode ¶
GetInterruptMode Get interrupt logic level mode (false=active-high, true=active-low)
func (*MPU9250) GetLostArbitration ¶
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 ¶
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 ¶
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 ¶
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 ¶
GetRotationX Get X-axis gyroscope reading.
func (*MPU9250) GetRotationY ¶
GetRotationY Get Y-axis gyroscope reading.
func (*MPU9250) GetRotationZ ¶
GetRotationZ Get Z-axis gyroscope reading.
func (*MPU9250) GetSlave0FIFOEnabled ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
GetTemperature Get the current temperature. ((Temp_out - room_temp_offset)/temp_sensitivity) + 21; //celcius
func (*MPU9250) GetWaitForExternalSensorEnabled ¶
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 ¶
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 ¶
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 ¶
GetXGyroOffset Returns the offset of X gyroscope.
func (*MPU9250) GetYGyroFIFOEnabled ¶
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 ¶
GetYGyroOffset Returns the offset of y gyroscope.
func (*MPU9250) GetZGyroFIFOEnabled ¶
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 ¶
GetZGyroOffset Returns the offset of Z gyroscope.
func (*MPU9250) GyroXIsEnabled ¶
GyroXIsEnabled Get the X axis enabled flag.
func (*MPU9250) GyroYIsEnabled ¶
GyroYIsEnabled Get the Y axis enabled flag.
func (*MPU9250) GyroZIsEnabled ¶
GyroZIsEnabled Get the Z axis enabled flag.
func (*MPU9250) ReadSignedWord ¶
ReadSignedWord Reads signed word from the provided high/low registers addresses.
func (*MPU9250) ReadWord ¶
ReadWord Reads unsigned int from the provided addresses.
hi high 8 bit address lo low 8 bit address
func (*MPU9250) Reset ¶
Reset Trigger a full device reset.
A small delay of ~50ms may be desirable after triggering a reset.
func (*MPU9250) ResetAccelerometerPath ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
SetAccelFIFOEnabled Set accelerometer FIFO enabled value.
enabled New accelerometer FIFO enabled value
func (*MPU9250) SetAccelRange ¶
SetAccelRange Set full-scale accelerometer range.
The masked value is 11000 ¶
range New full-scale accelerometer range setting
func (*MPU9250) SetAccelerationOffsetX ¶
SetAccelerationOffsetX Set the acceleration trim offset for X axis.
func (*MPU9250) SetAccelerationOffsetY ¶
SetAccelerationOffsetY Set the acceleration trim offset for Y axis.
func (*MPU9250) SetAccelerationOffsetZ ¶
SetAccelerationOffsetZ Set the acceleration trim offset for Z axis.
func (*MPU9250) SetClockSource ¶
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 ¶
SetFIFOByte Write byte to FIFO buffer.
func (*MPU9250) SetFIFOEnabled ¶
SetFIFOEnabled Set FIFO enabled status.
enabled New FIFO enabled status
func (*MPU9250) SetFSyncInterruptEnabled ¶
SetFSyncInterruptEnabled Set FSYNC pin interrupt enabled setting.
enabled New FSYNC pin interrupt enabled setting
func (*MPU9250) SetFSyncInterruptLevel ¶
SetFSyncInterruptLevel Set FSYNC interrupt logic level mode.
mode New FSYNC interrupt mode (0=active-high, 1=active-low)
func (*MPU9250) SetGyroRange ¶
SetGyroRange Set gyroscope range.
range New gyroscope range value the mask is 11000
func (*MPU9250) SetI2CBypassEnabled ¶
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 ¶
SetI2CMasterModeEnabled Set I2C Master Mode enabled status.
enabled New I2C Master Mode enabled status
func (*MPU9250) SetIntEnabled ¶
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 ¶
SetIntFIFOBufferOverflowEnabled Set FIFO Buffer Overflow interrupt enabled status.
enabled New interrupt enabled status
func (*MPU9250) SetIntI2CMasterEnabled ¶
SetIntI2CMasterEnabled Set I2C Master interrupt enabled status.
enabled New interrupt enabled status
func (*MPU9250) SetInterruptDrive ¶
SetInterruptDrive Set interrupt drive mode.
drive New interrupt drive mode (0=push-pull, 1=open-drain)
func (*MPU9250) SetInterruptLatch ¶
SetInterruptLatch Set interrupt latch mode.
latch New latch mode (0=50us-pulse, 1=latch-until-int-cleared)
func (*MPU9250) SetInterruptLatchClear ¶
SetInterruptLatchClear Set interrupt latch clear mode.
clear New latch clear mode (0=status-read-only, 1=any-register-read)
func (*MPU9250) SetInterruptMode ¶
SetInterruptMode Set interrupt logic level mode.
mode New interrupt mode (false=active-high, true=active-low)
func (*MPU9250) SetMasterClockSpeed ¶
SetMasterClockSpeed Set I2C master clock speed.
speed Current I2C master clock speed
func (*MPU9250) SetMultiMasterEnabled ¶
SetMultiMasterEnabled Set multi-master enabled value.
enabled New multi-master enabled value
func (*MPU9250) SetSlave0FIFOEnabled ¶
SetSlave0FIFOEnabled Set Slave 0 FIFO enabled value.
enabled New Slave 0 FIFO enabled value
func (*MPU9250) SetSlave1FIFOEnabled ¶
SetSlave1FIFOEnabled Set Slave 1 FIFO enabled value.
enabled New Slave 1 FIFO enabled value
func (*MPU9250) SetSlave2FIFOEnabled ¶
SetSlave2FIFOEnabled Set Slave 2 FIFO enabled value.
enabled New Slave 2 FIFO enabled value
func (*MPU9250) SetSlave3FIFOEnabled ¶
SetSlave3FIFOEnabled Set Slave 3 FIFO enabled value.
enabled New Slave 3 FIFO enabled value
func (*MPU9250) SetSlave4Address ¶
SetSlave4Address Set the I2C address of Slave 4.
address New address for Slave 4
func (*MPU9250) SetSlave4Enabled ¶
SetSlave4Enabled Set the enabled value for Slave 4.
enabled New enabled value for Slave 4
func (*MPU9250) SetSlave4InterruptEnabled ¶
SetSlave4InterruptEnabled Set the enabled value for Slave 4 transaction interrupts.
enabled New enabled value for Slave 4 transaction interrupts.
func (*MPU9250) SetSlave4MasterDelay ¶
SetSlave4MasterDelay Set Slave 4 master delay value.
delay New Slave 4 master delay value
func (*MPU9250) SetSlave4OutputByte ¶
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 ¶
SetSlave4Register Set the active internal register for Slave 4.
reg New active register for Slave 4
func (*MPU9250) SetSlave4WriteMode ¶
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 ¶
SetSlaveAddress Set the I2C address of the specified slave (0-3).
num Slave number (0-3)
func (*MPU9250) SetSlaveDataLength ¶
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 ¶
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 ¶
SetSlaveReadWriteTransitionEnabled Set slave read/write transition enabled value.
enabled New slave read/write transition enabled value
func (*MPU9250) SetSlaveRegister ¶
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 ¶
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 ¶
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 ¶
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 ¶
SetSleepEnabled Set sleep mode status.
enabled New sleep mode enabled status
func (*MPU9250) SetTempFIFOEnabled ¶
SetTempFIFOEnabled Set temperature FIFO enabled value.
enabled New temperature FIFO enabled value
func (*MPU9250) SetWaitForExternalSensorEnabled ¶
SetWaitForExternalSensorEnabled Set wait-for-external-sensor-data enabled value.
enabled New wait-for-external-sensor-data enabled value
func (*MPU9250) SetWakeCycleEnabled ¶
SetWakeCycleEnabled Set wake cycle enabled status.
enabled New sleep mode enabled status
func (*MPU9250) SetXGyroFIFOEnabled ¶
SetXGyroFIFOEnabled Set gyroscope X-axis FIFO enabled value.
enabled New gyroscope X-axis FIFO enabled value
func (*MPU9250) SetYGyroFIFOEnabled ¶
SetYGyroFIFOEnabled Set gyroscope Y-axis FIFO enabled value.
enabled New gyroscope Y-axis FIFO enabled value
func (*MPU9250) SetZGyroFIFOEnabled ¶
SetZGyroFIFOEnabled Set gyroscope Z-axis FIFO enabled value.
enabled New gyroscope Z-axis FIFO enabled value
func (*MPU9250) SwitchSPIEnabled ¶
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 ¶
TemperatureIsEnabled Is the temperature sensor enabled.
func (*MPU9250) WriteByteAddress ¶
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 ¶
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.