/* This function gets the gyro ODR according to HZ */
static uint8_t drv_gyro_bosch_bmi160_hz2odr(uint32_t hz)
/* This function gets the gyro ODR according to HZ */
static uint8_t drv_gyro_bosch_bmi160_hz2odr(uint32_t hz)
{
    if(hz > 1600)
        return BMI160_GYRO_OUTPUT_DATA_RATE_3200HZ;
    else if(hz > 800)
        return BMI160_GYRO_OUTPUT_DATA_RATE_1600HZ;
    else if(hz > 400)
        return BMI160_GYRO_OUTPUT_DATA_RATE_800HZ;
    else if(hz > 200)
        return BMI160_GYRO_OUTPUT_DATA_RATE_400HZ;
    else if(hz > 100)
        return BMI160_GYRO_OUTPUT_DATA_RATE_200HZ;
    else if(hz > 50)
        return BMI160_GYRO_OUTPUT_DATA_RATE_100HZ;
    else if(hz > 25)
        return BMI160_GYRO_OUTPUT_DATA_RATE_50HZ;
    else
        return BMI160_GYRO_OUTPUT_DATA_RATE_25HZ;
}