pyupm_lsm9ds0 module

class pyupm_lsm9ds0.LSM9DS0(bus=1, raw=False, gAddress=107, xmAddress=29)[source]

Bases: object

API for the LSM9DS0 3-axis Gyroscope, Accelerometer, and Magnetometer.

ID: lsm9ds0

Name: Triaxial Gyroscope/accelerometer/magnetometer Sensor

Category: accelerometer compass

Manufacturer: sparkfun stmicro

Connection: i2c gpio

Link:https://www.sparkfun.com/products/13033 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.

LSM9DS0 Sensor image provided by SparkFun* underCC BY-NC-SA-3.0.

C++ includes: lsm9ds0.hpp

ACT_THS_ACTH0 = 1
ACT_THS_ACTH1 = 2
ACT_THS_ACTH2 = 4
ACT_THS_ACTH3 = 8
ACT_THS_ACTH4 = 16
ACT_THS_ACTH5 = 32
ACT_THS_ACTH6 = 64
CLICK_CONFIG_XD = 2
CLICK_CONFIG_XS = 1
CLICK_CONFIG_YD = 8
CLICK_CONFIG_YS = 4
CLICK_CONFIG_ZD = 32
CLICK_CONFIG_ZS = 16
CLICK_SRC_DCLICK = 32
CLICK_SRC_IA = 64
CLICK_SRC_SCLICK = 16
CLICK_SRC_SIGN = 8
CLICK_SRC_X = 1
CLICK_SRC_Y = 2
CLICK_SRC_Z = 4
CLICK_THS_THS0 = 1
CLICK_THS_THS1 = 2
CLICK_THS_THS2 = 4
CLICK_THS_THS3 = 8
CLICK_THS_THS4 = 16
CLICK_THS_THS5 = 32
CLICK_THS_THS6 = 64
CLICK_TIME_LIMIT_TLI0 = 1
CLICK_TIME_LIMIT_TLI1 = 2
CLICK_TIME_LIMIT_TLI2 = 4
CLICK_TIME_LIMIT_TLI3 = 8
CLICK_TIME_LIMIT_TLI4 = 16
CLICK_TIME_LIMIT_TLI5 = 32
CLICK_TIME_LIMIT_TLI6 = 64
CTRL_REG0_XM_BOOT = 128
CTRL_REG0_XM_FIFO_EN = 64
CTRL_REG0_XM_HPIS1 = 2
CTRL_REG0_XM_HPIS2 = 1
CTRL_REG0_XM_HP_CLICK = 4
CTRL_REG0_XM_WTM_LEN = 32
CTRL_REG1_G_BW0 = 16
CTRL_REG1_G_BW1 = 32
CTRL_REG1_G_DR0 = 64
CTRL_REG1_G_DR1 = 128
CTRL_REG1_G_ODR0 = 16
CTRL_REG1_G_ODR1 = 32
CTRL_REG1_G_ODR2 = 64
CTRL_REG1_G_ODR3 = 128
CTRL_REG1_G_PD = 8
CTRL_REG1_G_XEN = 2
CTRL_REG1_G_YEN = 1
CTRL_REG1_G_ZEN = 4
CTRL_REG1_XM_AODR0 = 16
CTRL_REG1_XM_AODR1 = 32
CTRL_REG1_XM_AODR2 = 64
CTRL_REG1_XM_AODR3 = 128
CTRL_REG1_XM_AXEN = 1
CTRL_REG1_XM_AYEN = 2
CTRL_REG1_XM_AZEN = 3
CTRL_REG1_XM_BDU = 4
CTRL_REG2_G_HPCF0 = 1
CTRL_REG2_G_HPCF1 = 2
CTRL_REG2_G_HPCF2 = 4
CTRL_REG2_G_HPCF3 = 8
CTRL_REG2_G_HPM0 = 16
CTRL_REG2_G_HPM1 = 32
CTRL_REG2_XM_ABW0 = 64
CTRL_REG2_XM_ABW1 = 128
CTRL_REG2_XM_AFS0 = 8
CTRL_REG2_XM_AFS1 = 16
CTRL_REG2_XM_AFS2 = 32
CTRL_REG2_XM_AST0 = 2
CTRL_REG2_XM_AST1 = 4
CTRL_REG2_XM_SIM = 1
CTRL_REG3_G_H_LACTIVE = 32
CTRL_REG3_G_I1_BOOT = 64
CTRL_REG3_G_I1_INT1 = 128
CTRL_REG3_G_I2_DRDY = 8
CTRL_REG3_G_I2_EMPTY = 1
CTRL_REG3_G_I2_ORUN = 2
CTRL_REG3_G_I2_WTM = 4
CTRL_REG3_G_PP_OD = 16
CTRL_REG3_XM_P1_BOOT = 128
CTRL_REG3_XM_P1_DRDYA = 4
CTRL_REG3_XM_P1_DRDYM = 2
CTRL_REG3_XM_P1_EMPTY = 1
CTRL_REG3_XM_P1_INT1 = 32
CTRL_REG3_XM_P1_INT2 = 16
CTRL_REG3_XM_P1_INTM = 8
CTRL_REG3_XM_P1_TAP = 64
CTRL_REG4_G_BDU = 128
CTRL_REG4_G_BLE = 64
CTRL_REG4_G_FS0 = 16
CTRL_REG4_G_FS1 = 32
CTRL_REG4_G_SIM = 1
CTRL_REG4_G_ST0 = 2
CTRL_REG4_G_ST1 = 4
CTRL_REG4_XM_P2_DRDYA = 8
CTRL_REG4_XM_P2_DRDYM = 4
CTRL_REG4_XM_P2_INT1 = 64
CTRL_REG4_XM_P2_INT2 = 32
CTRL_REG4_XM_P2_INTM = 16
CTRL_REG4_XM_P2_OVERRUN = 2
CTRL_REG4_XM_P2_TAP = 128
CTRL_REG4_XM_P2_WTM = 1
CTRL_REG5_G_BOOT = 128
CTRL_REG5_G_FIFO_EN = 64
CTRL_REG5_G_HPEN = 16
CTRL_REG5_G_INT1SEL0 = 4
CTRL_REG5_G_INT1SEL1 = 8
CTRL_REG5_G_OUTSEL0 = 1
CTRL_REG5_G_OUTSEL1 = 2
CTRL_REG5_XM_LIR1 = 1
CTRL_REG5_XM_LIR2 = 2
CTRL_REG5_XM_ODR0 = 4
CTRL_REG5_XM_ODR1 = 8
CTRL_REG5_XM_ODR2 = 16
CTRL_REG5_XM_RES0 = 32
CTRL_REG5_XM_RES1 = 64
CTRL_REG5_XM_TEMP_EN = 128
CTRL_REG6_XM_MFS0 = 32
CTRL_REG6_XM_MFS1 = 64
CTRL_REG7_XM_AFDS = 32
CTRL_REG7_XM_AHPM0 = 64
CTRL_REG7_XM_AHPM1 = 128
CTRL_REG7_XM_MD0 = 1
CTRL_REG7_XM_MD1 = 2
CTRL_REG7_XM_MLP = 4
DEV_GYRO = 0
DEV_XM = 1
FIFO_CTRL_REG_EMPTY = 32
FIFO_CTRL_REG_FM0 = 32
FIFO_CTRL_REG_FM1 = 64
FIFO_CTRL_REG_FM2 = 128
FIFO_CTRL_REG_FSS0 = 1
FIFO_CTRL_REG_FSS1 = 2
FIFO_CTRL_REG_FSS2 = 4
FIFO_CTRL_REG_FSS3 = 8
FIFO_CTRL_REG_FSS4 = 16
FIFO_CTRL_REG_FTH0 = 1
FIFO_CTRL_REG_FTH1 = 2
FIFO_CTRL_REG_FTH2 = 4
FIFO_CTRL_REG_FTH3 = 8
FIFO_CTRL_REG_FTH4 = 16
FIFO_CTRL_REG_G_EMPTY = 32
FIFO_CTRL_REG_G_FM0 = 32
FIFO_CTRL_REG_G_FM1 = 64
FIFO_CTRL_REG_G_FM2 = 128
FIFO_CTRL_REG_G_FSS0 = 1
FIFO_CTRL_REG_G_FSS1 = 2
FIFO_CTRL_REG_G_FSS2 = 4
FIFO_CTRL_REG_G_FSS3 = 8
FIFO_CTRL_REG_G_FSS4 = 16
FIFO_CTRL_REG_G_OVRN = 64
FIFO_CTRL_REG_G_WTM = 128
FIFO_CTRL_REG_G_WTM0 = 1
FIFO_CTRL_REG_G_WTM1 = 2
FIFO_CTRL_REG_G_WTM2 = 4
FIFO_CTRL_REG_G_WTM3 = 8
FIFO_CTRL_REG_G_WTM4 = 16
FIFO_CTRL_REG_OVRN = 64
FIFO_CTRL_REG_WTM = 128
FM_BYPASS = 0
FM_BYPASS2STREAM = 4
FM_FIFO = 1
FM_STREAM = 2
FM_STREAM2FIFO = 3
G_FM_BYPASS = 0
G_FM_BYPASS2STREAM = 4
G_FM_FIFO = 1
G_FM_STREAM = 2
G_FM_STREAM2FIFO = 3
G_FS_2000 = 2
G_FS_245 = 0
G_FS_500 = 1
G_HPCF_0_009 = 9
G_HPCF_0_018 = 8
G_HPCF_0_045 = 7
G_HPCF_0_09 = 6
G_HPCF_0_18 = 5
G_HPCF_0_45 = 4
G_HPCF_0_9 = 3
G_HPCF_1_8 = 2
G_HPCF_3_5 = 1
G_HPCF_7_2 = 0
G_HPM_AUTORESET_ON_INTR = 3
G_HPM_NORMAL = 2
G_HPM_NORMAL_RESET_HPF = 0
G_HPM_REFERENCE = 1
G_INT1OUTSEL_0 = 0
G_INT1OUTSEL_1 = 1
G_INT1OUTSEL_2 = 2
G_INT1OUTSEL_3 = 3
G_ODR_190_12_5 = 4
G_ODR_190_25 = 5
G_ODR_190_50 = 6
G_ODR_190_70 = 7
G_ODR_380_100 = 11
G_ODR_380_20 = 8
G_ODR_380_25 = 9
G_ODR_380_50 = 10
G_ODR_760_100 = 15
G_ODR_760_30 = 12
G_ODR_760_35 = 13
G_ODR_760_50 = 14
G_ODR_95_12_5 = 0
G_ODR_95_25 = 1
G_ST_NORMAL = 0
G_ST_SELFTEST0 = 1
G_ST_SELFTEST1 = 3
INT1_CFG_G_ANDOR = 128
INT1_CFG_G_LIR = 64
INT1_CFG_G_XHIE = 2
INT1_CFG_G_XLIE = 1
INT1_CFG_G_YHIE = 8
INT1_CFG_G_YLIE = 4
INT1_CFG_G_ZHIE = 32
INT1_CFG_G_ZLIE = 16
INT1_SRC_G_IA = 64
INT1_SRC_G_XH = 2
INT1_SRC_G_XL = 1
INT1_SRC_G_YH = 8
INT1_SRC_G_YL = 4
INT1_SRC_G_ZH = 32
INT1_SRC_G_ZL = 16
INTERRUPT_G_DRDY = 1
INTERRUPT_G_INT = 0
INTERRUPT_XM_GEN1 = 2
INTERRUPT_XM_GEN2 = 3
INT_CTRL_REG_M_4D = 2
INT_CTRL_REG_M_IEA = 8
INT_CTRL_REG_M_IEL = 4
INT_CTRL_REG_M_MIEN = 1
INT_CTRL_REG_M_PP_OD = 16
INT_CTRL_REG_M_XMIEN = 128
INT_CTRL_REG_M_YMIEN = 64
INT_CTRL_REG_M_ZMIEN = 32
INT_GEN_X_DUR0 = 1
INT_GEN_X_DUR1 = 2
INT_GEN_X_DUR2 = 4
INT_GEN_X_DUR3 = 8
INT_GEN_X_DUR4 = 16
INT_GEN_X_DUR5 = 32
INT_GEN_X_DUR6 = 64
INT_GEN_X_REG_6D = 64
INT_GEN_X_REG_AOI = 128
INT_GEN_X_REG_XHIE_XUPE = 2
INT_GEN_X_REG_XLIE_XDOWNE = 1
INT_GEN_X_REG_YHIE_YUPE = 8
INT_GEN_X_REG_YLIE_YDOWNE = 4
INT_GEN_X_REG_ZHIE_ZUPE = 32
INT_GEN_X_REG_ZLIE_ZDOWNE = 16
INT_GEN_X_SRC_IA = 64
INT_GEN_X_SRC_XH = 2
INT_GEN_X_SRC_XL = 1
INT_GEN_X_SRC_YH = 8
INT_GEN_X_SRC_YL = 4
INT_GEN_X_SRC_ZH = 32
INT_GEN_X_SRC_ZL = 16
INT_GEN_X_THS0 = 1
INT_GEN_X_THS1 = 2
INT_GEN_X_THS2 = 4
INT_GEN_X_THS3 = 8
INT_GEN_X_THS4 = 16
INT_GEN_X_THS5 = 32
INT_GEN_X_THS6 = 64
INT_SRC_REG_M_MINT = 1
INT_SRC_REG_M_MROI = 2
INT_SRC_REG_M_NTH_X = 16
INT_SRC_REG_M_NTH_Y = 8
INT_SRC_REG_M_NTH_Z = 4
INT_SRC_REG_M_PTH_X = 128
INT_SRC_REG_M_PTH_Y = 64
INT_SRC_REG_M_PTH_Z = 32
REG_ACT_DUR = 63
REG_ACT_THS = 62
REG_CLICK_CFG = 56
REG_CLICK_SRC = 57
REG_CLICK_THS = 58
REG_CTRL_REG0_XM = 31
REG_CTRL_REG1_G = 32
REG_CTRL_REG1_XM = 32
REG_CTRL_REG2_G = 33
REG_CTRL_REG2_XM = 33
REG_CTRL_REG3_G = 34
REG_CTRL_REG3_XM = 34
REG_CTRL_REG4_G = 35
REG_CTRL_REG4_XM = 35
REG_CTRL_REG5_G = 36
REG_CTRL_REG5_XM = 36
REG_CTRL_REG6_XM = 37
REG_CTRL_REG7_XM = 38
REG_FIFO_CTRL_REG = 46
REG_FIFO_CTRL_REG_G = 46
REG_FIFO_SRC_REG = 47
REG_FIFO_SRC_REG_G = 47
REG_INT1_CFG_G = 48
REG_INT1_DURATION_G = 56
REG_INT1_SRC_G = 49
REG_INT1_TSH_XH_G = 50
REG_INT1_TSH_XL_G = 51
REG_INT1_TSH_YH_G = 52
REG_INT1_TSH_YL_G = 53
REG_INT1_TSH_ZH_G = 54
REG_INT1_TSH_ZL_G = 55
REG_INT_CTRL_REG_M = 18
REG_INT_GEN_1_DURATION = 51
REG_INT_GEN_1_REG = 48
REG_INT_GEN_1_SRC = 49
REG_INT_GEN_1_THS = 50
REG_INT_GEN_2_DURATION = 55
REG_INT_GEN_2_REG = 52
REG_INT_GEN_2_SRC = 53
REG_INT_GEN_2_THS = 54
REG_INT_SRC_REG_M = 19
REG_INT_THS_H_M = 21
REG_INT_THS_L_M = 20
REG_OFFSET_X_H_M = 23
REG_OFFSET_X_L_M = 22
REG_OFFSET_Y_H_M = 25
REG_OFFSET_Y_L_M = 24
REG_OFFSET_Z_H_M = 27
REG_OFFSET_Z_L_M = 26
REG_OUT_TEMP_H_XM = 6
REG_OUT_TEMP_L_XM = 5
REG_OUT_X_H_A = 41
REG_OUT_X_H_G = 41
REG_OUT_X_H_M = 9
REG_OUT_X_L_A = 40
REG_OUT_X_L_G = 40
REG_OUT_X_L_M = 8
REG_OUT_Y_H_A = 43
REG_OUT_Y_H_G = 43
REG_OUT_Y_H_M = 11
REG_OUT_Y_L_A = 42
REG_OUT_Y_L_G = 42
REG_OUT_Y_L_M = 10
REG_OUT_Z_H_A = 45
REG_OUT_Z_H_G = 45
REG_OUT_Z_H_M = 13
REG_OUT_Z_L_A = 44
REG_OUT_Z_L_G = 44
REG_OUT_Z_L_M = 12
REG_REFERENCE_G = 37
REG_REFERENCE_X = 28
REG_REFERENCE_Y = 29
REG_REFERENCE_Z = 30
REG_STATUS_REG_A = 39
REG_STATUS_REG_G = 39
REG_STATUS_REG_M = 7
REG_TIME_LATENCY = 60
REG_TIME_LIMIT = 59
REG_TIME_WINDOW = 61
REG_WHO_AM_I_G = 15
REG_WHO_AM_I_XM = 15
STATUS_REG_A_XADA = 1
STATUS_REG_A_XAOR = 16
STATUS_REG_A_YADA = 2
STATUS_REG_A_YAOR = 32
STATUS_REG_A_ZADA = 4
STATUS_REG_A_ZAOR = 64
STATUS_REG_A_ZYXADA = 8
STATUS_REG_A_ZYXAOR = 128
STATUS_REG_G_XDA = 1
STATUS_REG_G_XOR = 16
STATUS_REG_G_YDA = 2
STATUS_REG_G_YOR = 32
STATUS_REG_G_ZDA = 4
STATUS_REG_G_ZOR = 64
STATUS_REG_G_ZYXDA = 8
STATUS_REG_G_ZYXOR = 128
STATUS_REG_M_XMDA = 1
STATUS_REG_M_XMOR = 16
STATUS_REG_M_YMDA = 2
STATUS_REG_M_YMOR = 32
STATUS_REG_M_ZMDA = 4
STATUS_REG_M_ZMOR = 64
STATUS_REG_M_ZYXMDA = 8
STATUS_REG_M_ZYXMOR = 128
XM_ABW_194 = 1
XM_ABW_362 = 2
XM_ABW_50 = 3
XM_ABW_773 = 0
XM_AFS_16 = 4
XM_AFS_2 = 0
XM_AFS_4 = 1
XM_AFS_6 = 2
XM_AFS_8 = 3
XM_AHPM_AUTORESET = 3
XM_AHPM_NORMAL = 2
XM_AHPM_NORMAL_REF = 0
XM_AHPM_REFERENCE = 1
XM_AODR_100 = 6
XM_AODR_1000 = 10
XM_AODR_12_5 = 3
XM_AODR_200 = 7
XM_AODR_25 = 4
XM_AODR_3_125 = 1
XM_AODR_400 = 8
XM_AODR_50 = 5
XM_AODR_6_25 = 2
XM_AODR_800 = 9
XM_AODR_PWRDWN = 0
XM_AST_NEG_SIGN = 2
XM_AST_NORMAL = 0
XM_AST_POS_SIGN = 1
XM_MD_CONTINUOUS = 0
XM_MD_POWERDOWN = 2
XM_MD_SINGLE = 1
XM_MFS_12 = 3
XM_MFS_2 = 0
XM_MFS_4 = 1
XM_MFS_8 = 2
XM_ODR_100 = 5
XM_ODR_12_5 = 2
XM_ODR_25 = 3
XM_ODR_3_125 = 0
XM_ODR_50 = 4
XM_ODR_6_25 = 1
XM_RES_HIGH = 3
XM_RES_LOW = 0
enableTemperatureSensor(enable)[source]

