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 ACCEL_BMI160_H 10 #define ACCEL_BMI160_H 11 12 #include "sensor_accel_driver.h" 13 #include "sensor_config_parser.h" 14 15 /* ACCEL DATA REGISTERS ADDR */ 16 #define BMI160_ACCEL_X_LSB_ADDR 0X12 17 #define BMI160_ACCEL_X_MSB_ADDR 0X13 18 #define BMI160_ACCEL_Y_LSB_ADDR 0X14 19 #define BMI160_ACCEL_Y_MSB_ADDR 0X15 20 #define BMI160_ACCEL_Z_LSB_ADDR 0X16 21 #define BMI160_ACCEL_Z_MSB_ADDR 0X17 22 #define BMI160_STATUS_ADDR 0X1B 23 24 /* ACCEL ODR */ 25 #define BMI160_ACCEL_ODR_RESERVED 0x00 26 #define BMI160_ACCEL_ODR_0_78HZ 0x01 27 #define BMI160_ACCEL_ODR_1_56HZ 0x02 28 #define BMI160_ACCEL_ODR_3_12HZ 0x03 29 #define BMI160_ACCEL_ODR_6_25HZ 0x04 30 #define BMI160_ACCEL_ODR_12_5HZ 0x05 31 #define BMI160_ACCEL_ODR_25HZ 0x06 32 #define BMI160_ACCEL_ODR_50HZ 0x07 33 #define BMI160_ACCEL_ODR_100HZ 0x08 34 #define BMI160_ACCEL_ODR_200HZ 0x09 35 #define BMI160_ACCEL_ODR_400HZ 0x0A 36 #define BMI160_ACCEL_ODR_800HZ 0x0B 37 #define BMI160_ACCEL_ODR_1600HZ 0x0C 38 #define BMI160_ACCEL_ODR_RESERVED0 0x0D 39 #define BMI160_ACCEL_ODR_RESERVED1 0x0E 40 #define BMI160_ACCEL_ODR_RESERVED2 0x0F 41 42 /* default HZ */ 43 #define BMI160_ACCEL_DEFAULT_ODR_100HZ 100 44 #define BMI160_ACCEL_DEFAULT_ODR_25HZ 25 45 46 /* ACCEL RANGE */ 47 #define BMI160_ACCEL_RANGE_2G 0X03 48 #define BMI160_ACCEL_RANGE_4G 0X05 49 #define BMI160_ACCEL_RANGE_8G 0X08 50 #define BMI160_ACCEL_RANGE_16G 0X0C 51 52 /* ACC sensitivity */ 53 #define BMI160_ACC_SENSITIVITY_2G 61 54 #define BMI160_ACC_SENSITIVITY_4G 122 55 #define BMI160_ACC_SENSITIVITY_8G 244 56 #define BMI160_ACC_SENSITIVITY_16G 488 57 58 /* ACCEL DATA READY */ 59 #define BMI160_ACCEL_DATA_READY_MASK 0x80 60 61 int32_t DetectAccelBim160Chip(struct SensorCfgData *data); 62 63 struct Bmi160DrvData { 64 struct IDeviceIoService ioService; 65 struct HdfDeviceObject *device; 66 struct SensorCfgData *sensorCfg; 67 }; 68 69 #endif /* ACCEL_BMI160_H */ 70