/* This API configure the duration and threshold of any-motion interrupt.  */
static int8_t config_any_dur_threshold(const struct bmi160_acc_any_mot_int_cfg *any_motion_int_cfg, const struct bmi160_dev *dev)
/* This API configure the duration and threshold of any-motion interrupt.  */
static int8_t config_any_dur_threshold(const struct bmi160_acc_any_mot_int_cfg *any_motion_int_cfg, const struct bmi160_dev *dev)
{
    int8_t rslt;
    uint8_t data = 0;
    uint8_t temp = 0;
    uint8_t data_array[2] = { 0 };
    uint8_t dur;
    rslt = bmi160_get_regs(BMI160_INT_MOTION_0_ADDR, &data, 1, dev);
    if (rslt == BMI160_OK)
    {
        dur = (uint8_t)any_motion_int_cfg->anymotion_dur;
        temp = data & ~BMI160_SLOPE_INT_DUR_MASK;
        data = temp | (dur & BMI160_MOTION_SRC_INT_MASK);
        data_array[0] = data;
        data_array[1] = any_motion_int_cfg->anymotion_thr;
        rslt = bmi160_set_regs(BMI160_INT_MOTION_0_ADDR, data_array, 2, dev);
    }
    return rslt;
}