Go to the documentation of this file.
28 #ifndef LIGHTRANGER9_H
29 #define LIGHTRANGER9_H
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
60 #define LIGHTRANGER9_REG_APPID 0x00
61 #define LIGHTRANGER9_REG_MINOR 0x01
62 #define LIGHTRANGER9_REG_ENABLE 0xE0
63 #define LIGHTRANGER9_REG_INT_STATUS 0xE1
64 #define LIGHTRANGER9_REG_INT_ENAB 0xE2
65 #define LIGHTRANGER9_REG_ID 0xE3
66 #define LIGHTRANGER9_REG_REVID 0xE4
73 #define LIGHTRANGER9_REG_PATCH 0x02
74 #define LIGHTRANGER9_REG_BUILD_TYPE 0x03
75 #define LIGHTRANGER9_REG_APPLICATION_STATUS 0x04
76 #define LIGHTRANGER9_REG_MEASURE_STATUS 0x05
77 #define LIGHTRANGER9_REG_ALGORITHM_STATUS 0x06
78 #define LIGHTRANGER9_REG_CALIBRATION_STATUS 0x07
79 #define LIGHTRANGER9_REG_CMD_STAT 0x08
80 #define LIGHTRANGER9_REG_PREV_CMD 0x09
81 #define LIGHTRANGER9_REG_MODE 0x10
82 #define LIGHTRANGER9_REG_LIVE_BEAT 0x0A
83 #define LIGHTRANGER9_REG_ACTIVE_RANGE 0x19
84 #define LIGHTRANGER9_REG_SERIAL_NUMBER_0 0x1C
85 #define LIGHTRANGER9_REG_SERIAL_NUMBER_1 0x1D
86 #define LIGHTRANGER9_REG_SERIAL_NUMBER_2 0x1E
87 #define LIGHTRANGER9_REG_SERIAL_NUMBER_3 0x1F
88 #define LIGHTRANGER9_REG_CONFIG_RESULT 0x20
89 #define LIGHTRANGER9_REG_TID 0x21
90 #define LIGHTRANGER9_REG_SIZE_LSB 0x22
91 #define LIGHTRANGER9_REG_SIZE_MSB 0x23
98 #define LIGHTRANGER9_REG_BLOCKREAD 0x20
99 #define LIGHTRANGER9_REG_RESULT_NUMBER 0x24
100 #define LIGHTRANGER9_REG_TEMPERATURE 0x25
101 #define LIGHTRANGER9_REG_NUMBER_VALID_RESULTS 0x26
102 #define LIGHTRANGER9_REG_AMBIENT_LIGHT_0 0x28
103 #define LIGHTRANGER9_REG_AMBIENT_LIGHT_1 0x29
104 #define LIGHTRANGER9_REG_AMBIENT_LIGHT_2 0x2A
105 #define LIGHTRANGER9_REG_AMBIENT_LIGHT_3 0x2B
106 #define LIGHTRANGER9_REG_PHOTON_COUNT_0 0x2C
107 #define LIGHTRANGER9_REG_PHOTON_COUNT_1 0x2D
108 #define LIGHTRANGER9_REG_PHOTON_COUNT_2 0x2E
109 #define LIGHTRANGER9_REG_PHOTON_COUNT_3 0x2F
110 #define LIGHTRANGER9_REG_REFERENCE_COUNT_0 0x30
111 #define LIGHTRANGER9_REG_REFERENCE_COUNT_1 0x31
112 #define LIGHTRANGER9_REG_REFERENCE_COUNT_2 0x32
113 #define LIGHTRANGER9_REG_REFERENCE_COUNT_3 0x33
114 #define LIGHTRANGER9_REG_SYS_TICK_0 0x34
115 #define LIGHTRANGER9_REG_SYS_TICK_1 0x35
116 #define LIGHTRANGER9_REG_SYS_TICK_2 0x36
117 #define LIGHTRANGER9_REG_SYS_TICK_3 0x37
118 #define LIGHTRANGER9_REG_RES_CONFIDENCE_0 0x38
119 #define LIGHTRANGER9_REG_RES_DISTANCE_0_LSB 0x39
120 #define LIGHTRANGER9_REG_RES_DISTANCE_0_MSB 0x3A
121 #define LIGHTRANGER9_REG_RES_CONFIDENCE_1 0x3B
122 #define LIGHTRANGER9_REG_RES_DISTANCE_1_LSB 0x3C
123 #define LIGHTRANGER9_REG_RES_DISTANCE_1_MSB 0x3D
124 #define LIGHTRANGER9_REG_RES_CONFIDENCE_2 0x3E
125 #define LIGHTRANGER9_REG_RES_DISTANCE_2_LSB 0x3F
126 #define LIGHTRANGER9_REG_RES_DISTANCE_2_MSB 0x40
127 #define LIGHTRANGER9_REG_RES_CONFIDENCE_3 0x41
128 #define LIGHTRANGER9_REG_RES_DISTANCE_3_LSB 0x42
129 #define LIGHTRANGER9_REG_RES_DISTANCE_3_MSB 0x43
130 #define LIGHTRANGER9_REG_RES_CONFIDENCE_4 0x44
131 #define LIGHTRANGER9_REG_RES_DISTANCE_4_LSB 0x45
132 #define LIGHTRANGER9_REG_RES_DISTANCE_4_MSB 0x46
133 #define LIGHTRANGER9_REG_RES_CONFIDENCE_5 0x47
134 #define LIGHTRANGER9_REG_RES_DISTANCE_5_LSB 0x48
135 #define LIGHTRANGER9_REG_RES_DISTANCE_5_MSB 0x49
136 #define LIGHTRANGER9_REG_RES_CONFIDENCE_6 0x4A
137 #define LIGHTRANGER9_REG_RES_DISTANCE_6_LSB 0x4B
138 #define LIGHTRANGER9_REG_RES_DISTANCE_6_MSB 0x4C
139 #define LIGHTRANGER9_REG_RES_CONFIDENCE_7 0x4D
140 #define LIGHTRANGER9_REG_RES_DISTANCE_7_LSB 0x4E
141 #define LIGHTRANGER9_REG_RES_DISTANCE_7_MSB 0x4F
142 #define LIGHTRANGER9_REG_RES_CONFIDENCE_8 0x50
143 #define LIGHTRANGER9_REG_RES_DISTANCE_8_LSB 0x51
144 #define LIGHTRANGER9_REG_RES_DISTANCE_8_MSB 0x52
145 #define LIGHTRANGER9_REG_RES_CONFIDENCE_9 0x53
146 #define LIGHTRANGER9_REG_RES_DISTANCE_9_LSB 0x54
147 #define LIGHTRANGER9_REG_RES_DISTANCE_9_MSB 0x55
148 #define LIGHTRANGER9_REG_RES_CONFIDENCE_10 0x56
149 #define LIGHTRANGER9_REG_RES_DISTANCE_10_LSB 0x57
150 #define LIGHTRANGER9_REG_RES_DISTANCE_10_MSB 0x58
151 #define LIGHTRANGER9_REG_RES_CONFIDENCE_11 0x59
152 #define LIGHTRANGER9_REG_RES_DISTANCE_11_LSB 0x5A
153 #define LIGHTRANGER9_REG_RES_DISTANCE_11_MSB 0x5B
154 #define LIGHTRANGER9_REG_RES_CONFIDENCE_12 0x5C
155 #define LIGHTRANGER9_REG_RES_DISTANCE_12_LSB 0x5D
156 #define LIGHTRANGER9_REG_RES_DISTANCE_12_MSB 0x5E
157 #define LIGHTRANGER9_REG_RES_CONFIDENCE_13 0x5F
158 #define LIGHTRANGER9_REG_RES_DISTANCE_13_LSB 0x60
159 #define LIGHTRANGER9_REG_RES_DISTANCE_13_MSB 0x61
160 #define LIGHTRANGER9_REG_RES_CONFIDENCE_14 0x62
161 #define LIGHTRANGER9_REG_RES_DISTANCE_14_LSB 0x63
162 #define LIGHTRANGER9_REG_RES_DISTANCE_14_MSB 0x64
163 #define LIGHTRANGER9_REG_RES_CONFIDENCE_15 0x65
164 #define LIGHTRANGER9_REG_RES_DISTANCE_15_LSB 0x66
165 #define LIGHTRANGER9_REG_RES_DISTANCE_15_MSB 0x67
166 #define LIGHTRANGER9_REG_RES_CONFIDENCE_16 0x68
167 #define LIGHTRANGER9_REG_RES_DISTANCE_16_LSB 0x69
168 #define LIGHTRANGER9_REG_RES_DISTANCE_16_MSB 0x6A
169 #define LIGHTRANGER9_REG_RES_CONFIDENCE_17 0x6B
170 #define LIGHTRANGER9_REG_RES_DISTANCE_17_LSB 0x6C
171 #define LIGHTRANGER9_REG_RES_DISTANCE_17_MSB 0x6D
172 #define LIGHTRANGER9_REG_RES_CONFIDENCE_18 0x6E
173 #define LIGHTRANGER9_REG_RES_DISTANCE_18_LSB 0x6F
174 #define LIGHTRANGER9_REG_RES_DISTANCE_18_MSB 0x70
175 #define LIGHTRANGER9_REG_RES_CONFIDENCE_19 0x71
176 #define LIGHTRANGER9_REG_RES_DISTANCE_19_LSB 0x72
177 #define LIGHTRANGER9_REG_RES_DISTANCE_19_MSB 0x73
178 #define LIGHTRANGER9_REG_RES_CONFIDENCE_20 0x74
179 #define LIGHTRANGER9_REG_RES_DISTANCE_20_LSB 0x75
180 #define LIGHTRANGER9_REG_RES_DISTANCE_20_MSB 0x76
181 #define LIGHTRANGER9_REG_RES_CONFIDENCE_21 0x77
182 #define LIGHTRANGER9_REG_RES_DISTANCE_21_LSB 0x78
183 #define LIGHTRANGER9_REG_RES_DISTANCE_21_MSB 0x79
184 #define LIGHTRANGER9_REG_RES_CONFIDENCE_22 0x7A
185 #define LIGHTRANGER9_REG_RES_DISTANCE_22_LSB 0x7B
186 #define LIGHTRANGER9_REG_RES_DISTANCE_22_MSB 0x7C
187 #define LIGHTRANGER9_REG_RES_CONFIDENCE_23 0x7D
188 #define LIGHTRANGER9_REG_RES_DISTANCE_23_LSB 0x7E
189 #define LIGHTRANGER9_REG_RES_DISTANCE_23_MSB 0x7F
190 #define LIGHTRANGER9_REG_RES_CONFIDENCE_24 0x80
191 #define LIGHTRANGER9_REG_RES_DISTANCE_24_LSB 0x81
192 #define LIGHTRANGER9_REG_RES_DISTANCE_24_MSB 0x82
193 #define LIGHTRANGER9_REG_RES_CONFIDENCE_25 0x83
194 #define LIGHTRANGER9_REG_RES_DISTANCE_25_LSB 0x84
195 #define LIGHTRANGER9_REG_RES_DISTANCE_25_MSB 0x85
196 #define LIGHTRANGER9_REG_RES_CONFIDENCE_26 0x86
197 #define LIGHTRANGER9_REG_RES_DISTANCE_26_LSB 0x87
198 #define LIGHTRANGER9_REG_RES_DISTANCE_26_MSB 0x88
199 #define LIGHTRANGER9_REG_RES_CONFIDENCE_27 0x89
200 #define LIGHTRANGER9_REG_RES_DISTANCE_27_LSB 0x8A
201 #define LIGHTRANGER9_REG_RES_DISTANCE_27_MSB 0x8B
202 #define LIGHTRANGER9_REG_RES_CONFIDENCE_28 0x8C
203 #define LIGHTRANGER9_REG_RES_DISTANCE_28_LSB 0x8D
204 #define LIGHTRANGER9_REG_RES_DISTANCE_28_MSB 0x8E
205 #define LIGHTRANGER9_REG_RES_CONFIDENCE_29 0x8F
206 #define LIGHTRANGER9_REG_RES_DISTANCE_29_LSB 0x90
207 #define LIGHTRANGER9_REG_RES_DISTANCE_29_MSB 0x91
208 #define LIGHTRANGER9_REG_RES_CONFIDENCE_30 0x92
209 #define LIGHTRANGER9_REG_RES_DISTANCE_30_LSB 0x93
210 #define LIGHTRANGER9_REG_RES_DISTANCE_30_MSB 0x94
211 #define LIGHTRANGER9_REG_RES_CONFIDENCE_31 0x95
212 #define LIGHTRANGER9_REG_RES_DISTANCE_31_LSB 0x96
213 #define LIGHTRANGER9_REG_RES_DISTANCE_31_MSB 0x97
214 #define LIGHTRANGER9_REG_RES_CONFIDENCE_32 0x98
215 #define LIGHTRANGER9_REG_RES_DISTANCE_32_LSB 0x99
216 #define LIGHTRANGER9_REG_RES_DISTANCE_32_MSB 0x9A
217 #define LIGHTRANGER9_REG_RES_CONFIDENCE_33 0x9B
218 #define LIGHTRANGER9_REG_RES_DISTANCE_33_LSB 0x9C
219 #define LIGHTRANGER9_REG_RES_DISTANCE_33_MSB 0x9D
220 #define LIGHTRANGER9_REG_RES_CONFIDENCE_34 0x9E
221 #define LIGHTRANGER9_REG_RES_DISTANCE_34_LSB 0x9F
222 #define LIGHTRANGER9_REG_RES_DISTANCE_34_MSB 0xA0
223 #define LIGHTRANGER9_REG_RES_CONFIDENCE_35 0xA1
224 #define LIGHTRANGER9_REG_RES_DISTANCE_35_LSB 0xA2
225 #define LIGHTRANGER9_REG_RES_DISTANCE_35_MSB 0xA3
232 #define LIGHTRANGER9_REG_PERIOD_MS_LSB 0x24
233 #define LIGHTRANGER9_REG_PERIOD_MS_MSB 0x25
234 #define LIGHTRANGER9_REG_KILO_ITERATIONS_LSB 0x26
235 #define LIGHTRANGER9_REG_KILO_ITERATIONS_MSB 0x27
236 #define LIGHTRANGER9_REG_INT_THRESHOLD_LOW_LSB 0x28
237 #define LIGHTRANGER9_REG_INT_THRESHOLD_LOW_MSB 0x29
238 #define LIGHTRANGER9_REG_INT_THRESHOLD_HIGH_LSB 0x2A
239 #define LIGHTRANGER9_REG_INT_THRESHOLD_HIGH_MSB 0x2B
240 #define LIGHTRANGER9_REG_INT_ZONE_MASK_0 0x2C
241 #define LIGHTRANGER9_REG_INT_ZONE_MASK_1 0x2D
242 #define LIGHTRANGER9_REG_INT_ZONE_MASK_2 0x2E
243 #define LIGHTRANGER9_REG_INT_PERSISTANCE 0x2F
244 #define LIGHTRANGER9_REG_CONFIDENCE_THRESHOLD 0x30
245 #define LIGHTRANGER9_REG_GPIO_0 0x31
246 #define LIGHTRANGER9_REG_GPIO_1 0x32
247 #define LIGHTRANGER9_REG_POWER_CFG 0x33
248 #define LIGHTRANGER9_REG_SPAD_MAP_ID 0x34
249 #define LIGHTRANGER9_REG_ALG_SETTING_0 0x35
250 #define LIGHTRANGER9_REG_HIST_DUMP 0x39
251 #define LIGHTRANGER9_REG_SPREAD_SPECTRUM 0x3A
252 #define LIGHTRANGER9_REG_I2C_SLAVE_ADDRESS 0x3B
253 #define LIGHTRANGER9_REG_OSC_TRIM_VALUE_LSB 0x3C
254 #define LIGHTRANGER9_REG_OSC_TRIM_VALUE_MSB 0x3D
255 #define LIGHTRANGER9_REG_I2C_ADDR_CHANGE 0x3E
262 #define LIGHTRANGER9_REG_SPAD_ENABLE_FIRST 0x24
263 #define LIGHTRANGER9_REG_SPAD_ENABLE_LAST 0x41
264 #define LIGHTRANGER9_REG_SPAD_TDC_FIRST 0x42
265 #define LIGHTRANGER9_REG_SPAD_TDC_LAST 0x8C
266 #define LIGHTRANGER9_REG_SPAD_X_OFFSET_2 0x8D
267 #define LIGHTRANGER9_REG_SPAD_Y_OFFSET_2 0x8E
268 #define LIGHTRANGER9_REG_SPAD_X_SIZE 0x8F
269 #define LIGHTRANGER9_REG_SPAD_Y_SIZE 0x90
276 #define LIGHTRANGER9_REG_FACTORY_CALIBRATION_FIRST 0x24
277 #define LIGHTRANGER9_REG_CROSSTALK_ZONE1 0x60
278 #define LIGHTRANGER9_REG_CROSSTALK_ZONE2 0x64
279 #define LIGHTRANGER9_REG_CROSSTALK_ZONE3 0x68
280 #define LIGHTRANGER9_REG_CROSSTALK_ZONE4 0x6C
281 #define LIGHTRANGER9_REG_CROSSTALK_ZONE5 0x70
282 #define LIGHTRANGER9_REG_CROSSTALK_ZONE6 0x74
283 #define LIGHTRANGER9_REG_CROSSTALK_ZONE7 0x78
284 #define LIGHTRANGER9_REG_CROSSTALK_ZONE8 0x7C
285 #define LIGHTRANGER9_REG_CROSSTALK_ZONE9 0x80
286 #define LIGHTRANGER9_REG_CROSSTALK_ZONE1_TMUX 0xB8
287 #define LIGHTRANGER9_REG_CROSSTALK_ZONE2_TMUX 0xBC
288 #define LIGHTRANGER9_REG_CROSSTALK_ZONE3_TMUX 0xC0
289 #define LIGHTRANGER9_REG_CROSSTALK_ZONE4_TMUX 0xC4
290 #define LIGHTRANGER9_REG_CROSSTALK_ZONE5_TMUX 0xC8
291 #define LIGHTRANGER9_REG_CROSSTALK_ZONE6_TMUX 0xCC
292 #define LIGHTRANGER9_REG_CROSSTALK_ZONE7_TMUX 0xD0
293 #define LIGHTRANGER9_REG_CROSSTALK_ZONE8_TMUX 0xD4
294 #define LIGHTRANGER9_REG_CROSSTALK_ZONE9_TMUX 0xD8
295 #define LIGHTRANGER9_REG_CALIBRATION_STATUS_FC 0xDC
296 #define LIGHTRANGER9_REG_FACTORY_CALIBRATION_LAST 0xDF
303 #define LIGHTRANGER9_REG_SUBPACKET_NUMBER 0x24
304 #define LIGHTRANGER9_REG_SUBPACKET_PAYLOAD 0x25
305 #define LIGHTRANGER9_REG_SUBPACKET_CONFIG 0x26
306 #define LIGHTRANGER9_REG_SUBPACKET_DATA0 0x27
307 #define LIGHTRANGER9_REG_SUBPACKET_DATA127 0xA6
314 #define LIGHTRANGER9_REG_BL_CMD_STAT 0x08
315 #define LIGHTRANGER9_REG_BL_SIZE 0x09
316 #define LIGHTRANGER9_REG_BL_DATA 0x0A
334 #define LIGHTRANGER9_TIMEOUT 5000
340 #define LIGHTRANGER9_ENABLE_CPU_READY 0x40
341 #define LIGHTRANGER9_ENABLE_POWERUP_BL 0x00
342 #define LIGHTRANGER9_ENABLE_POWERUP_BL_NO_SLP 0x10
343 #define LIGHTRANGER9_ENABLE_POWERUP_RAM 0x20
344 #define LIGHTRANGER9_ENABLE_PON 0x01
350 #define LIGHTRANGER9_INT_ENAB_REG_STATUS 0x40
351 #define LIGHTRANGER9_INT_ENAB_COMMAND 0x20
352 #define LIGHTRANGER9_INT_ENAB_HIST_READY 0x08
353 #define LIGHTRANGER9_INT_ENAB_MEAS_READY 0x02
359 #define LIGHTRANGER9_INT_STATUS_REG_STATUS 0x40
360 #define LIGHTRANGER9_INT_STATUS_COMMAND 0x20
361 #define LIGHTRANGER9_INT_STATUS_HIST_READY 0x08
362 #define LIGHTRANGER9_INT_STATUS_MEAS_READY 0x02
368 #define LIGHTRANGER9_CMD_STAT_MEASURE 0x10
369 #define LIGHTRANGER9_CMD_STAT_CLEAR_STATUS 0x11
370 #define LIGHTRANGER9_CMD_STAT_GPIO 0x12
371 #define LIGHTRANGER9_CMD_STAT_WRITE_CFG_PAGE 0x15
372 #define LIGHTRANGER9_CMD_STAT_LOAD_CFG_PAGE_COMMON 0x16
373 #define LIGHTRANGER9_CMD_STAT_LOAD_CFG_PAGE_SPAD_1 0x17
374 #define LIGHTRANGER9_CMD_STAT_LOAD_CFG_PAGE_SPAD_2 0x18
375 #define LIGHTRANGER9_CMD_STAT_LOAD_CFG_PAGE_F_Y_CAL 0x19
376 #define LIGHTRANGER9_CMD_STAT_FACTORY_CALIBRATION 0x20
377 #define LIGHTRANGER9_CMD_STAT_I2C_SLAVE_ADDRESS 0x21
378 #define LIGHTRANGER9_CMD_STAT_FORCE_TMF8820 0x65
379 #define LIGHTRANGER9_CMD_STAT_FORCE_TMF8828 0x6C
380 #define LIGHTRANGER9_CMD_STAT_RESET 0xFE
381 #define LIGHTRANGER9_CMD_STAT_STOP 0xFF
387 #define LIGHTRANGER9_CMD_STAT_OK 0x00
388 #define LIGHTRANGER9_CMD_STAT_ACCEPTED 0x01
389 #define LIGHTRANGER9_CMD_ERR_CONFIG 0x02
390 #define LIGHTRANGER9_CMD_ERR_APPLICATION 0x03
391 #define LIGHTRANGER9_CMD_ERR_WAKEUP_TIMED 0x04
392 #define LIGHTRANGER9_CMD_ERR_RESET_UNEXPECTED 0x05
393 #define LIGHTRANGER9_CMD_ERR_UNKNOWN_CMD 0x06
394 #define LIGHTRANGER9_CMD_ERR_NO_REF_SPAD 0x07
395 #define LIGHTRANGER9_CMD_ERR_UNKNOWN_CID 0x09
396 #define LIGHTRANGER9_CMD_WARNING_CFG_SPAD_1 0x0A
397 #define LIGHTRANGER9_CMD_WARNING_CFG_SPAD_2 0x0B
398 #define LIGHTRANGER9_CMD_WARNING_OSC_TRIP 0x0C
399 #define LIGHTRANGER9_CMD_WARNING_I2C_ADDRESS 0x0D
400 #define LIGHTRANGER9_CMD_ERR_UNKNOWN_MODE 0x0E
406 #define LIGHTRANGER9_CONFIG_RESULT_MEAS 0x10
407 #define LIGHTRANGER9_CONFIG_RESULT_COMMON_CID 0x16
408 #define LIGHTRANGER9_CONFIG_RESULT_SPAD_1_CID 0x17
409 #define LIGHTRANGER9_CONFIG_RESULT_SPAD_2_CID 0x18
410 #define LIGHTRANGER9_CONFIG_RESULT_FAC_CALIB_CID 0x19
411 #define LIGHTRANGER9_CONFIG_RESULT_HIST_RAW_CID 0x81
417 #define LIGHTRANGER9_BL_CMD_RAMREMAP_RESET 0x11
418 #define LIGHTRANGER9_BL_CMD_DOWNLOAD_INIT 0x14
419 #define LIGHTRANGER9_BL_CMD_RAM_BIST 0x2A
420 #define LIGHTRANGER9_BL_CMD_I2C_BIST 0x2C
421 #define LIGHTRANGER9_BL_CMD_W_RAM 0x41
422 #define LIGHTRANGER9_BL_CMD_ADDR_RAM 0x43
428 #define LIGHTRANGER9_BL_CMD_STAT_READY 0x00
429 #define LIGHTRANGER9_BL_CMD_STAT_ERR_SIZE 0x01
430 #define LIGHTRANGER9_BL_CMD_STAT_ERR_CSUM 0x02
431 #define LIGHTRANGER9_BL_CMD_STAT_ERR_RANGE 0x03
432 #define LIGHTRANGER9_BL_CMD_STAT_ERR_MORE 0x04
438 #define LIGHTRANGER9_APP_ID_BOOTLOADER 0x80
439 #define LIGHTRANGER9_APP_ID_MEASUREMENT 0x03
445 #define LIGHTRANGER9_BLOCKREAD_SIZE 132
446 #define LIGHTRANGER9_MAX_MEAS_RESULTS 36
447 #define LIGHTRANGER9_SUBCAPTURE_0 0
448 #define LIGHTRANGER9_SUBCAPTURE_1 1
449 #define LIGHTRANGER9_SUBCAPTURE_2 2
450 #define LIGHTRANGER9_SUBCAPTURE_3 3
451 #define LIGHTRANGER9_SUBCAPTURE_MASK 0x03
452 #define LIGHTRANGER9_RESULT_NUMBER_MASK 0x3F
453 #define LIGHTRANGER9_SYS_TICK_TO_SEC 0.0000002
454 #define LIGHTRANGER9_OBJECT_MAP_SIZE 64
460 #define LIGHTRANGER9_DEFAULT_MEASUREMENT_PERIOD_MS 500
461 #define LIGHTRANGER9_CONFIDENCE_THRESHOLD 100
467 #define LIGHTRANGER9_DEVICE_ID 0x08
474 #define LIGHTRANGER9_DEVICE_ADDRESS 0x41
492 #define LIGHTRANGER9_MAP_MIKROBUS( cfg, mikrobus ) \
493 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
494 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
495 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
496 cfg.gpio0 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
497 cfg.gpio1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
498 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
825 #endif // LIGHTRANGER9_H
int8_t temperature
Definition: lightranger9.h:563
err_t lightranger9_clear_interrupts(lightranger9_t *ctx)
LightRanger 9 clear interrupts function.
lightranger9_return_value_t
LightRanger 9 Click return value data.
Definition: lightranger9.h:578
pin_name_t gpio1
Definition: lightranger9.h:536
digital_out_t en
Definition: lightranger9.h:510
uint8_t valid_results
Definition: lightranger9.h:564
err_t lightranger9_default_cfg(lightranger9_t *ctx)
LightRanger 9 default configuration function.
uint32_t reference_count
Definition: lightranger9.h:567
uint32_t ambient_light
Definition: lightranger9.h:565
err_t lightranger9_download_fw_bin(lightranger9_t *ctx)
LightRanger 9 download fw bin function.
err_t lightranger9_read_bl_cmd_status(lightranger9_t *ctx, uint8_t *status)
LightRanger 9 read bl cmd status function.
err_t lightranger9_write_bl_cmd(lightranger9_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len)
LightRanger 9 write bl cmd function.
pin_name_t scl
Definition: lightranger9.h:531
err_t lightranger9_check_communication(lightranger9_t *ctx)
LightRanger 9 check communication function.
LightRanger 9 Click configuration object.
Definition: lightranger9.h:530
void lightranger9_set_gpio1_pin(lightranger9_t *ctx, uint8_t state)
LightRanger 9 set gpio1 pin function.
uint8_t i2c_address
Definition: lightranger9.h:540
err_t lightranger9_generic_write(lightranger9_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
LightRanger 9 I2C writing function.
void lightranger9_enable_device(lightranger9_t *ctx)
LightRanger 9 enable device function.
float sys_tick_sec
Definition: lightranger9.h:568
void lightranger9_cfg_setup(lightranger9_cfg_t *cfg)
LightRanger 9 configuration object setup function.
err_t lightranger9_read_register(lightranger9_t *ctx, uint8_t reg, uint8_t *data_out)
LightRanger 9 read register function.
pin_name_t en
Definition: lightranger9.h:534
uint32_t photon_count
Definition: lightranger9.h:566
uint8_t confidence
Definition: lightranger9.h:550
err_t lightranger9_write_register(lightranger9_t *ctx, uint8_t reg, uint8_t data_in)
LightRanger 9 write register function.
err_t lightranger9_init(lightranger9_t *ctx, lightranger9_cfg_t *cfg)
LightRanger 9 initialization function.
pin_name_t gpio0
Definition: lightranger9.h:535
void lightranger9_disable_device(lightranger9_t *ctx)
LightRanger 9 disable device function.
pin_name_t sda
Definition: lightranger9.h:532
@ LIGHTRANGER9_ERROR
Definition: lightranger9.h:580
uint16_t distance_mm
Definition: lightranger9.h:551
uint8_t slave_address
Definition: lightranger9.h:521
void lightranger9_set_gpio0_pin(lightranger9_t *ctx, uint8_t state)
LightRanger 9 set gpio0 pin function.
err_t lightranger9_generic_read(lightranger9_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
LightRanger 9 I2C reading function.
digital_in_t int_pin
Definition: lightranger9.h:515
err_t lightranger9_get_capture(lightranger9_t *ctx, lightranger9_capture_t *capture)
LightRanger 9 get capture function.
uint8_t sub_capture
Definition: lightranger9.h:561
LightRanger 9 measurement result data object.
Definition: lightranger9.h:549
LightRanger 9 capture data object.
Definition: lightranger9.h:560
uint8_t lightranger9_get_int_pin(lightranger9_t *ctx)
LightRanger 9 get int pin function.
uint8_t result_number
Definition: lightranger9.h:562
i2c_master_t i2c
Definition: lightranger9.h:518
@ LIGHTRANGER9_OK
Definition: lightranger9.h:579
LightRanger 9 Click context object.
Definition: lightranger9.h:508
digital_out_t gpio0
Definition: lightranger9.h:511
digital_out_t gpio1
Definition: lightranger9.h:512
uint32_t i2c_speed
Definition: lightranger9.h:539
pin_name_t int_pin
Definition: lightranger9.h:537
#define LIGHTRANGER9_MAX_MEAS_RESULTS
Definition: lightranger9.h:446