Hi elandau1260 There are also some other interrupts available for BMI160. You can find them on pg 4 of the datasheet. Maybe it is also useful for you the Significant Motion interrupt and the Slow Motion alert. By the way the Any Motion and Significant motion interrupts have a thershold that you can to set. I will share my configuration for both interrupts that might be usefull for you. void anyMotionInt_set(struct bmi160_dev *dev) {
int8_t rslt = 0;
int_config.int_channel = BMI160_INT_CHANNEL_1; // na - Select the interrupt channel
int_config.int_type = BMI160_ACC_ANY_MOTION_INT; // na - choosing Any Motion Interrupt
// na - the following configuration is written to registers (0x53) INT_OUT_CTRL & (0x54) INT_LATCH see datasheet pg71 section 2.11.20
int_config.int_pin_settg.output_en = BMI160_ENABLE; // na - Enabling interrupt pin as output -> register (0x53)
int_config.int_pin_settg.output_mode = BMI160_DISABLE; // na - Selecting push-pull mode for interrupt pin -> register (0x53)
int_config.int_pin_settg.output_type = BMI160_ENABLE; // na - Setting interrupt pin to active high -> register (0x53)
int_config.int_pin_settg.edge_ctrl = BMI160_ENABLE; // na - Enabling edge trigger -> register (0x53)
int_config.int_pin_settg.input_en = BMI160_DISABLE; // na - Disabling interrupt pin to act as input -> register (0x54)
int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_2_56_SEC; // na - non-latched output -> register (0x54)
// na - Select the Any Motion Interrupt parameter
int_config.int_type_cfg.acc_any_motion_int.anymotion_en = BMI160_ENABLE; // na - 1- Enable the any-motion, 0- disable any-motion
int_config.int_type_cfg.acc_any_motion_int.anymotion_x = BMI160_ENABLE; // na - Enabling x-axis for any motion interrupt - monitor x axis
int_config.int_type_cfg.acc_any_motion_int.anymotion_y = BMI160_ENABLE; // na - Enabling y-axis for any motion interrupt - monitor y axis
int_config.int_type_cfg.acc_any_motion_int.anymotion_z = BMI160_ENABLE; // na - Enabling z-axis for any motion interrupt - monitor z axis
int_config.int_type_cfg.acc_any_motion_int.anymotion_dur = 3; // na - any-motion duration. This is the consecutive datapoints -> see datasheet pg32 section 2.6.1 <int_anym_dur> and pg78
int_config.int_type_cfg.acc_any_motion_int.anymotion_thr = 10; // na - An interrupt will be generated if the absolute value of two consecutive accelarion signal exceeds the threshold value -> see datasheet pg32 section 2.6.1 <int_anym_th> and pg78 INT_MOTION[1]
// na - (2-g range) -> (anymotion_thr) * 3.91 mg, (4-g range) -> (anymotion_thr) * 7.81 mg, (8-g range) ->(anymotion_thr) * 15.63 mg, (16-g range) -> (anymotion_thr) * 31.25 mg
rslt = bmi160_set_int_config(&int_config, dev); // na - Set Any-motion interrupt
//printf("rslt: %d", rslt);
if (rslt != BMI160_OK) {
//printf("BMI160 Any-motion interrupt configuration failure!\n");
} else {
//printf("BMI160 Any-motion interrupt configuration done!\n");
}
}
void significantMotionInt_set(struct bmi160_dev *dev) {
int8_t rslt = 0;
int_config.int_channel = BMI160_INT_CHANNEL_1; // na - Select the interrupt channel
int_config.int_type = BMI160_ACC_SIG_MOTION_INT; // na - choosing Any Motion Interrupt
// na - the following configuration is written to registers (0x53) INT_OUT_CTRL & (0x54) INT_LATCH see datasheet pg71 section 2.11.20
int_config.int_pin_settg.output_en = BMI160_ENABLE; // na - Enabling interrupt pin as output -> register (0x53)
int_config.int_pin_settg.output_mode = BMI160_DISABLE; // na - Selecting push-pull mode for interrupt pin -> register (0x53)
int_config.int_pin_settg.output_type = BMI160_ENABLE; // na - Setting interrupt pin to active HIGH -> register (0x53)
int_config.int_pin_settg.edge_ctrl = BMI160_ENABLE; // na - Enabling edge trigger -> register (0x53)
int_config.int_pin_settg.input_en = BMI160_DISABLE; // na - Disabling interrupt pin to act as input -> register (0x54)
int_config.int_pin_settg.latch_dur = BMI160_LATCH_DUR_NONE; // na - non-latched output -> register (0x54)
int_config.int_type_cfg.acc_sig_motion_int.sig_en = BMI160_ENABLE; // na - 1: Significant motion, 0: Any-motion (datasheet pg79 -> <int_sig_mot_sel>)
int_config.int_type_cfg.acc_sig_motion_int.sig_mot_skip = 1; // na - skip time of sig-motion interrupt (datasheet pg34) - sleep for sig_mot_skip - available options: 0= 1.28s, 1= 2.56s, 2= 5.12s, 3=10.24s (datasheet pg34 -> <t_skip>)
int_config.int_type_cfg.acc_sig_motion_int.sig_mot_proof = 2; // na - proof time of sig-motion interrupt (datasheet pg34) - motion detected within sig_mot_proof - available options: 0= 0.24s, 1= 0.48s, 2=0.96s, 3= 1.92s (datasheet pg34 -> <t_proof>)
int_config.int_type_cfg.acc_sig_motion_int.sig_mot_thres = 20; // na - same as anymotion_thr (see the anymotion interrupt)
rslt = bmi160_set_int_config(&int_config, dev); // na - Set Any-motion interrupt
//printf("rslt: %d", rslt);
if (rslt != BMI160_OK) {
//printf("BMI160 Significant motion interrupt configuration failure!\n");
} else {
//printf("BMI160 Significant motion interrupt configuration done!\n");
}
} Hope that helps Nick
... View more