1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef GYRO_BMI160_H 10 #define GYRO_BMI160_H 11 12 #include "sensor_config_parser.h" 13 14 /* GYRO DATA REGISTERS ADDR */ 15 #define BMI160_GYRO_X_LSB_ADDR 0X0C 16 #define BMI160_GYRO_X_MSB_ADDR 0X0D 17 #define BMI160_GYRO_Y_LSB_ADDR 0X0E 18 #define BMI160_GYRO_Y_MSB_ADDR 0X0F 19 #define BMI160_GYRO_Z_LSB_ADDR 0X10 20 #define BMI160_GYRO_Z_MSB_ADDR 0X11 21 #define BMI160_STATUS_ADDR 0X1B 22 23 /* GYRO ODR */ 24 #define BMI160_GYRO_ODR_RESERVED 0x00 25 #define BMI160_GYRO_ODR_25HZ 0x06 26 #define BMI160_GYRO_ODR_50HZ 0x07 27 #define BMI160_GYRO_ODR_100HZ 0x08 28 #define BMI160_GYRO_ODR_200HZ 0x09 29 #define BMI160_GYRO_ODR_400HZ 0x0A 30 #define BMI160_GYRO_ODR_800HZ 0x0B 31 #define BMI160_GYRO_ODR_1600HZ 0x0C 32 #define BMI160_GYRO_ODR_3200HZ 0x0D 33 34 /* default HZ */ 35 #define BMI160_GYRO_DEFAULT_ODR_100HZ 100 36 #define BMI160_GYRO_DEFAULT_ODR_25HZ 25 37 38 /* GYRO RANGE */ 39 #define BMI160_GYRO_RANGE_2000DPS 0X00 40 #define BMI160_GYRO_RANGE_1000DPS 0X01 41 #define BMI160_GYRO_RANGE_500DPS 0X02 42 #define BMI160_GYRO_RANGE_250DPS 0X03 43 #define BMI160_GYRO_RANGE_125DPS 0X04 44 45 /* GYRO sensitivity */ 46 #define BMI160_GYRO_SENSITIVITY_2000DPS 61 47 48 /* GYRO DATA READY */ 49 #define BMI160_GYRO_DATA_READY_MASK 0x40 50 51 int32_t DetectGyroBim160Chip(struct SensorCfgData *data); 52 int32_t ReadBmi160Data(struct SensorCfgData *data); 53 54 #endif /* GYRO_BMI160_H */ 55