1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2023 Nanjing Xiaoxiongpai Intelligent Technology 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 ALS_BH1750_H
10094332d3Sopenharmony_ci#define ALS_BH1750_H
11094332d3Sopenharmony_ci
12094332d3Sopenharmony_ci#include "sensor_als_driver.h"
13094332d3Sopenharmony_ci#include "sensor_config_parser.h"
14094332d3Sopenharmony_ci
15094332d3Sopenharmony_ci#define BH1750_TEMP_DATA_BUF_LEN          2
16094332d3Sopenharmony_ci#define BH1750_TEMP_VALUE_IDX_ZERO        0
17094332d3Sopenharmony_ci#define BH1750_TEMP_VALUE_IDX_ONE         1
18094332d3Sopenharmony_ci
19094332d3Sopenharmony_ci#define BH1750_TEMP_CONSATNT_1          10000
20094332d3Sopenharmony_ci#define BH1750_TEMP_CONSATNT_2          12
21094332d3Sopenharmony_ci
22094332d3Sopenharmony_ci#define BH1750_CONTINUOUS_H_RES_MODE    0x10
23094332d3Sopenharmony_ci#define BH1750_CONTINUOUS_H_RES_MODE2   0x11
24094332d3Sopenharmony_ci#define BH1750_CONTINUOUS_L_RES_MODE    0x13
25094332d3Sopenharmony_ci#define BH1750_ONE_TIME_H_RES_MODE      0x20
26094332d3Sopenharmony_ci#define BH1750_ONE_TIME_H_RES_MODE2     0x21
27094332d3Sopenharmony_ci#define BH1750_ONE_TIME_L_RES_MODE      0x23
28094332d3Sopenharmony_ci
29094332d3Sopenharmony_ci#define BH1750_READ_VALUE_DELAY         180
30094332d3Sopenharmony_ci
31094332d3Sopenharmony_cistruct BH1750AlsData {
32094332d3Sopenharmony_ci    int32_t als;
33094332d3Sopenharmony_ci};
34094332d3Sopenharmony_ci
35094332d3Sopenharmony_cistruct Bh1750DrvData {
36094332d3Sopenharmony_ci    struct IDeviceIoService ioService;
37094332d3Sopenharmony_ci    struct HdfDeviceObject *device;
38094332d3Sopenharmony_ci    struct SensorCfgData *sensorCfg;
39094332d3Sopenharmony_ci};
40094332d3Sopenharmony_ci
41094332d3Sopenharmony_ci#endif /* ALS_BH1750_H */
42