1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3094332d3Sopenharmony_ci *
4094332d3Sopenharmony_ci * HDF is dual licensed: you can use it either under the terms of
5094332d3Sopenharmony_ci * the GPL, or the BSD license, at your option.
6094332d3Sopenharmony_ci * See the LICENSE file in the root of this repository for complete details.
7094332d3Sopenharmony_ci */
8094332d3Sopenharmony_ci
9094332d3Sopenharmony_ci#ifndef GYRO_BMI160_H
10094332d3Sopenharmony_ci#define GYRO_BMI160_H
11094332d3Sopenharmony_ci
12094332d3Sopenharmony_ci#include "sensor_gyro_driver.h"
13094332d3Sopenharmony_ci#include "sensor_config_parser.h"
14094332d3Sopenharmony_ci
15094332d3Sopenharmony_ci/* GYRO DATA REGISTERS ADDR */
16094332d3Sopenharmony_ci#define BMI160_GYRO_X_LSB_ADDR              0X0C
17094332d3Sopenharmony_ci#define BMI160_GYRO_X_MSB_ADDR              0X0D
18094332d3Sopenharmony_ci#define BMI160_GYRO_Y_LSB_ADDR              0X0E
19094332d3Sopenharmony_ci#define BMI160_GYRO_Y_MSB_ADDR              0X0F
20094332d3Sopenharmony_ci#define BMI160_GYRO_Z_LSB_ADDR              0X10
21094332d3Sopenharmony_ci#define BMI160_GYRO_Z_MSB_ADDR              0X11
22094332d3Sopenharmony_ci#define BMI160_STATUS_ADDR                  0X1B
23094332d3Sopenharmony_ci
24094332d3Sopenharmony_ci/* GYRO ODR */
25094332d3Sopenharmony_ci#define BMI160_GYRO_ODR_RESERVED            0x00
26094332d3Sopenharmony_ci#define BMI160_GYRO_ODR_25HZ                0x06
27094332d3Sopenharmony_ci#define BMI160_GYRO_ODR_50HZ                0x07
28094332d3Sopenharmony_ci#define BMI160_GYRO_ODR_100HZ               0x08
29094332d3Sopenharmony_ci#define BMI160_GYRO_ODR_200HZ               0x09
30094332d3Sopenharmony_ci#define BMI160_GYRO_ODR_400HZ               0x0A
31094332d3Sopenharmony_ci#define BMI160_GYRO_ODR_800HZ               0x0B
32094332d3Sopenharmony_ci#define BMI160_GYRO_ODR_1600HZ              0x0C
33094332d3Sopenharmony_ci#define BMI160_GYRO_ODR_3200HZ              0x0D
34094332d3Sopenharmony_ci
35094332d3Sopenharmony_ci/* default HZ */
36094332d3Sopenharmony_ci#define BMI160_GYRO_DEFAULT_ODR_100HZ       100
37094332d3Sopenharmony_ci#define BMI160_GYRO_DEFAULT_ODR_25HZ        25
38094332d3Sopenharmony_ci
39094332d3Sopenharmony_ci/* GYRO RANGE */
40094332d3Sopenharmony_ci#define BMI160_GYRO_RANGE_2000DPS           0X00
41094332d3Sopenharmony_ci#define BMI160_GYRO_RANGE_1000DPS           0X01
42094332d3Sopenharmony_ci#define BMI160_GYRO_RANGE_500DPS            0X02
43094332d3Sopenharmony_ci#define BMI160_GYRO_RANGE_250DPS            0X03
44094332d3Sopenharmony_ci#define BMI160_GYRO_RANGE_125DPS            0X04
45094332d3Sopenharmony_ci
46094332d3Sopenharmony_ci/* GYRO sensitivity */
47094332d3Sopenharmony_ci#define BMI160_GYRO_SENSITIVITY_2000DPS       61
48094332d3Sopenharmony_ci
49094332d3Sopenharmony_ci/* GYRO DATA READY */
50094332d3Sopenharmony_ci#define BMI160_GYRO_DATA_READY_MASK         0x40
51094332d3Sopenharmony_ci
52094332d3Sopenharmony_ciint32_t DetectGyroBim160Chip(struct SensorCfgData *data);
53094332d3Sopenharmony_ci
54094332d3Sopenharmony_cistruct Bmi160DrvData {
55094332d3Sopenharmony_ci    struct IDeviceIoService ioService;
56094332d3Sopenharmony_ci    struct HdfDeviceObject *device;
57094332d3Sopenharmony_ci    struct SensorCfgData *sensorCfg;
58094332d3Sopenharmony_ci};
59094332d3Sopenharmony_ci
60094332d3Sopenharmony_ci#endif /* GYRO_BMI160_H */
61