1 /* 2 * Copyright (c) 2021-2022 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_gyro_driver.h" 13 #include "sensor_config_parser.h" 14 15 /* GYRO DATA REGISTERS ADDR */ 16 #define BMI160_GYRO_X_LSB_ADDR 0X0C 17 #define BMI160_GYRO_X_MSB_ADDR 0X0D 18 #define BMI160_GYRO_Y_LSB_ADDR 0X0E 19 #define BMI160_GYRO_Y_MSB_ADDR 0X0F 20 #define BMI160_GYRO_Z_LSB_ADDR 0X10 21 #define BMI160_GYRO_Z_MSB_ADDR 0X11 22 #define BMI160_STATUS_ADDR 0X1B 23 24 /* GYRO ODR */ 25 #define BMI160_GYRO_ODR_RESERVED 0x00 26 #define BMI160_GYRO_ODR_25HZ 0x06 27 #define BMI160_GYRO_ODR_50HZ 0x07 28 #define BMI160_GYRO_ODR_100HZ 0x08 29 #define BMI160_GYRO_ODR_200HZ 0x09 30 #define BMI160_GYRO_ODR_400HZ 0x0A 31 #define BMI160_GYRO_ODR_800HZ 0x0B 32 #define BMI160_GYRO_ODR_1600HZ 0x0C 33 #define BMI160_GYRO_ODR_3200HZ 0x0D 34 35 /* default HZ */ 36 #define BMI160_GYRO_DEFAULT_ODR_100HZ 100 37 #define BMI160_GYRO_DEFAULT_ODR_25HZ 25 38 39 /* GYRO RANGE */ 40 #define BMI160_GYRO_RANGE_2000DPS 0X00 41 #define BMI160_GYRO_RANGE_1000DPS 0X01 42 #define BMI160_GYRO_RANGE_500DPS 0X02 43 #define BMI160_GYRO_RANGE_250DPS 0X03 44 #define BMI160_GYRO_RANGE_125DPS 0X04 45 46 /* GYRO sensitivity */ 47 #define BMI160_GYRO_SENSITIVITY_2000DPS 61 48 49 /* GYRO DATA READY */ 50 #define BMI160_GYRO_DATA_READY_MASK 0x40 51 52 int32_t DetectGyroBim160Chip(struct SensorCfgData *data); 53 54 struct Bmi160DrvData { 55 struct IDeviceIoService ioService; 56 struct HdfDeviceObject *device; 57 struct SensorCfgData *sensorCfg; 58 }; 59 60 #endif /* GYRO_BMI160_H */ 61