• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include "../sensor_common.hcs"
2root {
3    als_bh1745_chip_config : sensorConfig {
4        match_attr = "hdf_sensor_als_bh1745_driver";
5        sensorInfo :: sensorDeviceInfo {
6            sensorName = "als";
7            vendorName = "rohm_bh1745"; // max string length is 16 bytes
8            sensorTypeId = 5; // enum SensorTypeTag
9            sensorId = 5; // user define sensor id
10            power = 230;
11        }
12        sensorBusConfig :: sensorBusInfo {
13            busType = 0; // 0:i2c 1:spi
14            busNum = 6;
15            busAddr = 0x38;
16            regWidth = 1; // 1byte
17        }
18        sensorIdAttr :: sensorIdInfo {
19            chipName = "bh1745";
20            chipIdRegister = 0x92;
21            chipIdValue = 0xE0;
22        }
23        sensorRegConfig {
24            /*  regAddr: register address
25                value: config register value
26                len: size of value
27                mask: mask of value
28                delay: config register delay time (ms)
29                opsType: enum SensorOpsType 0-none 1-read 2-write 3-read_check 4-update_bit
30                calType: enum SensorBitCalType 0-none 1-set 2-revert 3-xor 4-left shift 5-right shift
31                shiftNum: shift bits
32                debug: 0-no debug 1-debug
33                save: 0-no save 1-save
34            */
35            /* regAddr, value, mask, len, delay, opsType, calType, shiftNum, debug, save */
36            initSeqConfig = [
37                0x40,    0xc0, 0xff,   1,     5,       2,       0,        0,     0,    0,
38                0x42,    0x90, 0xff,   1,     5,       2,       0,        0,     0,    0,
39                0x44,    0x02, 0xff,   1,     5,       2,       0,        0,     0,    0,
40                0x41,    0x01, 0xff,   1,     5,       2,       0,        0,     0,    0
41            ];
42            enableSeqConfig = [
43                0x42,    0x10, 0x10,   1,     5,       4,       0,        0,     0,    0,
44                0x44,    0x02, 0xff,   1,     5,       2,       0,        0,     0,    0
45            ];
46            disableSeqConfig = [
47                0x42,    0x00, 0x10,   1,     5,       4,       0,        0,     0,    0
48            ];
49        }
50
51        extendAlsRegConfig {
52            /* regAddr, value, mask, len, delay, opsType, calType, shiftNum, debug, save */
53            time = [
54                0x41,    0x00, 0x07,   1,     5,       0,       1,        0,     0,    0,  //160msec
55                0x41,    0x01, 0x07,   1,     5,       0,       1,        0,     0,    0,  //320msec
56                0x41,    0x02, 0x07,   1,     5,       0,       1,        0,     0,    0,  //640msec
57                0x41,    0x03, 0x07,   1,     5,       0,       1,        0,     0,    0,  //1280msec
58                0x41,    0x04, 0x07,   1,     5,       0,       1,        0,     0,    0,  //2560msec
59                0x41,    0x05, 0x07,   1,     5,       0,       1,        0,     0,    0,   //5120msec
60            ];
61            gain = [
62                0x42,    0x00, 0x03,   1,     5,       0,       1,        0,     0,    0,  //1X
63                0x42,    0x01, 0x03,   1,     5,       0,       1,        0,     0,    0,  //2X
64                0x42,    0x02, 0x03,   1,     5,       0,       1,        0,     0,    0   //16X
65            ];
66        }
67    }
68}
69