1 /*
2  * Copyright (c) 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 SENSOR_PEDOMETER_DRIVER_H
10 #define SENSOR_PEDOMETER_DRIVER_H
11 
12 #include "hdf_workqueue.h"
13 #include "osal_timer.h"
14 #include "sensor_config_parser.h"
15 #include "sensor_platform_if.h"
16 
17 enum PedometerDataPart {
18     PEDOMETER_NU_LSB = 0,
19     PEDOMETER_NU_MSB = 1,
20     PEDOMETER_BUTT,
21 };
22 
23 struct PedometerData {
24     int32_t pedometer;
25 };
26 
27 struct PedometerOpsCall {
28     int32_t (*Init)(struct SensorCfgData *data);
29     int32_t (*ReadData)(struct SensorCfgData *data);
30 };
31 
32 struct PedometerDrvData {
33     struct IDeviceIoService ioService;
34     struct HdfDeviceObject *device;
35     HdfWorkQueue pedometerWorkQueue;
36     HdfWork pedometerWork;
37     OsalTimer pedometerTimer;
38     bool detectFlag;
39     bool enable;
40     int64_t interval;
41     struct SensorCfgData *pedometerCfg;
42     struct PedometerOpsCall ops;
43 };
44 
45 int32_t PedometerRegisterChipOps(const struct PedometerOpsCall *ops);
46 struct SensorCfgData *PedometerCreateCfgData(const struct DeviceResourceNode *node);
47 void PedometerReleaseCfgData(struct SensorCfgData *pedometerCfg);
48 
49 #endif /* SENSOR_PEDOMETER_DRIVER_H */
50