si114x_internals.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2018 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef SI114X_INTERNALS_H
21 #define SI114X_INTERNALS_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
30 #define SI114X_ADDR (0x60)
31 
36 #define SI114X_PARAM_QUERY (0x80)
37 #define SI114X_PARAM_SET (0xA0)
38 #define SI114X_NOP (0x00)
39 #define SI114X_RESET (0x01)
40 #define SI114X_BUSADDR (0x02)
41 #define SI114X_PS_FORCE (0x05)
42 #define SI114X_ALS_FORCE (0x06)
43 #define SI114X_PS_ALS_FORCE (0x07)
44 #define SI114X_PS_PAUSE (0x09)
45 #define SI114X_ALS_PAUSE (0x0A)
46 #define SI114X_PS_ALS_PAUSE (0x0B)
47 #define SI114X_PS_AUTO (0x0D)
48 #define SI114X_ALS_AUTO (0x0E)
49 #define SI114X_PS_ALS_AUTO (0x0F)
50 #define SI114X_GET_CAL (0x12)
51 
57 #define SI114X_REG_PART_ID (0x00)
58 #define SI114X_REG_REV_ID (0x01)
59 #define SI114X_REG_SEQ_ID (0x02)
60 #define SI114X_REG_INT_CFG (0x03)
61 #define SI114X_REG_IRQ_ENABLE (0x04)
62 #define SI114X_REG_IRQ_MODE1 (0x05)
63 #define SI114X_REG_IRQ_MODE2 (0x06)
64 #define SI114X_REG_HW_KEY (0x07)
65 #define SI114X_REG_MEAS_RATE0 (0x08)
66 #define SI114X_REG_MEAS_RATE1 (0x09)
67 #define SI114X_REG_PS_LED21 (0x0F)
68 #define SI114X_REG_PS_LED3 (0x10)
69 #define SI114X_REG_UCOEF0 (0x13)
70 #define SI114X_REG_UCOEF1 (0x14)
71 #define SI114X_REG_UCOEF2 (0x15)
72 #define SI114X_REG_UCOEF3 (0x16)
73 #define SI114X_REG_PARAM_WR (0x17)
74 #define SI114X_REG_COMMAND (0x18)
75 #define SI114X_REG_RESPONSE (0x20)
76 #define SI114X_REG_IRQ_STATUS (0x21)
77 #define SI114X_REG_ALS_VIS_DATA0 (0x22)
78 #define SI114X_REG_ALS_VIS_DATA1 (0x23)
79 #define SI114X_REG_ALS_IR_DATA0 (0x24)
80 #define SI114X_REG_ALS_IR_DATA1 (0x25)
81 #define SI114X_REG_PS1_DATA0 (0x26)
82 #define SI114X_REG_PS1_DATA1 (0x27)
83 #define SI114X_REG_PS2_DATA0 (0x28)
84 #define SI114X_REG_PS2_DATA1 (0x29)
85 #define SI114X_REG_PS3_DATA0 (0x2A)
86 #define SI114X_REG_PS3_DATA1 (0x2B)
87 #define SI114X_REG_UV_INDEX0 (0x2C)
88 #define SI114X_REG_UV_INDEX1 (0x2D)
89 #define SI114X_REG_PARAM_RD (0x2E)
90 #define SI114X_REG_CHIP_STAT (0x30)
91 
97 #define SI114X_NO_ERROR (0x00)
98 #define SI114X_INVALID_SETTING (0x80)
99 #define SI114X_PS1_ADC_OVERFLOW (0x88)
100 #define SI114X_PS2_ADC_OVERFLOW (0x89)
101 #define SI114X_PS3_ADC_OVERFLOW (0x8A)
102 #define SI114X_ALS_VIS_ADC_OVERFLOW (0x8C)
103 #define SI114X_ALS_IR_ADC_OVERFLOW (0x8D)
104 #define SI114X_UV_ADC_OVERFLOW (0x8E)
105 
114 #define SI114X_I2C_ADDR (0x00)
115 #define SI114X_PARAM_CHLIST (0x01)
116 #define SI114X_PARAM_CHLIST_ENUV (0x80)
117 #define SI114X_PARAM_CHLIST_ENAUX (0x40)
118 #define SI114X_PARAM_CHLIST_ENALSIR (0x20)
119 #define SI114X_PARAM_CHLIST_ENALSVIS (0x10)
120 #define SI114X_PARAM_CHLIST_ENPS1 (0x01)
121 #define SI114X_PARAM_CHLIST_ENPS2 (0x02)
122 #define SI114X_PARAM_CHLIST_ENPS3 (0x04)
123 #define SI114X_PARAM_PSLED12SEL (0x02)
124 #define SI114X_PARAM_PSLED12SEL_PS2NONE (0x00)
125 #define SI114X_PARAM_PSLED12SEL_PS2LED1 (0x10)
126 #define SI114X_PARAM_PSLED12SEL_PS2LED2 (0x20)
127 #define SI114X_PARAM_PSLED12SEL_PS2LED3 (0x40)
128 #define SI114X_PARAM_PSLED12SEL_PS1NONE (0x00)
129 #define SI114X_PARAM_PSLED12SEL_PS1LED1 (0x01)
130 #define SI114X_PARAM_PSLED12SEL_PS1LED2 (0x02)
131 #define SI114X_PARAM_PSLED12SEL_PS1LED3 (0x04)
132 #define SI114X_PARAM_PSLED3SEL (0x03)
133 #define SI114X_PARAM_PSENCODE (0x05)
134 #define SI114X_PARAM_ALSENCODE (0x06)
135 #define SI114X_PARAM_PS1ADCMUX (0x07)
136 #define SI114X_PARAM_PS2ADCMUX (0x08)
137 #define SI114X_PARAM_PS3ADCMUX (0x09)
138 #define SI114X_PARAM_PSADCOUNTER (0x0A)
139 #define SI114X_PARAM_PSADCGAIN (0x0B)
140 #define SI114X_PARAM_PSADCMISC (0x0C)
141 #define SI114X_PARAM_PSADCMISC_RANGE (0x20)
142 #define SI114X_PARAM_PSADCMISC_PSMODE (0x04)
143 #define SI114X_PARAM_ALSIRADCMUX (0x0E)
144 #define SI114X_PARAM_AUXADCMUX (0x0F)
145 #define SI114X_PARAM_ALSVISADCOUNTER (0x10)
146 #define SI114X_PARAM_ALSVISADCGAIN (0x11)
147 #define SI114X_PARAM_ALSVISADCMISC (0x12)
148 #define SI114X_PARAM_ALSVISADCMISC_VISRANGE (0x20)
149 #define SI114X_PARAM_ALSIRADCOUNTER (0x1D)
150 #define SI114X_PARAM_ALSIRADCGAIN (0x1E)
151 #define SI114X_PARAM_ALSIRADCMISC (0x1F)
152 #define SI114X_PARAM_ALSIRADCMISC_RANGE (0x20)
153 #define SI114X_PARAM_ADCMUX_SMALLIR (0x00)
154 #define SI114X_PARAM_ADCMUX_LARGEIR (0x03)
155 
161 #define SI1145_ID (0x45)
162 #define SI1146_ID (0x46)
163 #define SI1147_ID (0x47)
164 #define SI114X_STARTUP_TIME (25000UL) /* 25ms */
165 #define SI114X_WAIT_10MS (10000UL) /* 10ms */
166 #define SI114X_INIT_VALUE (0x17)
167 #define SI114X_UCOEF0_DEFAULT (0x29)
168 #define SI114X_UCOEF1_DEFAULT (0x89)
169 #define SI114X_UCOEF2_DEFAULT (0x02)
170 #define SI114X_UCOEF3_DEFAULT (0x00)
171 #define SI114X_ADC_REC_CLK (0x70) /* 511 ADC Clock */
172 
178 #define SI114X_EN_UV (0x80)
179 #define SI114X_EN_AUX (0x40)
180 #define SI114X_EN_ALS_IR (0x20)
181 #define SI114X_EN_ALS_VIS (0x10)
182 
183 #define SI114X_EN_PS3_IE (0x10)
184 #define SI114X_EN_PS2_IE (0x08)
185 #define SI114X_EN_PS1_IE (0x04)
186 #define SI114X_EN_ALS_IE (0x01)
187 
188 #define SI114X_INTCFG_INTOE (0x01)
189 #define SI114X_INTCFG_INTMODE (0x02)
190 
191 #define SI114X_PS3_ALIGN (0x40)
192 #define SI114X_PS2_ALIGN (0x20)
193 #define SI114X_PS1_ALIGN (0x10)
194 #define SI114X_ALS_IR_ALIGN (0x20)
195 #define SI114X_ALS_VIS_ALIGN (0x10)
196 #define SI114X_PS_RANGE (0x20)
197 #define SI114X_PS_ADC_MODE (0x04)
198 #define SI114X_VIS_RANGE (0x20)
199 #define SI114X_IR_RANGE (0x20)
200 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif /* SI114X_INTERNALS_H */
207