1 /* 2 * Copyright (c) 2021 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_GRAVITY_DRIVER_H 10 #define SENSOR_GRAVITY_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 #define GRAVITY_TIMER_MIN_TIME 10 18 #define GRAVITY_TIMER_MAX_TIME 20 19 #define GRAVITY_UNITS 100 20 #define GRAVITY_FILTER_UNITS 85 21 enum GravityAxisNum { 22 GRAVITY_X_AXIS = 0, 23 GRAVITY_Y_AXIS = 1, 24 GRAVITY_Z_AXIS = 2, 25 GRAVITY_AXIS_NUM = 3, 26 }; 27 28 struct GravityData { 29 int32_t x; 30 int32_t y; 31 int32_t z; 32 }; 33 34 struct GravityDrvData { 35 struct IDeviceIoService ioService; 36 struct HdfDeviceObject *device; 37 HdfWorkQueue gravityWorkQueue; 38 HdfWork gravityWork; 39 OsalTimer gravityTimer; 40 struct SensorCfgData *gravityCfg; 41 int64_t interval; 42 bool enable; 43 }; 44 45 #endif /* SENSOR_GRAVITY_DRIVER_H */