bool enableTemperatureSensor(bool enable)

enable onboard temperature measurement sensor

enable: true to enable temperature sensor, false to disable

true if successful, false otherwise

getAccelerometer(*args)[source]

std::vector< float > getAccelerometer()

get the accelerometer values in gravities

std::vector containing X, Y, Z acceleration values

getAccelerometerStatus()[source]

uint8_t getAccelerometerStatus()

return the accelerometer status register

bitmask of STATUS_REG_A_BITS_T bits

getGyroscope(*args)[source]

std::vector< float > getGyroscope()

get the gyroscope values in degrees per second

std::vector containing X, Y, Z gyroscope values

getGyroscopeInterruptConfig()[source]

uint8_t getGyroscopeInterruptConfig()

return the gyroscope interrupt config register

bitmask of INT1_CFG_G_BITS_T bits

getGyroscopeInterruptSrc()[source]

uint8_t getGyroscopeInterruptSrc()

return the gyroscope interrupt src register

bitmask of INT1_SRC_G_BITS_T bits

getGyroscopeStatus()[source]

uint8_t getGyroscopeStatus()

return the gyroscope status register

bitmask of STATUS_REG_G_BITS_T bits

getInterruptGen1()[source]

uint8_t getInterruptGen1()

return the inertial interrupt generator 1 register

