H3LIS331DL Class
- ID: h3lis331dl
- Name: I2C 3-axis Digital Accelerometer (400g)
- Other Names: Grove 3-Axis Digital Accelerometer (400g)
- Category: accelerometer
- Manufacturer: seeed stmicro
- Link: http://www.seeedstudio.com/depot/Grove-3Axis-Digital-Accelerometer400g-p-1897.html
- Connection: i2c
This is a high-performance, high-range accelerometer for extreme applications.
Item Index
Methods
- H3LIS331DL
- init
- getChipID
- setDataRate
- setPowerMode
- enableAxis
- setFullScale
- setHPCF
- setHPM
- boot
- enableHPF1
- enableHPF2
- enableFDS
- setInterruptActiveLow
- setInterruptOpenDrain
- setInterrupt1Latch
- setInterrupt2Latch
- setInterrupt1PadConfig
- setInterrupt2PadConfig
- enableBDU
- enableBLE
- enableSleepToWake
- getStatus
- setInterrupt1Config
- setInterrupt2Config
- setInterrupt1Source
- setInterrupt2Source
- setInterrupt1Threshold
- setInterrupt2Threshold
- setInterrupt1Duration
- setInterrupt2Duration
- update
- setAdjustmentOffsets
- getAcceleration
- getRawXYZ
- getXYZ
- getAcceleration
- getRawXYZ
- getXYZ
- i2cContext
Properties
- REG_WHOAMI
- REG_REG1
- REG_REG2
- REG_REG3
- REG_REG4
- REG_REG5
- REG_HP_FILTER_RESET
- REG_REFERENCE
- REG_STATUS
- REG_OUT_X_L
- REG_OUT_X_H
- REG_OUT_Y_L
- REG_OUT_Y_H
- REG_OUT_Z_L
- REG_OUT_Z_H
- REG_INT1_CFG
- REG_INT1_SRC
- REG_INT1_THS
- REG_INT1_DUR
- REG_INT2_CFG
- REG_INT2_SRC
- REG_INT2_THS
- REG_INT2_DUR
- REG1_XEN
- REG1_YEN
- REG1_ZEN
- REG1_DR0
- REG1_DR1
- REG1_DR_SHIFT
- REG1_PM0
- REG1_PM1
- REG1_PM2
- REG1_PM_SHIFT
- DR_50_37
- DR_100_74
- DR_400_292
- DR_1000_780
- PM_POWERDWN
- PM_NORMAL
- PM_LP05
- PM_LP1
- PM_LP2
- PM_LP5
- PM_LP10
- REG2_HPCF0
- REG2_HPCF1
- REG2_HPCF_SHIFT
- REG2_HPEN1
- REG2_HPEN2
- REG2_FDS
- REG2_HPM0
- REG2_HPM1
- REG2_HPM_SHIFT
- REG2_BOOT
- HPCF_8
- HPCF_16
- HPCF_32
- HPCF_64
- HPM_NORMAL0
- HPM_REF
- HPM_NORMAL1
- REG3_I1_CFG0
- REG3_I1_CFG1
- REG3_I1_CFG_SHIFT
- REG3_LIR1
- REG3_I2_CFG0
- REG3_I2_CFG1
- REG3_I2_CFG_SHIFT
- REG3_LIR2
- REG3_PP_OD
- REG3_IHL
- I_SRC
- I_OR
- I_DR
- I_BOOTING
- REG4_SIM
- REG4_FS0
- REG4_FS1
- REG4_FS_SHIFT
- REG4_BLE
- REG4_BDU
- FS_100
- FS_200
- FS_400
- REG5_TURNON0
- REG5_TURNON1
- STATUS_XDA
- STATUS_YDA
- STATUS_ZDA
- STATUS_ZYXDA
- STATUS_XOR
- STATUS_YOR
- STATUS_ZOR
- STATUS_ZYXOR
- INT_CFG_XLIE
- INT_CFG_XHIE
- INT_CFG_YLIE
- INT_CFG_YHIE
- INT_CFG_ZLIE
- INT_CFG_ZHIE
- INT_CFG_AOI
- INT_SRC_XL
- INT_SRC_XH
- INT_SRC_YL
- INT_SRC_YH
- INT_SRC_ZL
- INT_SRC_ZH
- INT_SRC_IA
Methods
H3LIS331DL
-
bus
-
address
H3LIS331DL constructor
Parameters:
-
bus
NumberI2C bus to use
-
address
NumberAddress for this device
Returns:
init
-
odr
-
pm
-
fs
Sets up initial values and starts operation
Parameters:
-
odr
DR_BITS_TData rate: one of the DR_BITS_T values
-
pm
PM_BITS_TPower mode: one of the PM_BITS_T values
-
fs
FS_BITS_TFullScale: one of the FS_BITS_T values
Returns:
True if successful
getChipID
()
Number
Reads and returns the chip ID (WHO_AM_I register)
Returns:
True if successful
setDataRate
-
odr
Sets the output data rate
Parameters:
-
odr
DR_BITS_TOne of the DR_BITS_T values
Returns:
True if successful
setPowerMode
-
pm
Sets the power mode
Parameters:
-
pm
PM_BITS_TOne of the PM_BITS_T values
Returns:
True if successful
enableAxis
-
axisEnable
Enables one or more of the 3 axes. The argument is a bitmask composed of REG1_XEN, REG1_YEN, and/or REG1_ZEN corresponding to the axes you want enabled.
Parameters:
-
axisEnable
NumberBitmask of axes to enable (REG1_XEN | REG1_YEN | REG1_ZEN)
Returns:
True if successful
setFullScale
-
fs
Sets the scaling factor to 100g, 200g, or 400g
Parameters:
-
fs
FS_BITS_TOne of the FS_BITS_T values
Returns:
True if successful
setHPCF
-
val
Sets a high-pass cutoff filter
Parameters:
-
val
HPCF_BITS_TOne of the HPCF_BITS_T values
Returns:
True if successful
setHPM
-
val
Sets a high-pass filter mode
Parameters:
-
val
HPM_BITS_TOne of the HPM_BITS_T values
Returns:
True if successful
boot
()
Boolean
Boots the device. Booting the device causes internal flash calibration values to be reloaded into the visible registers in case they have been corrupted. This function returns when the booting is complete.
Returns:
True if successful
enableHPF1
-
enable
Enables a high-pass filter for interrupt 1 source
Parameters:
-
enable
BooleanTrue to enable the filter, false otherwise
Returns:
True if successful
enableHPF2
-
enable
Enables a high-pass filter for interrupt 2 source
Parameters:
-
enable
BooleanTrue to enable the filter, false otherwise
Returns:
True if successful
enableFDS
-
enable
Enables filtered data selection
Parameters:
-
enable
BooleanTrue to enable, false otherwise
Returns:
True if successful
setInterruptActiveLow
-
enable
Sets interrupts to be active low instead of high
Parameters:
-
enable
BooleanTrue to enable, false otherwise
Returns:
True if successful
setInterruptOpenDrain
-
enable
Sets an interrupt output mode to open drain rather than push/pull
Parameters:
-
enable
BooleanTrue to enable, false otherwise
Returns:
True if successful
setInterrupt1Latch
-
enable
Enables interrupt 1 latch
Parameters:
-
enable
BooleanTrue to enable, false otherwise
Returns:
True if successful
setInterrupt2Latch
-
enable
Enables interrupt 2 latch
Parameters:
-
enable
BooleanTrue to enable, false otherwise
Returns:
True if successful
setInterrupt1PadConfig
-
val
Sets the interrupt 1 pad configuration
Parameters:
-
val
I_CFG_BITS_TOne fo the I_CFG_BITS_T values
Returns:
True if successful
setInterrupt2PadConfig
-
val
Sets the interrupt 2 pad configuration
Parameters:
-
val
I_CFG_BITS_TOne fo the I_CFG_BITS_T values
Returns:
True if successful
enableBDU
-
enable
Enables block data update. When enabled, low/high output registers are not updated until both low and high values have been read.
Parameters:
-
enable
BooleanTrue to enable, false otherwise
Returns:
True if successful
enableBLE
-
enable
Enables big-endian output for 16b reads
Parameters:
-
enable
BooleanTrue to enable, false otherwise
Returns:
True if successful
enableSleepToWake
-
enable
Enables sleep-to-wake functionality
Parameters:
-
enable
BooleanTrue to enable, false otherwise
Returns:
True if successful
getStatus
()
Number
Returns the contents of the REG_STATUS register
Returns:
Contents of the REG_STATUS register
setInterrupt1Config
-
val
Sets up the interrupt 1 config register
Parameters:
-
val
NumberBitmask of desired INT_CFG_BITS_T bits
Returns:
True if successful
setInterrupt2Config
-
val
Sets up the interrupt 2 config register
Parameters:
-
val
NumberBitmask of desired INT_CFG_BITS_T bits
Returns:
True if successful
setInterrupt1Source
-
val
Sets up the interrupt 1 source register
Parameters:
-
val
NumberBitmask of desired INT_SRC_BITS_T bits
Returns:
True if successful
setInterrupt2Source
-
val
Sets up the interrupt 2 source register
Parameters:
-
val
NumberBitmask of desired INT_SRC_BITS_T bits
Returns:
True if successful
setInterrupt1Threshold
-
val
Sets up the interrupt 1 threshold register
Parameters:
-
val
NumberThreshold to set
Returns:
True if successful
setInterrupt2Threshold
-
val
Sets up the interrupt 2 threshold register
Parameters:
-
val
NumberThreshold to set
Returns:
True if successful
setInterrupt1Duration
-
val
Sets up the interrupt 1 duration register
Parameters:
-
val
NumberDuration to set
Returns:
True if successful
setInterrupt2Duration
-
val
Sets up the interrupt 2 duration register
Parameters:
-
val
NumberDuration to set
Returns:
True if successful
update
()
Reads the sensor and stores current values internally
setAdjustmentOffsets
-
adjX
-
adjY
-
adjZ
Sets adjustment offsets for each of the axes. This can be used for calibration. The values supplied here are subtracted from the axis data read from the device.
Parameters:
-
adjX
NumberAmount by which to correct the X-axis measurement
-
adjY
NumberAmount by which to correct the Y-axis measurement
-
adjZ
NumberAmount by which to correct the Z-axis measurement
getAcceleration
-
aX
-
aY
-
aZ
Gets acceleration values for each of the axes
Parameters:
-
aX
Float *Returned X-axis acceleration
-
aY
Float *Returned Y-axis acceleration
-
aZ
Float *Returned Z-axis acceleration
getRawXYZ
-
x
-
y
-
z
Gets raw axis values
Parameters:
-
x
Int *Returned raw X-axis value
-
y
Int *Returned raw Y-axis value
-
z
Int *Returned raw Z-axis value
getXYZ
-
x
-
y
-
z
Gets adjusted axis values
Parameters:
-
x
Int *Returned X-axis value
-
y
Int *Returned Y-axis value
-
z
Int *Returned Z-axis value
getAcceleration
()
Std::vector float
Gets acceleration values for each of the axes
Returns:
std::vector containing X, Y, Z acceleration values
getRawXYZ
()
Std::vector int
Gets raw axis values
Returns:
std::vector containing X, Y, Z raw values
getXYZ
()
Std::vector int
Gets adjusted axis values
Returns:
std::vector containing X, Y, Z adjusted axis values
i2cContext
()
Mraa::I2c *
Provides public access to the MRAA I2C context of the class for direct user access
Returns:
Reference to the class I2C context