LSM9DS0 Class
- 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.
Item Index
Methods
- LSM9DS0
- init
- update
- updateGyroscope
- updateAccelerometer
- updateMagnetometer
- updateTemperature
- readReg
- readRegs
- writeReg
- setGyroscopePowerDown
- setGyroscopeEnableAxes
- setGyroscopeODR
- setGyroscopeScale
- setAccelerometerEnableAxes
- setAccelerometerODR
- setAccelerometerScale
- setMagnetometerResolution
- setMagnetometerODR
- setMagnetometerMode
- setMagnetometerLPM
- setMagnetometerScale
- getAccelerometer
- getGyroscope
- getMagnetometer
- getAccelerometer
- getGyroscope
- getMagnetometer
- getTemperature
- enableTemperatureSensor
- getGyroscopeStatus
- getMagnetometerStatus
- getAccelerometerStatus
- getGyroscopeInterruptConfig
- setGyroscopeInterruptConfig
- getGyroscopeInterruptSrc
- getMagnetometerInterruptControl
- setMagnetometerInterruptControl
- getMagnetometerInterruptSrc
- getInterruptGen1
- setInterruptGen1
- getInterruptGen1Src
- getInterruptGen2
- setInterruptGen2
- getInterruptGen2Src
- installISR
- uninstallISR
Properties
- REG_WHO_AM_I_G
- REG_CTRL_REG1_G
- REG_CTRL_REG2_G
- REG_CTRL_REG3_G
- REG_CTRL_REG4_G
- REG_CTRL_REG5_G
- REG_REFERENCE_G
- REG_STATUS_REG_G
- REG_OUT_X_L_G
- REG_OUT_X_H_G
- REG_OUT_Y_L_G
- REG_OUT_Y_H_G
- REG_OUT_Z_L_G
- REG_OUT_Z_H_G
- REG_FIFO_CTRL_REG_G
- REG_FIFO_SRC_REG_G
- REG_INT1_CFG_G
- REG_INT1_SRC_G
- REG_INT1_TSH_XH_G
- REG_INT1_TSH_XL_G
- REG_INT1_TSH_YH_G
- REG_INT1_TSH_YL_G
- REG_INT1_TSH_ZH_G
- REG_INT1_TSH_ZL_G
- REG_INT1_DURATION_G
- CTRL_REG1_G_YEN
- CTRL_REG1_G_XEN
- CTRL_REG1_G_ZEN
- CTRL_REG1_G_PD
- CTRL_REG1_G_BW0
- CTRL_REG1_G_BW1
- _CTRL_REG1_G_BW_MASK
- _CTRL_REG1_G_BW_SHIFT
- CTRL_REG1_G_DR0
- CTRL_REG1_G_DR1
- _CTRL_REG1_G_DR_MASK
- _CTRL_REG1_G_DR_SHIFT
- CTRL_REG1_G_ODR0
- CTRL_REG1_G_ODR1
- CTRL_REG1_G_ODR2
- CTRL_REG1_G_ODR3
- _CTRL_REG1_G_ODR_MASK
- _CTRL_REG1_G_ODR_SHIFT
- G_ODR_95_12_5
- G_ODR_95_25
- G_ODR_190_12_5
- G_ODR_190_25
- G_ODR_190_50
- G_ODR_190_70
- G_ODR_380_20
- G_ODR_380_25
- G_ODR_380_50
- G_ODR_380_100
- G_ODR_760_30
- G_ODR_760_35
- G_ODR_760_50
- G_ODR_760_100
- CTRL_REG2_G_HPCF0
- CTRL_REG2_G_HPCF1
- CTRL_REG2_G_HPCF2
- CTRL_REG2_G_HPCF3
- _CTRL_REG2_G_HPCF_MASK
- _CTRL_REG2_G_HPCF_SHIFT
- CTRL_REG2_G_HPM0
- CTRL_REG2_G_HPM1
- _CTRL_REG2_G_HPM_MASK
- _CTRL_REG2_G_HPM_SHIFT
- G_HPCF_7_2
- G_HPCF_3_5
- G_HPCF_1_8
- G_HPCF_0_9
- G_HPCF_0_45
- G_HPCF_0_18
- G_HPCF_0_09
- G_HPCF_0_045
- G_HPCF_0_018
- G_HPCF_0_009
- G_HPM_NORMAL_RESET_HPF
- G_HPM_REFERENCE
- G_HPM_NORMAL
- G_HPM_AUTORESET_ON_INTR
- CTRL_REG3_G_I2_EMPTY
- CTRL_REG3_G_I2_ORUN
- CTRL_REG3_G_I2_WTM
- CTRL_REG3_G_I2_DRDY
- CTRL_REG3_G_PP_OD
- CTRL_REG3_G_H_LACTIVE
- CTRL_REG3_G_I1_BOOT
- CTRL_REG3_G_I1_INT1
- CTRL_REG4_G_SIM
- CTRL_REG4_G_ST0
- CTRL_REG4_G_ST1
- _CTRL_REG4_G_ST_MASK
- _CTRL_REG4_G_ST_SHIFT
- CTRL_REG4_G_FS0
- CTRL_REG4_G_FS1
- _CTRL_REG4_G_FS_MASK
- _CTRL_REG4_G_FS_SHIFT
- CTRL_REG4_G_BLE
- CTRL_REG4_G_BDU
- G_ST_NORMAL
- G_ST_SELFTEST0
- G_ST_SELFTEST1
- G_FS_245
- G_FS_500
- G_FS_2000
- CTRL_REG5_G_OUTSEL0
- CTRL_REG5_G_OUTSEL1
- _CTRL_REG5_G_OUTSEL_MASK
- _CTRL_REG5_G_OUTSEL_SHIFT
- CTRL_REG5_G_INT1SEL0
- CTRL_REG5_G_INT1SEL1
- _CTRL_REG5_G_INT1SEL_MASK
- _CTRL_REG5_G_INT1SEL_SHIFT
- CTRL_REG5_G_HPEN
- CTRL_REG5_G_FIFO_EN
- CTRL_REG5_G_BOOT
- G_INT1OUTSEL_0
- G_INT1OUTSEL_1
- G_INT1OUTSEL_2
- G_INT1OUTSEL_3
- STATUS_REG_G_XDA
- STATUS_REG_G_YDA
- STATUS_REG_G_ZDA
- STATUS_REG_G_ZYXDA
- STATUS_REG_G_XOR
- STATUS_REG_G_YOR
- STATUS_REG_G_ZOR
- STATUS_REG_G_ZYXOR
- FIFO_CTRL_REG_G_WTM0
- FIFO_CTRL_REG_G_WTM1
- FIFO_CTRL_REG_G_WTM2
- FIFO_CTRL_REG_G_WTM3
- FIFO_CTRL_REG_G_WTM4
- _FIFO_CTRL_REG_G_WTM_MASK
- _FIFO_CTRL_REG_G_WTM_SHIFT
- FIFO_CTRL_REG_G_FM0
- FIFO_CTRL_REG_G_FM1
- FIFO_CTRL_REG_G_FM2
- _FIFO_CTRL_REG_G_FM_MASK
- _FIFO_CTRL_REG_G_FM_SHIFT
- G_FM_BYPASS
- G_FM_FIFO
- G_FM_STREAM
- G_FM_STREAM2FIFO
- G_FM_BYPASS2STREAM
- FIFO_CTRL_REG_G_FSS0
- FIFO_CTRL_REG_G_FSS1
- FIFO_CTRL_REG_G_FSS2
- FIFO_CTRL_REG_G_FSS3
- FIFO_CTRL_REG_G_FSS4
- _FIFO_CTRL_REG_G_FSS_MASK
- _FIFO_CTRL_REG_G_FSS_SHIFT
- FIFO_CTRL_REG_G_EMPTY
- FIFO_CTRL_REG_G_OVRN
- FIFO_CTRL_REG_G_WTM
- INT1_CFG_G_XLIE
- INT1_CFG_G_XHIE
- INT1_CFG_G_YLIE
- INT1_CFG_G_YHIE
- INT1_CFG_G_ZLIE
- INT1_CFG_G_ZHIE
- INT1_CFG_G_LIR
- INT1_CFG_G_ANDOR
- INT1_SRC_G_XL
- INT1_SRC_G_XH
- INT1_SRC_G_YL
- INT1_SRC_G_YH
- INT1_SRC_G_ZL
- INT1_SRC_G_ZH
- INT1_SRC_G_IA
- REG_OUT_TEMP_L_XM
- REG_OUT_TEMP_H_XM
- REG_STATUS_REG_M
- REG_OUT_X_L_M
- REG_OUT_X_H_M
- REG_OUT_Y_L_M
- REG_OUT_Y_H_M
- REG_OUT_Z_L_M
- REG_OUT_Z_H_M
- REG_WHO_AM_I_XM
- REG_INT_CTRL_REG_M
- REG_INT_SRC_REG_M
- REG_INT_THS_L_M
- REG_INT_THS_H_M
- REG_OFFSET_X_L_M
- REG_OFFSET_X_H_M
- REG_OFFSET_Y_L_M
- REG_OFFSET_Y_H_M
- REG_OFFSET_Z_L_M
- REG_OFFSET_Z_H_M
- REG_REFERENCE_X
- REG_REFERENCE_Y
- REG_REFERENCE_Z
- REG_CTRL_REG0_XM
- REG_CTRL_REG1_XM
- REG_CTRL_REG2_XM
- REG_CTRL_REG3_XM
- REG_CTRL_REG4_XM
- REG_CTRL_REG5_XM
- REG_CTRL_REG6_XM
- REG_CTRL_REG7_XM
- REG_STATUS_REG_A
- REG_OUT_X_L_A
- REG_OUT_X_H_A
- REG_OUT_Y_L_A
- REG_OUT_Y_H_A
- REG_OUT_Z_L_A
- REG_OUT_Z_H_A
- REG_FIFO_CTRL_REG
- REG_FIFO_SRC_REG
- REG_INT_GEN_1_REG
- REG_INT_GEN_1_SRC
- REG_INT_GEN_1_THS
- REG_INT_GEN_1_DURATION
- REG_INT_GEN_2_REG
- REG_INT_GEN_2_SRC
- REG_INT_GEN_2_THS
- REG_INT_GEN_2_DURATION
- REG_CLICK_CFG
- REG_CLICK_SRC
- REG_CLICK_THS
- REG_TIME_LIMIT
- REG_TIME_LATENCY
- REG_TIME_WINDOW
- REG_ACT_THS
- REG_ACT_DUR
- STATUS_REG_M_XMDA
- STATUS_REG_M_YMDA
- STATUS_REG_M_ZMDA
- STATUS_REG_M_ZYXMDA
- STATUS_REG_M_XMOR
- STATUS_REG_M_YMOR
- STATUS_REG_M_ZMOR
- STATUS_REG_M_ZYXMOR
- INT_CTRL_REG_M_MIEN
- INT_CTRL_REG_M_4D
- INT_CTRL_REG_M_IEL
- INT_CTRL_REG_M_IEA
- INT_CTRL_REG_M_PP_OD
- INT_CTRL_REG_M_ZMIEN
- INT_CTRL_REG_M_YMIEN
- INT_CTRL_REG_M_XMIEN
- INT_SRC_REG_M_MINT
- INT_SRC_REG_M_MROI
- INT_SRC_REG_M_NTH_Z
- INT_SRC_REG_M_NTH_Y
- INT_SRC_REG_M_NTH_X
- INT_SRC_REG_M_PTH_Z
- INT_SRC_REG_M_PTH_Y
- INT_SRC_REG_M_PTH_X
- CTRL_REG0_XM_HPIS2
- CTRL_REG0_XM_HPIS1
- CTRL_REG0_XM_HP_CLICK
- CTRL_REG0_XM_WTM_LEN
- CTRL_REG0_XM_FIFO_EN
- CTRL_REG0_XM_BOOT
- CTRL_REG1_XM_AXEN
- CTRL_REG1_XM_AYEN
- CTRL_REG1_XM_AZEN
- CTRL_REG1_XM_BDU
- CTRL_REG1_XM_AODR0
- CTRL_REG1_XM_AODR1
- CTRL_REG1_XM_AODR2
- CTRL_REG1_XM_AODR3
- _CTRL_REG1_XM_AODR_MASK
- _CTRL_REG1_XM_AODR_SHIFT
- XM_AODR_PWRDWN
- XM_AODR_3_125
- XM_AODR_6_25
- XM_AODR_12_5
- XM_AODR_25
- XM_AODR_50
- XM_AODR_100
- XM_AODR_200
- XM_AODR_400
- XM_AODR_800
- XM_AODR_1000
- CTRL_REG2_XM_SIM
- CTRL_REG2_XM_AST0
- CTRL_REG2_XM_AST1
- _CTRL_REG2_XM_AST_MASK
- _CTRL_REG2_XM_AST_SHIFT
- CTRL_REG2_XM_AFS0
- CTRL_REG2_XM_AFS1
- CTRL_REG2_XM_AFS2
- _CTRL_REG2_XM_AFS_MASK
- _CTRL_REG2_XM_AFS_SHIFT
- CTRL_REG2_XM_ABW0
- CTRL_REG2_XM_ABW1
- _CTRL_REG2_XM_ABW_MASK
- _CTRL_REG2_XM_ABW_SHIFT
- XM_AST_NORMAL
- XM_AST_POS_SIGN
- XM_AST_NEG_SIGN
- XM_AFS_2
- XM_AFS_4
- XM_AFS_6
- XM_AFS_8
- XM_AFS_16
- XM_ABW_773
- XM_ABW_194
- XM_ABW_362
- XM_ABW_50
- CTRL_REG3_XM_P1_EMPTY
- CTRL_REG3_XM_P1_DRDYM
- CTRL_REG3_XM_P1_DRDYA
- CTRL_REG3_XM_P1_INTM
- CTRL_REG3_XM_P1_INT2
- CTRL_REG3_XM_P1_INT1
- CTRL_REG3_XM_P1_TAP
- CTRL_REG3_XM_P1_BOOT
- CTRL_REG4_XM_P2_WTM
- CTRL_REG4_XM_P2_OVERRUN
- CTRL_REG4_XM_P2_DRDYM
- CTRL_REG4_XM_P2_DRDYA
- CTRL_REG4_XM_P2_INTM
- CTRL_REG4_XM_P2_INT2
- CTRL_REG4_XM_P2_INT1
- CTRL_REG4_XM_P2_TAP
- CTRL_REG5_XM_LIR1
- CTRL_REG5_XM_LIR2
- CTRL_REG5_XM_ODR0
- CTRL_REG5_XM_ODR1
- CTRL_REG5_XM_ODR2
- _CTRL_REG5_XM_ODR_MASK
- _CTRL_REG5_XM_ODR_SHIFT
- CTRL_REG5_XM_RES0
- CTRL_REG5_XM_RES1
- _CTRL_REG5_XM_RES_MASK
- _CTRL_REG5_XM_RES_SHIFT
- CTRL_REG5_XM_TEMP_EN
- XM_ODR_3_125
- XM_ODR_6_25
- XM_ODR_12_5
- XM_ODR_25
- XM_ODR_50
- XM_ODR_100
- XM_RES_LOW
- XM_RES_HIGH
- CTRL_REG6_XM_MFS0
- CTRL_REG6_XM_MFS1
- _CTRL_REG6_XM_MFS_MASK
- _CTRL_REG6_XM_MFS_SHIFT
- XM_MFS_2
- XM_MFS_4
- XM_MFS_8
- XM_MFS_12
- CTRL_REG7_XM_MD0
- CTRL_REG7_XM_MD1
- _CTRL_REG7_XM_MD_MASK
- _CTRL_REG7_XM_MD_SHIFT
- CTRL_REG7_XM_MLP
- CTRL_REG7_XM_AFDS
- CTRL_REG7_XM_AHPM0
- CTRL_REG7_XM_AHPM1
- _CTRL_REG7_XM_AHPM_MASK
- _CTRL_REG7_XM_AHPM_SHIFT
- XM_MD_CONTINUOUS
- XM_MD_SINGLE
- XM_MD_POWERDOWN
- XM_AHPM_NORMAL_REF
- XM_AHPM_REFERENCE
- XM_AHPM_NORMAL
- XM_AHPM_AUTORESET
- STATUS_REG_A_XADA
- STATUS_REG_A_YADA
- STATUS_REG_A_ZADA
- STATUS_REG_A_ZYXADA
- STATUS_REG_A_XAOR
- STATUS_REG_A_YAOR
- STATUS_REG_A_ZAOR
- STATUS_REG_A_ZYXAOR
- FIFO_CTRL_REG_FTH0
- FIFO_CTRL_REG_FTH1
- FIFO_CTRL_REG_FTH2
- FIFO_CTRL_REG_FTH3
- FIFO_CTRL_REG_FTH4
- _FIFO_CTRL_REG_FTH_MASK
- _FIFO_CTRL_REG_FTH_SHIFT
- FIFO_CTRL_REG_FM0
- FIFO_CTRL_REG_FM1
- FIFO_CTRL_REG_FM2
- _FIFO_CTRL_REG_FM_MASK
- _FIFO_CTRL_REG_FM_SHIFT
- FM_BYPASS
- FM_FIFO
- FM_STREAM
- FM_STREAM2FIFO
- FM_BYPASS2STREAM
- FIFO_CTRL_REG_FSS0
- FIFO_CTRL_REG_FSS1
- FIFO_CTRL_REG_FSS2
- FIFO_CTRL_REG_FSS3
- FIFO_CTRL_REG_FSS4
- _FIFO_CTRL_REG_FSS_MASK
- _FIFO_CTRL_REG_FSS_SHIFT
- FIFO_CTRL_REG_EMPTY
- FIFO_CTRL_REG_OVRN
- FIFO_CTRL_REG_WTM
- INT_GEN_X_REG_XLIE_XDOWNE
- INT_GEN_X_REG_XHIE_XUPE
- INT_GEN_X_REG_YLIE_YDOWNE
- INT_GEN_X_REG_YHIE_YUPE
- INT_GEN_X_REG_ZLIE_ZDOWNE
- INT_GEN_X_REG_ZHIE_ZUPE
- INT_GEN_X_REG_6D
- INT_GEN_X_REG_AOI
- INT_GEN_X_SRC_XL
- INT_GEN_X_SRC_XH
- INT_GEN_X_SRC_YL
- INT_GEN_X_SRC_YH
- INT_GEN_X_SRC_ZL
- INT_GEN_X_SRC_ZH
- INT_GEN_X_SRC_IA
- INT_GEN_X_THS0
- INT_GEN_X_THS1
- INT_GEN_X_THS2
- INT_GEN_X_THS3
- INT_GEN_X_THS4
- INT_GEN_X_THS5
- INT_GEN_X_THS6
- _INT_GEN_X_THS_MASK
- _INT_GEN_X_THS_SHIFT
- INT_GEN_X_DUR0
- INT_GEN_X_DUR1
- INT_GEN_X_DUR2
- INT_GEN_X_DUR3
- INT_GEN_X_DUR4
- INT_GEN_X_DUR5
- INT_GEN_X_DUR6
- _INT_GEN_X_DUR_MASK
- _INT_GEN_X_DUR_SHIFT
- CLICK_CONFIG_XS
- CLICK_CONFIG_XD
- CLICK_CONFIG_YS
- CLICK_CONFIG_YD
- CLICK_CONFIG_ZS
- CLICK_CONFIG_ZD
- CLICK_SRC_X
- CLICK_SRC_Y
- CLICK_SRC_Z
- CLICK_SRC_SIGN
- CLICK_SRC_SCLICK
- CLICK_SRC_DCLICK
- CLICK_SRC_IA
- CLICK_THS_THS0
- CLICK_THS_THS1
- CLICK_THS_THS2
- CLICK_THS_THS3
- CLICK_THS_THS4
- CLICK_THS_THS5
- CLICK_THS_THS6
- _CLICK_THS_THS_MASK
- _CLICK_THS_THS_SHIFT
- CLICK_TIME_LIMIT_TLI0
- CLICK_TIME_LIMIT_TLI1
- CLICK_TIME_LIMIT_TLI2
- CLICK_TIME_LIMIT_TLI3
- CLICK_TIME_LIMIT_TLI4
- CLICK_TIME_LIMIT_TLI5
- CLICK_TIME_LIMIT_TLI6
- _CLICK_TIME_LIMIT_TLI_MASK
- _CLICK_TIME_LIMIT_TLI_SHIFT
- ACT_THS_ACTH0
- ACT_THS_ACTH1
- ACT_THS_ACTH2
- ACT_THS_ACTH3
- ACT_THS_ACTH4
- ACT_THS_ACTH5
- ACT_THS_ACTH6
- _ACT_THS_ACTH_MASK
- _ACT_THS_ACTH_SHIFT
- DEV_GYRO
- DEV_XM
- INTERRUPT_G_INT
- INTERRUPT_G_DRDY
- INTERRUPT_XM_GEN1
- INTERRUPT_XM_GEN2
Methods
LSM9DS0
-
bus
-
raw
-
gAddress
-
xmAddress
lsm9ds0 constructor
Parameters:
-
bus
Numberi2c bus to use
-
raw
Booleanbypass board definition file, set to true if using Sparkfun 9DOF Block on an Intel Edison Arduino board
-
gAddress
Numberthe gyroscope address for this device
-
xmAddress
Numberthe accelerometer/magnetometer address for this device
Returns:
init
()
Boolean
set up initial values and start operation
Returns:
true if successful
update
()
update the accelerometer, gyroscope, magnetometer and termperature values.
updateGyroscope
()
update the gyroscope values only
updateAccelerometer
()
update the accelerometer values only
updateMagnetometer
()
update the magnetometer values only
updateTemperature
()
update the temperature value only
readReg
-
dev
-
reg
read a register
Parameters:
-
dev
DEVICE_Tthe device to access (XM or G)
-
reg
Numberthe register to read
Returns:
the value of the register
readRegs
-
dev
-
reg
-
buffer
-
len
read contiguous register into a buffer
Parameters:
-
dev
DEVICE_Tthe device to access (XM or G)
-
reg
Numberthe register to start reading at
-
buffer
Uint8_t *undefined
-
len
Numberthe number of registers to read
writeReg
-
dev
-
reg
-
val
write to a register
Parameters:
-
dev
DEVICE_Tthe device to access (XM or G)
-
reg
Numberthe register to write to
-
val
Numberthe value to write
Returns:
true if successful, false otherwise
setGyroscopePowerDown
-
enable
enable or disable the gyro power down mode
Parameters:
-
enable
Booleantrue to put device to sleep, false to wake up
Returns:
true if successful, false otherwise
setGyroscopeEnableAxes
-
axes
enable or disable gyroscope axes. If all axis are disabled, and powerdown mode is not set, then the gyro goes into sleep mode.
Parameters:
-
axes
Numberbit mask of valid axes, (CTRL_REG1_G_YEN, ...)
Returns:
true if successful, false otherwise
setGyroscopeODR
-
odr
set the gyroscope Output Data Rate (ODR)
Parameters:
-
odr
G_ODR_Tone of the G_ODR_T values
Returns:
true if successful, false otherwise
setGyroscopeScale
-
scale
set the scaling mode of the gyroscope
Parameters:
-
scale
G_FS_Tone of the G_FS_T values
Returns:
true if successful, false otherwise
setAccelerometerEnableAxes
-
axes
enable or disable accelerometer axes.
Parameters:
-
axes
Numberbit mask of valid axes, (CTRL_REG1_XM_AXEN, ...)
Returns:
true if successful, false otherwise
setAccelerometerODR
-
odr
set the accelerometer Output Data Rate (ODR)
Parameters:
-
odr
XM_AODR_Tone of the XM_AODR_T values
Returns:
true if successful, false otherwise
setAccelerometerScale
-
scale
set the scaling mode of the accelerometer
Parameters:
-
scale
XM_AFS_Tone of the XM_AFS_T values
Returns:
true if successful, false otherwise
setMagnetometerResolution
-
res
set the magnetometer resolution
Parameters:
-
res
XM_RES_Tone of the XM_RES_T values
Returns:
true if successful, false otherwise
setMagnetometerODR
-
odr
set the magnetometer Output Data Rate (ODR)
Parameters:
-
odr
XM_ODR_Tone of the XM_ODR_T values
Returns:
true if successful, false otherwise
setMagnetometerMode
-
mode
set the magnetometer sensor mode
Parameters:
-
mode
XM_MD_Tone of the XM_MD_T values
Returns:
true if successful, false otherwise
setMagnetometerLPM
-
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.
Parameters:
-
enable
Booleantrue to enable LPM, false otherwise
Returns:
true if successful, false otherwise
setMagnetometerScale
-
scale
set the scaling mode of the magnetometer
Parameters:
-
scale
XM_MFS_Tone of the XM_MFS_T values
Returns:
true if successful, false otherwise
getAccelerometer
-
x
-
y
-
z
get the accelerometer values in gravities
Parameters:
-
x
Float *the returned x value, if arg is non-NULL
-
y
Float *the returned y value, if arg is non-NULL
-
z
Float *the returned z value, if arg is non-NULL
getGyroscope
-
x
-
y
-
z
get the gyroscope values in degrees per second
Parameters:
-
x
Float *the returned x value, if arg is non-NULL
-
y
Float *the returned y value, if arg is non-NULL
-
z
Float *the returned z value, if arg is non-NULL
getMagnetometer
-
x
-
y
-
z
get the magnetometer values in gauss
Parameters:
-
x
Float *the returned x value, if arg is non-NULL
-
y
Float *the returned y value, if arg is non-NULL
-
z
Float *the returned z value, if arg is non-NULL
getAccelerometer
()
Std::vector float
get the accelerometer values in gravities
Returns:
std::vector containing X, Y, Z acceleration values
getGyroscope
()
Std::vector float
get the gyroscope values in degrees per second
Returns:
std::vector containing X, Y, Z gyroscope values
getMagnetometer
()
Std::vector float
get the magnetometer values in gauss
Returns:
std::vector containing X, Y, Z magnetometer values
getTemperature
()
Number
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!
Returns:
the temperature value in degrees Celsius
enableTemperatureSensor
-
enable
enable onboard temperature measurement sensor
Parameters:
-
enable
Booleantrue to enable temperature sensor, false to disable
Returns:
true if successful, false otherwise
getGyroscopeStatus
()
Number
return the gyroscope status register
Returns:
bitmask of STATUS_REG_G_BITS_T bits
getMagnetometerStatus
()
Number
return the magnetometer status register
Returns:
bitmask of STATUS_REG_M_BITS_T bits
getAccelerometerStatus
()
Number
return the accelerometer status register
Returns:
bitmask of STATUS_REG_A_BITS_T bits
getGyroscopeInterruptConfig
()
Number
return the gyroscope interrupt config register
Returns:
bitmask of INT1_CFG_G_BITS_T bits
setGyroscopeInterruptConfig
-
enables
set the gyroscope interrupt config register
Parameters:
-
enables
Numberbitmask of INT1_CFG_G_BITS_T values
Returns:
true if successful
getGyroscopeInterruptSrc
()
Number
return the gyroscope interrupt src register
Returns:
bitmask of INT1_SRC_G_BITS_T bits
getMagnetometerInterruptControl
()
Number
return the magnetometer interrupt control register
Returns:
bitmask of INT_CTRL_REG_M_BITS_T bits
setMagnetometerInterruptControl
-
enables
set the magnetometer interrupt control register
Parameters:
-
enables
Numberbitmask of INT_CTRL_REG_M_BITS_T values
Returns:
true if successful
getMagnetometerInterruptSrc
()
Number
return the magnetometer interrupt src register
Returns:
bitmask of INT_SRC_REG_M_BITS_T bits
getInterruptGen1
()
Number
return the inertial interrupt generator 1 register
Returns:
bitmask of INT_GEN_X_REG_BITS_T bits
setInterruptGen1
-
enables
set the inertial interrupt generator 1 register
Parameters:
-
enables
Numberbitmask of INT_GEN_X_REG_BITS_T values
Returns:
true if successful
getInterruptGen1Src
()
Number
return the inertial interrupt generator 1 src register
Returns:
bitmask of INT_GEN_X_SRC_BITS_T bits
getInterruptGen2
()
Number
return the inertial interrupt generator 2 register
Returns:
bitmask of INT_GEN_X_REG_BITS_T bits
setInterruptGen2
-
enables
set the inertial interrupt generator 2 register
Parameters:
-
enables
Numberbitmask of INT_GEN_X_REG_BITS_T values
Returns:
true if successful
getInterruptGen2Src
()
Number
return the inertial interrupt generator 2 src register
Returns:
bitmask of INT_GEN_X_SRC_BITS_T bits
installISR
-
intr
-
gpio
-
level
-
isr
-
arg
install an interrupt handler.
Parameters:
-
intr
INTERRUPT_PINS_Tone of the INTERRUPT_PINS_T values specifying which interrupt pin out of 4 you are installing
-
gpio
Numbergpio pin to use as interrupt pin
-
level
Mraa::Edgethe interrupt trigger level (one of mraa::Edge values). Make sure that you have configured the interrupt pin properly for whatever level you choose.
-
isr
Functionthe interrupt handler, accepting a void * argument
-
arg
Void *the argument to pass the the interrupt handler
uninstallISR
-
intr
uninstall a previously installed interrupt handler
Parameters:
-
intr
INTERRUPT_PINS_Tone of the INTERRUPT_PINS_T values specifying which interrupt pin out of 4 you are uninstalling