bitmask of INT_GEN_X_REG_BITS_T bits

getInterruptGen1Src()[source]

uint8_t getInterruptGen1Src()

return the inertial interrupt generator 1 src register

bitmask of INT_GEN_X_SRC_BITS_T bits

getInterruptGen2()[source]

uint8_t getInterruptGen2()

return the inertial interrupt generator 2 register

bitmask of INT_GEN_X_REG_BITS_T bits

getInterruptGen2Src()[source]

uint8_t getInterruptGen2Src()

return the inertial interrupt generator 2 src register

bitmask of INT_GEN_X_SRC_BITS_T bits

getMagnetometer(*args)[source]

std::vector< float > getMagnetometer()

get the magnetometer values in gauss

std::vector containing X, Y, Z magnetometer values

getMagnetometerInterruptControl()[source]

uint8_t getMagnetometerInterruptControl()

return the magnetometer interrupt control register

bitmask of INT_CTRL_REG_M_BITS_T bits

getMagnetometerInterruptSrc()[source]

uint8_t getMagnetometerInterruptSrc()

return the magnetometer interrupt src register

bitmask of INT_SRC_REG_M_BITS_T bits

getMagnetometerStatus()[source]

uint8_t getMagnetometerStatus()

return the magnetometer status register

bitmask of STATUS_REG_M_BITS_T bits

