upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for MPU9150 chip (Accelerometer, Gyro and Magnometer Sensor) More...
This module defines the MPU9150 interface for libmpu9150
Public Member Functions | |
synchronized void | delete () |
MPU9150 (int bus, int address, int magAddress, boolean enableAk8975) | |
MPU9150 (int bus, int address, int magAddress) | |
MPU9150 (int bus, int address) | |
MPU9150 (int bus) | |
boolean | init () |
void | update () |
float[] | getMagnetometer () |
![]() | |
synchronized void | delete () |
MPU60X0 (int bus, short address) | |
MPU60X0 (int bus) | |
boolean | init () |
void | update () |
short | readReg (short reg) |
void | readRegs (short reg, byte[] buffer) |
boolean | writeReg (short reg, short val) |
boolean | setSleep (boolean enable) |
boolean | setClockSource (MPU60X0.CLKSEL_T clk) |
boolean | setGyroscopeScale (MPU60X0.FS_SEL_T scale) |
boolean | setAccelerometerScale (MPU60X0.AFS_SEL_T scale) |
boolean | setDigitalLowPassFilter (MPU60X0.DLPF_CFG_T dlp) |
boolean | setSampleRateDivider (short div) |
short | getSampleRateDivider () |
float[] | getAccelerometer () |
float[] | getGyroscope () |
float | getTemperature () |
boolean | enableTemperatureSensor (boolean enable) |
boolean | setExternalSync (MPU60X0.EXT_SYNC_SET_T val) |
boolean | enableI2CBypass (boolean enable) |
boolean | setMotionDetectionThreshold (short thr) |
short | getInterruptStatus () |
boolean | setInterruptEnables (short enables) |
short | getInterruptEnables () |
boolean | setInterruptPinConfig (short cfg) |
short | getInterruptPinConfig () |
void | installISR (int gpio, int level, IsrCallback cb) |
void | uninstallISR () |
MPU9150 | ( | int | bus, |
int | address, | ||
int | magAddress, | ||
boolean | enableAk8975 | ||
) |
MPU9150 constructor
bus | I2C bus to use |
address | The address for this device |
magAddress | The address of the connected magnetometer |
enableAk8975 | Enables i2c bypass mode for magnetometer, default is true |
float [] getMagnetometer | ( | ) |
Return the compensated values for the x, y, and z axes. The unit of measurement is in micro-teslas (uT).
boolean init | ( | ) |
Set up initial values and start operation
void update | ( | ) |
Take a measurement and store the current sensor values internally. Note, these user facing registers are only updated from the internal device sensor values when the i2c serial traffic is 'idle'. So, if you are reading the values too fast, the bus may never be idle, and you will just end up reading the same values over and over.
Unfortunately, it is is not clear how long 'idle' actually means, so if you see this behavior, reduce the rate at which you are calling update().