/* This API sets the flat interrupt of the sensor.This interrupt occurs in case of flat orientation.  */
static int8_t set_accel_flat_detect_int(struct bmi160_int_settg *int_config, const struct bmi160_dev *dev)
/* This API sets the flat interrupt of the sensor.This interrupt occurs in case of flat orientation.  */
static int8_t set_accel_flat_detect_int(struct bmi160_int_settg *int_config, const struct bmi160_dev *dev)
{
    int8_t rslt;
    rslt = null_ptr_check(dev);
    if ((rslt != BMI160_OK) || (int_config == NULL))
    {
        rslt = BMI160_E_NULL_PTR;
    }
    else
    {
        struct bmi160_acc_flat_detect_int_cfg *flat_detect_int = &(int_config->int_type_cfg.acc_flat_int);
        rslt = enable_flat_int(flat_detect_int, dev);
        if (rslt == BMI160_OK)
        {
            rslt = set_intr_pin_config(int_config, dev);
            if (rslt == BMI160_OK)
            {
                rslt = map_feature_interrupt(int_config, dev);
                if (rslt == BMI160_OK)
                {
                    rslt = config_flat_int_settg(flat_detect_int, dev);
                }
            }
        }
    }
    return rslt;
}