• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_MXC6655XA_H
10 #define ACCEL_MXC6655XA_H
11 
12 #include "sensor_accel_driver.h"
13 #include "sensor_config_parser.h"
14 
15 /* ACCEL DATA REGISTERS ADDR */
16 #define MXC6655XA_ACCEL_X_MSB_ADDR              0X03
17 #define MXC6655XA_ACCEL_X_LSB_ADDR              0X04
18 #define MXC6655XA_ACCEL_Y_MSB_ADDR              0X05
19 #define MXC6655XA_ACCEL_Y_LSB_ADDR              0X06
20 #define MXC6655XA_ACCEL_Z_MSB_ADDR              0X07
21 #define MXC6655XA_ACCEL_Z_LSB_ADDR              0X08
22 #define MXC6655XA_STATUS_ADDR                   0X02
23 
24 /* default HZ */
25 #define MXC6655XA_ACCEL_DEFAULT_ODR_100HZ       100
26 #define MXC6655XA_ACCEL_DEFAULT_ODR_25HZ        25
27 
28 /* ACCEL RANGE */
29 #define MXC6655XA_ACCEL_RANGE_2G                0X03
30 #define MXC6655XA_ACCEL_RANGE_4G                0X05
31 #define MXC6655XA_ACCEL_RANGE_8G                0X08
32 #define MXC6655XA_ACCEL_RANGE_16G               0X0C
33 
34 /* ACC sensitivity */
35 #define MXC6655XA_ACC_SENSITIVITY_2G            61
36 #define MXC6655XA_ACC_SENSITIVITY_4G            122
37 #define MXC6655XA_ACC_SENSITIVITY_8G            244
38 #define MXC6655XA_ACC_SENSITIVITY_16G           488
39 
40 /* ACCEL DATA READY */
41 #define MXC6655XA_ACCEL_DATA_READY_MASK         0x80
42 
43 int32_t ReadMxc6655xaData(struct SensorCfgData *cfg, struct SensorReportEvent *event);
44 struct Mxc6655xaDrvData {
45     struct IDeviceIoService ioService;
46     struct HdfDeviceObject *device;
47     struct SensorCfgData *sensorCfg;
48 };
49 
50 #endif /* ACCEL_MXC6655XA_H */
51