getTemperature()[source]

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!

the temperature value in degrees Celsius

init()[source]

bool init()

set up initial values and start operation

true if successful

installISR(intr, gpio, level, isr, arg)[source]

void installISR(INTERRUPT_PINS_T intr, int gpio, mraa::Edge level, void(*isr)(void *), void *arg)

install an interrupt handler.

intr: one of the INTERRUPT_PINS_T values specifying which interrupt pin out of 4 you are installing

gpio: gpio pin to use as interrupt pin

level: the interrupt trigger level (one of mraa::Edge values). Make sure that you have configured the interrupt pin properly for whatever level you choose.

isr: the interrupt handler, accepting a void * argument

arg: the argument to pass the the interrupt handler

readReg(dev, reg)[source]

uint8_t readReg(DEVICE_T dev, uint8_t reg)

read a register

dev: the device to access (XM or G)

reg: the register to read

the value of the register

readRegs(dev, reg, buffer, len)[source]

void readRegs(DEVICE_T dev, uint8_t reg, uint8_t *buffer, int len)

read contiguous register into a buffer

dev: the device to access (XM or G)

reg: the register to start reading at

buf: the buffer to store the results

len: the number of registers to read

the value of the register

setAccelerometerEnableAxes(axes)[source]

bool setAccelerometerEnableAxes(uint8_t axes)

