@@ -45,43 +45,46 @@ int LSM6DSV::begin(SensorDevice* dev) {
4545 // Autoincrement register address when doing block SPI reads and update continuously
4646 dev->writeReg (LSM6DSV_CTRL3, LSM6DSV_CTRL3_IF_INC | LSM6DSV_CTRL3_BDU); /* BDU bit need to be set*/
4747
48- // Select high-accuracy ODR mode 1
48+ // Select high-accuracy ODR mode 1 - 0x62 = 0x01
49+ // Note: HAODR mode has to be enabled / disabled when the device is in power-down mode.
4950 dev->writeReg (LSM6DSV_HAODR_CFG,
5051 LSM6DSV_ENCODE_BITS (LSM6DSV_HAODR_MODE1,
5152 LSM6DSV_HAODR_CFG_HAODR_SEL_MASK,
5253 LSM6DSV_HAODR_CFG_HAODR_SEL_SHIFT));
5354
54- // Enable the accelerometer in high accuracy
55+ // Enable the accelerometer in high accuracy - 0x10 = 0x10
56+ // Note: HAODR mode has to be enabled / disabled when the device is in power-down mode.
5557 dev->writeReg (LSM6DSV_CTRL1,
5658 LSM6DSV_ENCODE_BITS (LSM6DSV_CTRL1_OP_MODE_XL_HIGH_ACCURACY,
5759 LSM6DSV_CTRL1_OP_MODE_XL_MASK,
5860 LSM6DSV_CTRL1_OP_MODE_XL_SHIFT));
5961
60- // Enable the gyro in high accuracy
62+ // Enable the gyro in high accuracy - 0x11 = 0x10
63+ // Note: HAODR mode has to be enabled / disabled when the device is in power-down mode.
6164 dev->writeReg (LSM6DSV_CTRL2,
6265 LSM6DSV_ENCODE_BITS (LSM6DSV_CTRL2_OP_MODE_G_HIGH_ACCURACY,
6366 LSM6DSV_CTRL2_OP_MODE_G_MASK,
6467 LSM6DSV_CTRL2_OP_MODE_G_SHIFT));
6568
66- // Enable 16G sensitivity
69+ // Enable 16G sensitivity - 0x17 = 0x03
6770 dev->writeReg (LSM6DSV_CTRL8,
6871 LSM6DSV_ENCODE_BITS (LSM6DSV_CTRL8_FS_XL_16G,
6972 LSM6DSV_CTRL8_FS_XL_MASK,
7073 LSM6DSV_CTRL8_FS_XL_SHIFT));
7174
72- // Enable the accelerometer odr at 1kHz
75+ // Enable the accelerometer odr at 1kHz - 0x10 = 0x09
7376 dev->writeReg (LSM6DSV_CTRL1,
7477 LSM6DSV_ENCODE_BITS (LSM6DSV_CTRL1_ODR_XL_1000HZ,
7578 LSM6DSV_CTRL1_ODR_XL_MASK,
7679 LSM6DSV_CTRL1_ODR_XL_SHIFT));
7780
78- // Enable the gyro odr at 1kHz
81+ // Enable the gyro odr at 1kHz - 0x11 = 0x09
7982 dev->writeReg (LSM6DSV_CTRL2,
8083 LSM6DSV_ENCODE_BITS (LSM6DSV_CTRL2_ODR_G_1000HZ,
8184 LSM6DSV_CTRL2_ODR_G_MASK,
8285 LSM6DSV_CTRL2_ODR_G_SHIFT));
8386
84- // Set the LPF1 filter bandwidth - Enable 2000 deg/s sensitivity and selected LPF1 filter setting
87+ // Set the LPF1 filter bandwidth - Enable 2000 deg/s sensitivity and selected LPF1 filter setting - 0x15 = 0x04
8588/* filter options
8689 [LPF_NORMAL] = LSM6DSV_CTRL6_FS_G_BW_288HZ,
8790 [LPF_OPTION_1] = LSM6DSV_CTRL6_FS_G_BW_157HZ,
@@ -96,13 +99,13 @@ int LSM6DSV::begin(SensorDevice* dev) {
9699 LSM6DSV_CTRL6_FS_G_MASK,
97100 LSM6DSV_CTRL6_FS_G_SHIFT));
98101
99- // Enable the gyro digital LPF1 filter
102+ // Enable the gyro digital LPF1 filter - 0x16 = 0x01
100103 dev->writeReg (LSM6DSV_CTRL7, LSM6DSV_CTRL7_LPF1_G_EN);
101104
102- // Generate pulse on interrupt line, not requiring a read to clear
105+ // Generate pulse on interrupt line, not requiring a read to clear - 0x13 = 0x02
103106 dev->writeReg (LSM6DSV_CTRL4, LSM6DSV_CTRL4_DRDY_PULSED);
104107
105- // Enable the INT1 output to interrupt when new gyro data is ready
108+ // Enable the INT1 output to interrupt when new gyro data is ready - 0x0D = 0x02
106109 dev->writeReg (LSM6DSV_INT1_CTRL, LSM6DSV_INT1_CTRL_INT1_DRDY_G);
107110
108111 // Set full speed
@@ -112,5 +115,5 @@ int LSM6DSV::begin(SensorDevice* dev) {
112115}
113116
114117void LSM6DSV::readraw (int16_t *raw) {
115- dev->readRegs (LSM6DSV_OUTX_L_G, (uint8_t *)raw, 12 ); // ax,ay,az, gx,gy,gz little endian, no byte juggling needed for RP2,ESP32,STM32
118+ dev->readRegs (LSM6DSV_OUTX_L_G, (uint8_t *)raw, 12 ); // reg 0x22 - gx,gy,gz,ax,ay,az little endian, no byte juggling needed for RP2,ESP32,STM32
116119}
0 commit comments