Simple procedures to sleep and wake-up lsm6dso
Hi, I'm trying to implement sleep and wake-up function in my project. I read the AN5192 Interrupt generation, but doesn't work.
My project use nrf52832 with I2C and init my gyroscope/accelerometer following the procedure below:
write_register(LSM6DS0_CTRL1_XL, 0x60); // Turn on the accelerometer
write_register(LSM6DS0_CTRL2_G, 0x4C); // Turn on the gyroscope
write_register(LSM6DS0_CTRL8_XL, 0x09); // Enable slope filter
My function to sleep:
void imu_power_down()
{
write_register(LSM6DS0_CTRL2_G, 0x00);
write_register(LSM6DS0_CTRL1_XL, 0x00);
}
My function to wake-up
void imu_wake_up_interrupt()
{
write_register(LSM6DS0_WAKE_UP_DUR, 0x00);
write_register(LSM6DS0_WAKE_UP_THS, 0x02);
write_register(LSM6DS0_TAP_CFG0, 0x51);
write_register(LSM6DS0_TAP_CFG2, 0x80);
write_register(LSM6DS0_CTRL1_XL, 0x70);
nrf_delay_ms(4);
write_register(LSM6DS0_CTRL1_XL, 0x10);
write_register(LSM6DS0_MD1_CFG, 0x20);
}
Could someone help me with these functions
Regards
Laerte