enable or disable accelerometer axes.

axes: bit mask of valid axes, (CTRL_REG1_XM_AXEN, …)

true if successful, false otherwise

setAccelerometerODR(odr)[source]

bool setAccelerometerODR(XM_AODR_T odr)

set the accelerometer Output Data Rate (ODR)

odr: one of the XM_AODR_T values

true if successful, false otherwise

setAccelerometerScale(scale)[source]

bool setAccelerometerScale(XM_AFS_T scale)

set the scaling mode of the accelerometer

scale: one of the XM_AFS_T values

true if successful, false otherwise

setGyroscopeEnableAxes(axes)[source]

bool setGyroscopeEnableAxes(uint8_t 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, …)

true if successful, false otherwise

setGyroscopeInterruptConfig(enables)[source]

bool setGyroscopeInterruptConfig(uint8_t enables)

set the gyroscope interrupt config register

enables: bitmask of INT1_CFG_G_BITS_T values

true if successful

setGyroscopeODR(odr)[source]

bool setGyroscopeODR(G_ODR_T odr)

set the gyroscope Output Data Rate (ODR)

odr: one of the G_ODR_T values

true if successful, false otherwise

setGyroscopePowerDown(enable)[source]

bool setGyroscopePowerDown(bool enable)

enable or disable the gyro power down mode

