|
upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for the LSM9DS0 3-axis Gyroscope, Accelerometer, and Magnetometer. More...
The LSM9DS0 is a system-in-package featuring a 3D digital linear acceleration sensor, a 3D digital angular rate sensor, and a 3D digital magnetic sensor.
The LSM9DS0 has a linear acceleration full scale of 2g/4g/6g/8g/16g, a magnetic field full scale of 2/4/8/12 gauss and an angular rate of 245/500/2000 dps.
While not all of the functionality of this device is supported initially, methods and register definitions are provided that should allow an end user to implement whatever features are required.
This driver was developed on a Sparkfun 9DOF edison block.
Public Member Functions | |
| synchronized void | delete () |
| LSM9DS0 (int bus, short gAddress, short xmAddress) | |
| LSM9DS0 (int bus, short gAddress) | |
| LSM9DS0 (int bus) | |
| boolean | init () |
| void | update () |
| void | updateGyroscope () |
| void | updateAccelerometer () |
| void | updateMagnetometer () |
| void | updateTemperature () |
| short | readReg (LSM9DS0.DEVICE_T dev, short reg) |
| void | readRegs (LSM9DS0.DEVICE_T dev, short reg, byte[] buffer) |
| boolean | writeReg (LSM9DS0.DEVICE_T dev, short reg, short val) |
| boolean | setGyroscopePowerDown (boolean enable) |
| boolean | setGyroscopeEnableAxes (short axes) |
| boolean | setGyroscopeODR (LSM9DS0.G_ODR_T odr) |
| boolean | setGyroscopeScale (LSM9DS0.G_FS_T scale) |
| boolean | setAccelerometerEnableAxes (short axes) |
| boolean | setAccelerometerODR (LSM9DS0.XM_AODR_T odr) |
| boolean | setAccelerometerScale (LSM9DS0.XM_AFS_T scale) |
| boolean | setMagnetometerResolution (LSM9DS0.XM_RES_T res) |
| boolean | setMagnetometerODR (LSM9DS0.XM_ODR_T odr) |
| boolean | setMagnetometerMode (LSM9DS0.XM_MD_T mode) |
| boolean | setMagnetometerLPM (boolean enable) |
| boolean | setMagnetometerScale (LSM9DS0.XM_MFS_T scale) |
| float[] | getAccelerometer () |
| float[] | getGyroscope () |
| float[] | getMagnetometer () |
| float | getTemperature () |
| boolean | enableTemperatureSensor (boolean enable) |
| short | getGyroscopeStatus () |
| short | getMagnetometerStatus () |
| short | getAccelerometerStatus () |
| short | getGyroscopeInterruptConfig () |
| boolean | setGyroscopeInterruptConfig (short enables) |
| short | getGyroscopeInterruptSrc () |
| short | getMagnetometerInterruptControl () |
| boolean | setMagnetometerInterruptControl (short enables) |
| short | getMagnetometerInterruptSrc () |
| short | getInterruptGen1 () |
| boolean | setInterruptGen1 (short enables) |
| short | getInterruptGen1Src () |
| short | getInterruptGen2 () |
| boolean | setInterruptGen2 (short enables) |
| short | getInterruptGen2Src () |
| void | installISR (LSM9DS0.INTERRUPT_PINS_T intr, int gpio, int level, IsrCallback cb) |
| void | uninstallISR (LSM9DS0.INTERRUPT_PINS_T intr) |
| LSM9DS0 | ( | int | bus, |
| short | gAddress, | ||
| short | xmAddress | ||
| ) |
lsm9ds0 constructor
| bus | i2c bus to use |
| address | the address for this device |
| boolean enableTemperatureSensor | ( | boolean | enable | ) |
enable onboard temperature measurement sensor
| enable | true to enable temperature sensor, false to disable |
| float [] getAccelerometer | ( | ) |
get the accelerometer values in gravities
| short getAccelerometerStatus | ( | ) |
return the accelerometer status register
| float [] getGyroscope | ( | ) |
get the gyroscope values in degrees per second
| short getGyroscopeInterruptConfig | ( | ) |
return the gyroscope interrupt config register
| short getGyroscopeInterruptSrc | ( | ) |
return the gyroscope interrupt src register
| short getGyroscopeStatus | ( | ) |
return the gyroscope status register
| short getInterruptGen1 | ( | ) |
return the inertial interrupt generator 1 register
| short getInterruptGen1Src | ( | ) |
return the inertial interrupt generator 1 src register
| short getInterruptGen2 | ( | ) |
return the inertial interrupt generator 2 register
| short getInterruptGen2Src | ( | ) |
return the inertial interrupt generator 2 src register
| float [] getMagnetometer | ( | ) |
get the magnetometer values in gauss
| short getMagnetometerInterruptControl | ( | ) |
return the magnetometer interrupt control register
| short getMagnetometerInterruptSrc | ( | ) |
return the magnetometer interrupt src register
| short getMagnetometerStatus | ( | ) |
return the magnetometer status register
| float getTemperature | ( | ) |
get the temperature value. Unfortunately the datasheet does not provide a mechanism to convert the temperature value into the correct value, so I made a 'guess'. If it's wrong, and you figure it out, send a patch!
| boolean init | ( | ) |
set up initial values and start operation
| short readReg | ( | LSM9DS0.DEVICE_T | dev, |
| short | reg | ||
| ) |
read a register
| dev | the device to access (XM or G) |
| reg | the register to read |
| boolean setAccelerometerEnableAxes | ( | short | axes | ) |
enable or disable accelerometer axes.
| axes | bit mask of valid axes, (CTRL_REG1_XM_AXEN, ...) |
| boolean setAccelerometerODR | ( | LSM9DS0.XM_AODR_T | odr | ) |
set the accelerometer Output Data Rate (ODR)
| odr | one of the XM_AODR_T values |
| boolean setAccelerometerScale | ( | LSM9DS0.XM_AFS_T | scale | ) |
set the scaling mode of the accelerometer
| scale | one of the XM_AFS_T values |
| boolean setGyroscopeEnableAxes | ( | short | axes | ) |
enable or disable gyroscope axes. If all axis are disabled, and powerdown mode is not set, then the gyro goes into sleep mode.
| axes | bit mask of valid axes, (CTRL_REG1_G_YEN, ...) |
| boolean setGyroscopeInterruptConfig | ( | short | enables | ) |
set the gyroscope interrupt config register
| enables | bitmask of INT1_CFG_G_BITS_T values |
| boolean setGyroscopeODR | ( | LSM9DS0.G_ODR_T | odr | ) |
set the gyroscope Output Data Rate (ODR)
| odr | one of the G_ODR_T values |
| boolean setGyroscopePowerDown | ( | boolean | enable | ) |
enable or disable the gyro power down mode
| enable | true to put device to sleep, false to wake up |
| boolean setGyroscopeScale | ( | LSM9DS0.G_FS_T | scale | ) |
set the scaling mode of the gyroscope
| scale | one of the G_FS_T values |
| boolean setInterruptGen1 | ( | short | enables | ) |
set the inertial interrupt generator 1 register
| enables | bitmask of INT_GEN_X_REG_BITS_T values |
| boolean setInterruptGen2 | ( | short | enables | ) |
set the inertial interrupt generator 2 register
| enables | bitmask of INT_GEN_X_REG_BITS_T values |
| boolean setMagnetometerInterruptControl | ( | short | enables | ) |
set the magnetometer interrupt control register
| enables | bitmask of INT_CTRL_REG_M_BITS_T values |
| boolean setMagnetometerLPM | ( | boolean | enable | ) |
enable or disable magnetometer low power mode (LPM). When in low power mode, the magnetometer updates at 3.125Hz, regardless of it's ODR setting.
| enable | true to enable LPM, false otherwise |
| boolean setMagnetometerMode | ( | LSM9DS0.XM_MD_T | mode | ) |
set the magnetometer sensor mode
| mode | one of the XM_MD_T values |
| boolean setMagnetometerODR | ( | LSM9DS0.XM_ODR_T | odr | ) |
set the magnetometer Output Data Rate (ODR)
| odr | one of the XM_ODR_T values |
| boolean setMagnetometerResolution | ( | LSM9DS0.XM_RES_T | res | ) |
set the magnetometer resolution
| res | one of the XM_RES_T values |
| boolean setMagnetometerScale | ( | LSM9DS0.XM_MFS_T | scale | ) |
set the scaling mode of the magnetometer
| scale | one of the XM_MFS_T values |
| void uninstallISR | ( | LSM9DS0.INTERRUPT_PINS_T | intr | ) |
uninstall a previously installed interrupt handler
| intr | one of the INTERRUPT_PINS_T values specifying which interrupt pin out of 4 you are uninstalling |
| void update | ( | ) |
update the accelerometer, gyroscope, magnetometer and termperature values.
| void updateAccelerometer | ( | ) |
update the accelerometer values only
| void updateGyroscope | ( | ) |
update the gyroscope values only
| void updateMagnetometer | ( | ) |
update the magnetometer values only
| void updateTemperature | ( | ) |
update the temperature value only
| boolean writeReg | ( | LSM9DS0.DEVICE_T | dev, |
| short | reg, | ||
| short | val | ||
| ) |
write to a register
| dev | the device to access (XM or G) |
| reg | the register to write to |
| val | the value to write |
1.8.9.1