1 /*
2  * Copyright (c) 2023 Nanjing Xiaoxiongpai Intelligent Technology 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 ALS_BH1750_H
10 #define ALS_BH1750_H
11 
12 #include "sensor_als_driver.h"
13 #include "sensor_config_parser.h"
14 
15 #define BH1750_TEMP_DATA_BUF_LEN          2
16 #define BH1750_TEMP_VALUE_IDX_ZERO        0
17 #define BH1750_TEMP_VALUE_IDX_ONE         1
18 
19 #define BH1750_TEMP_CONSATNT_1          10000
20 #define BH1750_TEMP_CONSATNT_2          12
21 
22 #define BH1750_CONTINUOUS_H_RES_MODE    0x10
23 #define BH1750_CONTINUOUS_H_RES_MODE2   0x11
24 #define BH1750_CONTINUOUS_L_RES_MODE    0x13
25 #define BH1750_ONE_TIME_H_RES_MODE      0x20
26 #define BH1750_ONE_TIME_H_RES_MODE2     0x21
27 #define BH1750_ONE_TIME_L_RES_MODE      0x23
28 
29 #define BH1750_READ_VALUE_DELAY         180
30 
31 struct BH1750AlsData {
32     int32_t als;
33 };
34 
35 struct Bh1750DrvData {
36     struct IDeviceIoService ioService;
37     struct HdfDeviceObject *device;
38     struct SensorCfgData *sensorCfg;
39 };
40 
41 #endif /* ALS_BH1750_H */
42