enable: true to put device to sleep, false to wake up

true if successful, false otherwise

setGyroscopeScale(scale)[source]

bool setGyroscopeScale(G_FS_T scale)

set the scaling mode of the gyroscope

scale: one of the G_FS_T values

true if successful, false otherwise

setInterruptGen1(enables)[source]

bool setInterruptGen1(uint8_t enables)

set the inertial interrupt generator 1 register

enables: bitmask of INT_GEN_X_REG_BITS_T values

true if successful

setInterruptGen2(enables)[source]

bool setInterruptGen2(uint8_t enables)

set the inertial interrupt generator 2 register

enables: bitmask of INT_GEN_X_REG_BITS_T values

true if successful

setMagnetometerInterruptControl(enables)[source]

bool setMagnetometerInterruptControl(uint8_t enables)

set the magnetometer interrupt control register

enables: bitmask of INT_CTRL_REG_M_BITS_T values

true if successful

setMagnetometerLPM(enable)[source]

bool setMagnetometerLPM(bool 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

true if successful, false otherwise

setMagnetometerMode(mode)[source]

bool setMagnetometerMode(XM_MD_T mode)

set the magnetometer sensor mode

mode: one of the XM_MD_T values

true if successful, false otherwise

setMagnetometerODR(odr)[source]

bool setMagnetometerODR(XM_ODR_T odr)

set the magnetometer Output Data Rate (ODR)

odr: one of the XM_ODR_T values

true if successful, false otherwise

setMagnetometerResolution(res)[source]

bool setMagnetometerResolution(XM_RES_T res)

set the magnetometer resolution

res: one of the XM_RES_T values

true if successful, false otherwise

setMagnetometerScale(scale)[source]

bool setMagnetometerScale(XM_MFS_T scale)

set the scaling mode of the magnetometer

scale: one of the XM_MFS_T values

true if successful, false otherwise

uninstallISR(intr)[source]

void uninstallISR(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

update()[source]

void update()

update the accelerometer, gyroscope, magnetometer and termperature values.

updateAccelerometer()[source]

void updateAccelerometer()

update the accelerometer values only

updateGyroscope()[source]

void updateGyroscope()

update the gyroscope values only

updateMagnetometer()[source]

void updateMagnetometer()

update the magnetometer values only

updateTemperature()[source]

void updateTemperature()

update the temperature value only

writeReg(dev, reg, val)[source]

bool writeReg(DEVICE_T dev, uint8_t reg, uint8_t val)

write to a register

dev: the device to access (XM or G)

reg: the register to write to

val: the value to write

true if successful, false otherwise