bmi160: Fix gyro range map

The range map was sorted wrong since the function
bmi160_range_to_reg_val() that uses it checks for the user value less
than the range component of the bmi160_range struct. This means that
no matter what range is set, the value will always end up 2000dps.

Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
Yuval Peress 2023-11-28 00:02:10 -07:00 committed by Carles Cufí
parent 2d09f1f566
commit c743e72756

View file

@ -303,11 +303,11 @@ static const struct bmi160_range bmi160_acc_range_map[] = {
#define BMI160_ACC_RANGE_MAP_SIZE ARRAY_SIZE(bmi160_acc_range_map)
static const struct bmi160_range bmi160_gyr_range_map[] = {
{2000, BMI160_GYR_RANGE_2000DPS},
{1000, BMI160_GYR_RANGE_1000DPS},
{500, BMI160_GYR_RANGE_500DPS},
{250, BMI160_GYR_RANGE_250DPS},
{125, BMI160_GYR_RANGE_125DPS},
{250, BMI160_GYR_RANGE_250DPS},
{500, BMI160_GYR_RANGE_500DPS},
{1000, BMI160_GYR_RANGE_1000DPS},
{2000, BMI160_GYR_RANGE_2000DPS},
};
#define BMI160_GYR_RANGE_MAP_SIZE ARRAY_SIZE(bmi160_gyr_range_map)