Hi,
Here is sample pseudo code for BMI160 accel any-motion interrupt.
void init_BMI160_ACC(void)
{
// basic configurations
Write value of 0xB6 to register 0x7E; // soft reset BMI160 to default settings. Both accelerometer and gyroscope are in suspend mode
Delay 55ms; // for BMI160 to stabilize
Write value of 0x12 to register 0x7E; // set the accelerometer to LPM mode
Delay 5ms; // for BMI160 accelerometer to stabilize
Write value of 0x86 to register 0x40; // set ODR to 25Hz with no average (14uA), it can be fine tuned.
// interrupt configuration
Write value of 0x0A to register 0x53; // set INT1 as output, active-high, push-pull
Write value of 0x09 to register 0x54; // temporarily latch the interrupt for 80ms
Write value of 0x04 to register 0x55; // route any-motion interrupt to INT1 pin
// any-motion configuration
Write 0x14 to register 0x60; // default value for 78.2mg threshold at +/-2g full scale range, it can be fine tuned
Write 0x00 to register 0x5F; // default value for duration of 1 meaning that as long as there is 1 single slope data which is [a(t+1) - a(t)] is beyond the threshold, any-motion interrupt will be triggered. It can be fine tuned.
// enable any-motion interrupt
Write 0x07 to register 0x50; // enable any-motion interrupt for all 3 axes
}
Thanks.
... View more