LibDriver APDS9960
Loading...
Searching...
No Matches
driver_apds9960_read_test.c
Go to the documentation of this file.
1
36
38
39static apds9960_handle_t gs_handle;
40
49uint8_t apds9960_read_test(uint32_t times)
50{
51 uint8_t res;
52 uint8_t reg;
53 uint32_t i;
54 apds9960_info_t info;
55
56 /* link interface function */
65
66 /* get information */
67 res = apds9960_info(&info);
68 if (res != 0)
69 {
70 apds9960_interface_debug_print("apds9960: get info failed.\n");
71
72 return 1;
73 }
74 else
75 {
76 /* print chip info */
77 apds9960_interface_debug_print("apds9960: chip is %s.\n", info.chip_name);
78 apds9960_interface_debug_print("apds9960: manufacturer is %s.\n", info.manufacturer_name);
79 apds9960_interface_debug_print("apds9960: interface is %s.\n", info.interface);
80 apds9960_interface_debug_print("apds9960: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
81 apds9960_interface_debug_print("apds9960: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
82 apds9960_interface_debug_print("apds9960: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
83 apds9960_interface_debug_print("apds9960: max current is %0.2fmA.\n", info.max_current_ma);
84 apds9960_interface_debug_print("apds9960: max temperature is %0.1fC.\n", info.temperature_max);
85 apds9960_interface_debug_print("apds9960: min temperature is %0.1fC.\n", info.temperature_min);
86 }
87
88 /* start read test */
89 apds9960_interface_debug_print("apds9960: start read test.\n");
90
91 /* init the apds9960 */
92 res = apds9960_init(&gs_handle);
93 if (res != 0)
94 {
95 apds9960_interface_debug_print("apds9960: init failed.\n");
96
97 return 1;
98 }
99
100 /* power on */
102 if (res != 0)
103 {
104 apds9960_interface_debug_print("apds9960: set conf failed.\n");
105 (void)apds9960_deinit(&gs_handle);
106
107 return 1;
108 }
109
110 /* disable wait time */
112 if (res != 0)
113 {
114 apds9960_interface_debug_print("apds9960: set conf failed.\n");
115 (void)apds9960_deinit(&gs_handle);
116
117 return 1;
118 }
119
120 /* disable proximity detect */
122 if (res != 0)
123 {
124 apds9960_interface_debug_print("apds9960: set conf failed.\n");
125 (void)apds9960_deinit(&gs_handle);
126
127 return 1;
128 }
129
130 /* disable als */
132 if (res != 0)
133 {
134 apds9960_interface_debug_print("apds9960: set conf failed.\n");
135 (void)apds9960_deinit(&gs_handle);
136
137 return 1;
138 }
139
140 /* disable als interrupt */
142 if (res != 0)
143 {
144 apds9960_interface_debug_print("apds9960: set conf failed.\n");
145 (void)apds9960_deinit(&gs_handle);
146
147 return 1;
148 }
149
150 /* disable proximity interrupt */
152 if (res != 0)
153 {
154 apds9960_interface_debug_print("apds9960: set conf failed.\n");
155 (void)apds9960_deinit(&gs_handle);
156
157 return 1;
158 }
159
160 /* disable gesture */
162 if (res != 0)
163 {
164 apds9960_interface_debug_print("apds9960: set conf failed.\n");
165 (void)apds9960_deinit(&gs_handle);
166
167 return 1;
168 }
169
170 /* convert adc integration time */
171 res = apds9960_adc_integration_time_convert_to_register(&gs_handle, 103.0f, (uint8_t *)&reg);
172 if (res != 0)
173 {
174 apds9960_interface_debug_print("apds9960: adc integration time convert to register failed.\n");
175 (void)apds9960_deinit(&gs_handle);
176
177 return 1;
178 }
179
180 /* set adc integration time */
181 res = apds9960_set_adc_integration_time(&gs_handle, reg);
182 if (res != 0)
183 {
184 apds9960_interface_debug_print("apds9960: set adc integration time failed.\n");
185 (void)apds9960_deinit(&gs_handle);
186
187 return 1;
188 }
189
190 /* disable wait long */
192 if (res != 0)
193 {
194 apds9960_interface_debug_print("apds9960: set wait long failed.\n");
195 (void)apds9960_deinit(&gs_handle);
196
197 return 1;
198 }
199
200 /* wait time convert to register */
201 res = apds9960_wait_time_convert_to_register(&gs_handle, 10.0f, (uint8_t *)&reg);
202 if (res != 0)
203 {
204 apds9960_interface_debug_print("apds9960: wait time convert to register failed.\n");
205 (void)apds9960_deinit(&gs_handle);
206
207 return 1;
208 }
209
210 /* set wait time */
211 res = apds9960_set_wait_time(&gs_handle, reg);
212 if (res != 0)
213 {
214 apds9960_interface_debug_print("apds9960: set wait time failed.\n");
215 (void)apds9960_deinit(&gs_handle);
216
217 return 1;
218 }
219
220 /* set als interrupt low threshold */
221 res = apds9960_set_als_interrupt_low_threshold(&gs_handle, 0x0000U);
222 if (res != 0)
223 {
224 apds9960_interface_debug_print("apds9960: set als interrupt low threshold failed.\n");
225 (void)apds9960_deinit(&gs_handle);
226
227 return 1;
228 }
229
230 /* set als interrupt high threshold */
231 res = apds9960_set_als_interrupt_high_threshold(&gs_handle, 0xFFFFU);
232 if (res != 0)
233 {
234 apds9960_interface_debug_print("apds9960: set als interrupt high threshold failed.\n");
235 (void)apds9960_deinit(&gs_handle);
236
237 return 1;
238 }
239
240 /* set proximity interrupt low threshold */
242 if (res != 0)
243 {
244 apds9960_interface_debug_print("apds9960: set proximity interrupt low threshold failed.\n");
245 (void)apds9960_deinit(&gs_handle);
246
247 return 1;
248 }
249
250 /* set proximity interrupt high threshold */
252 if (res != 0)
253 {
254 apds9960_interface_debug_print("apds9960: set proximity interrupt high threshold failed.\n");
255 (void)apds9960_deinit(&gs_handle);
256
257 return 1;
258 }
259
260 /* proximity interrupt cycle 2 */
262 if (res != 0)
263 {
264 apds9960_interface_debug_print("apds9960: set proximity interrupt cycle failed.\n");
265 (void)apds9960_deinit(&gs_handle);
266
267 return 1;
268 }
269
270 /* als interrupt cycle 2 */
272 if (res != 0)
273 {
274 apds9960_interface_debug_print("apds9960: set als interrupt cycle failed.\n");
275 (void)apds9960_deinit(&gs_handle);
276
277 return 1;
278 }
279
280 /* set proximity pulse length */
282 if (res != 0)
283 {
284 apds9960_interface_debug_print("apds9960: set proximity pulse length failed.\n");
285 (void)apds9960_deinit(&gs_handle);
286
287 return 1;
288 }
289
290 /* set proximity pulse count */
291 res = apds9960_set_proximity_pulse_count(&gs_handle, 7);
292 if (res != 0)
293 {
294 apds9960_interface_debug_print("apds9960: set proximity pulse count failed.\n");
295 (void)apds9960_deinit(&gs_handle);
296
297 return 1;
298 }
299
300 /* set led current */
302 if (res != 0)
303 {
304 apds9960_interface_debug_print("apds9960: set led current failed.\n");
305 (void)apds9960_deinit(&gs_handle);
306
307 return 1;
308 }
309
310 /* set proximity gain */
312 if (res != 0)
313 {
314 apds9960_interface_debug_print("apds9960: set proximity gain failed.\n");
315 (void)apds9960_deinit(&gs_handle);
316
317 return 1;
318 }
319
320 /* set als color gain */
322 if (res != 0)
323 {
324 apds9960_interface_debug_print("apds9960: set als color gain failed.\n");
325 (void)apds9960_deinit(&gs_handle);
326
327 return 1;
328 }
329
330 /* disable proximity saturation interrupt */
332 if (res != 0)
333 {
334 apds9960_interface_debug_print("apds9960: set saturation interrupt failed.\n");
335 (void)apds9960_deinit(&gs_handle);
336
337 return 1;
338 }
339
340 /* disable clear photo diode saturation interrupt */
342 if (res != 0)
343 {
344 apds9960_interface_debug_print("apds9960: set saturation interrupt failed.\n");
345 (void)apds9960_deinit(&gs_handle);
346
347 return 1;
348 }
349
350 /* 100% */
352 if (res != 0)
353 {
354 apds9960_interface_debug_print("apds9960: set led boost failed.\n");
355 (void)apds9960_deinit(&gs_handle);
356
357 return 1;
358 }
359
360 /* set proximity up right offset */
361 res = apds9960_set_proximity_up_right_offset(&gs_handle, 0);
362 if (res != 0)
363 {
364 apds9960_interface_debug_print("apds9960: set proximity up right offset failed.\n");
365 (void)apds9960_deinit(&gs_handle);
366
367 return 1;
368 }
369
370 /* set proximity down left offset */
371 res = apds9960_set_proximity_down_left_offset(&gs_handle, 0);
372 if (res != 0)
373 {
374 apds9960_interface_debug_print("apds9960: set proximity down left offset failed.\n");
375 (void)apds9960_deinit(&gs_handle);
376
377 return 1;
378 }
379
380 /* set proximity gain compensation */
382 if (res != 0)
383 {
384 apds9960_interface_debug_print("apds9960: set proximity gain compensation failed.\n");
385 (void)apds9960_deinit(&gs_handle);
386
387 return 1;
388 }
389
390 /* disable */
392 if (res != 0)
393 {
394 apds9960_interface_debug_print("apds9960: set sleep after interrupt failed.\n");
395 (void)apds9960_deinit(&gs_handle);
396
397 return 1;
398 }
399
400 /* disable proximity mask up */
402 if (res != 0)
403 {
404 apds9960_interface_debug_print("apds9960: set proximity mask failed.\n");
405 (void)apds9960_deinit(&gs_handle);
406
407 return 1;
408 }
409
410 /* disable proximity mask down */
412 if (res != 0)
413 {
414 apds9960_interface_debug_print("apds9960: set proximity mask failed.\n");
415 (void)apds9960_deinit(&gs_handle);
416
417 return 1;
418 }
419
420 /* disable proximity mask left */
422 if (res != 0)
423 {
424 apds9960_interface_debug_print("apds9960: set proximity mask failed.\n");
425 (void)apds9960_deinit(&gs_handle);
426
427 return 1;
428 }
429
430 /* disable proximity mask right */
432 if (res != 0)
433 {
434 apds9960_interface_debug_print("apds9960: set proximity mask failed.\n");
435 (void)apds9960_deinit(&gs_handle);
436
437 return 1;
438 }
439
440 /* set gesture proximity enter threshold */
442 if (res != 0)
443 {
444 apds9960_interface_debug_print("apds9960: set gesture proximity enter threshold failed.\n");
445 (void)apds9960_deinit(&gs_handle);
446
447 return 1;
448 }
449
450 /* set gesture proximity exit threshold */
451 res = apds9960_set_gesture_proximity_exit_threshold(&gs_handle, 0xFF);
452 if (res != 0)
453 {
454 apds9960_interface_debug_print("apds9960: set gesture proximity exit threshold failed.\n");
455 (void)apds9960_deinit(&gs_handle);
456
457 return 1;
458 }
459
460 /* set gesture fifo threshold */
462 if (res != 0)
463 {
464 apds9960_interface_debug_print("apds9960: set gesture fifo threshold failed.\n");
465 (void)apds9960_deinit(&gs_handle);
466
467 return 1;
468 }
469
470 /* set gesture exit persistence */
472 if (res != 0)
473 {
474 apds9960_interface_debug_print("apds9960: set gesture exit persistence failed.\n");
475 (void)apds9960_deinit(&gs_handle);
476
477 return 1;
478 }
479
480 /* set gesture exit mask */
481 res = apds9960_set_gesture_exit_mask(&gs_handle, 0x00);
482 if (res != 0)
483 {
484 apds9960_interface_debug_print("apds9960: set gesture exit mask failed.\n");
485 (void)apds9960_deinit(&gs_handle);
486
487 return 1;
488 }
489
490 /* set gesture gain */
492 if (res != 0)
493 {
494 apds9960_interface_debug_print("apds9960: set gesture gain failed.\n");
495 (void)apds9960_deinit(&gs_handle);
496
497 return 1;
498 }
499
500 /* set gesture led current */
502 if (res != 0)
503 {
504 apds9960_interface_debug_print("apds9960: set gesture led current failed.\n");
505 (void)apds9960_deinit(&gs_handle);
506
507 return 1;
508 }
509
510 /* set gesture wait time */
512 if (res != 0)
513 {
514 apds9960_interface_debug_print("apds9960: set gesture wait time failed.\n");
515 (void)apds9960_deinit(&gs_handle);
516
517 return 1;
518 }
519
520 /* set gesture up offset */
521 res = apds9960_set_gesture_up_offset(&gs_handle, 0);
522 if (res != 0)
523 {
524 apds9960_interface_debug_print("apds9960: set gesture up offset failed.\n");
525 (void)apds9960_deinit(&gs_handle);
526
527 return 1;
528 }
529
530 /* set gesture down offset */
531 res = apds9960_set_gesture_down_offset(&gs_handle, 0);
532 if (res != 0)
533 {
534 apds9960_interface_debug_print("apds9960: set gesture down offset failed.\n");
535 (void)apds9960_deinit(&gs_handle);
536
537 return 1;
538 }
539
540 /* set gesture left offset */
541 res = apds9960_set_gesture_left_offset(&gs_handle, 0);
542 if (res != 0)
543 {
544 apds9960_interface_debug_print("apds9960: set gesture left offset failed.\n");
545 (void)apds9960_deinit(&gs_handle);
546
547 return 1;
548 }
549
550 /* set gesture right offset */
551 res = apds9960_set_gesture_right_offset(&gs_handle, 0);
552 if (res != 0)
553 {
554 apds9960_interface_debug_print("apds9960: set gesture right offset failed.\n");
555 (void)apds9960_deinit(&gs_handle);
556
557 return 1;
558 }
559
560 /* set gesture pulse length */
562 if (res != 0)
563 {
564 apds9960_interface_debug_print("apds9960: set gesture pulse length failed.\n");
565 (void)apds9960_deinit(&gs_handle);
566
567 return 1;
568 }
569
570 /* set gesture pulse count */
571 res = apds9960_set_gesture_pulse_count(&gs_handle, 9);
572 if (res != 0)
573 {
574 apds9960_interface_debug_print("apds9960: set gesture pulse count failed.\n");
575 (void)apds9960_deinit(&gs_handle);
576
577 return 1;
578 }
579
580 /* set gesture dimension */
582 if (res != 0)
583 {
584 apds9960_interface_debug_print("apds9960: set gesture dimension failed.\n");
585 (void)apds9960_deinit(&gs_handle);
586
587 return 1;
588 }
589
590 /* gesture fifo clear */
591 res = apds9960_gesture_fifo_clear(&gs_handle);
592 if (res != 0)
593 {
594 apds9960_interface_debug_print("apds9960: gesture fifo clear failed.\n");
595 (void)apds9960_deinit(&gs_handle);
596
597 return 1;
598 }
599
600 /* set gesture interrupt */
602 if (res != 0)
603 {
604 apds9960_interface_debug_print("apds9960: set gesture interrupt failed.\n");
605 (void)apds9960_deinit(&gs_handle);
606
607 return 1;
608 }
609
610 /* set gesture mode */
612 if (res != 0)
613 {
614 apds9960_interface_debug_print("apds9960: set gesture mode failed.\n");
615 (void)apds9960_deinit(&gs_handle);
616
617 return 1;
618 }
619
620 /* all non gesture interrupt clear */
622 if (res != 0)
623 {
624 apds9960_interface_debug_print("apds9960: all non gesture interrupt clear failed.\n");
625 (void)apds9960_deinit(&gs_handle);
626
627 return 1;
628 }
629
630 /* enable wait time */
632 if (res != 0)
633 {
634 apds9960_interface_debug_print("apds9960: set conf failed.\n");
635 (void)apds9960_deinit(&gs_handle);
636
637 return 1;
638 }
639
640 /* enable proximity detect */
642 if (res != 0)
643 {
644 apds9960_interface_debug_print("apds9960: set conf failed.\n");
645 (void)apds9960_deinit(&gs_handle);
646
647 return 1;
648 }
649
650 /* enable als */
652 if (res != 0)
653 {
654 apds9960_interface_debug_print("apds9960: set conf failed.\n");
655 (void)apds9960_deinit(&gs_handle);
656
657 return 1;
658 }
659
660 /* 1000 ms */
662
663 for (i = 0; i < times; i++)
664 {
665 uint8_t proximity;
666 uint16_t red, green, blue, clear;
667
668 /* read rgbc */
669 res = apds9960_read_rgbc(&gs_handle, (uint16_t *)&red, (uint16_t *)&green, (uint16_t *)&blue, (uint16_t *)&clear);
670 if (res != 0)
671 {
672 apds9960_interface_debug_print("apds9960: read rgbc failed.\n");
673 (void)apds9960_deinit(&gs_handle);
674
675 return 1;
676 }
677
678 /* read proximity */
679 res = apds9960_read_proximity(&gs_handle, (uint8_t *)&proximity);
680 if (res != 0)
681 {
682 apds9960_interface_debug_print("apds9960: read proximity failed.\n");
683 (void)apds9960_deinit(&gs_handle);
684
685 return 1;
686 }
687
688 /* output */
689 apds9960_interface_debug_print("apds9960: red is 0x%04X.\n", red);
690 apds9960_interface_debug_print("apds9960: green is 0x%04X.\n", green);
691 apds9960_interface_debug_print("apds9960: blue is 0x%04X.\n", blue);
692 apds9960_interface_debug_print("apds9960: clear is 0x%04X.\n", clear);
693 apds9960_interface_debug_print("apds9960: proximity is 0x%02X.\n", proximity);
694
695 /* 1000 ms */
697 }
698
699 /* finish read test */
700 apds9960_interface_debug_print("apds9960: finish read test.\n");
701 (void)apds9960_deinit(&gs_handle);
702
703 return 0;
704}
driver apds9960 read test header file
uint8_t apds9960_set_gesture_dimension(apds9960_handle_t *handle, apds9960_gesture_dimension_select_t s)
set the gesture dimension
uint8_t apds9960_set_gesture_gain(apds9960_handle_t *handle, apds9960_gesture_gain_control_t gain)
set the gesture gain
uint8_t apds9960_set_als_interrupt_high_threshold(apds9960_handle_t *handle, uint16_t threshold)
set the als interrupt high threshold
uint8_t apds9960_deinit(apds9960_handle_t *handle)
close the chip
uint8_t apds9960_set_gesture_wait_time(apds9960_handle_t *handle, apds9960_gesture_wait_time_t t)
set the gesture wait time
uint8_t apds9960_set_gesture_exit_persistence(apds9960_handle_t *handle, apds9960_gesture_exit_persistence_t persistence)
set the gesture exit persistence
uint8_t apds9960_set_proximity_pulse_length(apds9960_handle_t *handle, apds9960_proximity_pulse_length_t len)
set the proximity pulse length
uint8_t apds9960_set_saturation_interrupt(apds9960_handle_t *handle, apds9960_saturation_interrupt_t saturation, apds9960_bool_t enable)
set the saturation interrupt
uint8_t apds9960_set_proximity_down_left_offset(apds9960_handle_t *handle, int8_t offset)
set the proximity down left offset
uint8_t apds9960_set_als_interrupt_cycle(apds9960_handle_t *handle, apds9960_als_interrupt_cycle_t cycle)
set the als interrupt cycle
uint8_t apds9960_gesture_fifo_clear(apds9960_handle_t *handle)
clear the gesture fifo status
uint8_t apds9960_wait_time_convert_to_register(apds9960_handle_t *handle, float ms, uint8_t *reg)
convert the wait time to the register raw data
uint8_t apds9960_read_proximity(apds9960_handle_t *handle, uint8_t *proximity)
read the proximity data
uint8_t apds9960_set_proximity_gain(apds9960_handle_t *handle, apds9960_proximity_gain_t gain)
set the proximity gain
uint8_t apds9960_adc_integration_time_convert_to_register(apds9960_handle_t *handle, float ms, uint8_t *reg)
convert the adc integration time to the register raw data
uint8_t apds9960_init(apds9960_handle_t *handle)
initialize the chip
uint8_t apds9960_set_proximity_interrupt_cycle(apds9960_handle_t *handle, apds9960_proximity_interrupt_cycle_t cycle)
set the proximity interrupt cycle
uint8_t apds9960_set_gesture_right_offset(apds9960_handle_t *handle, int8_t offset)
set the gesture right offset
uint8_t apds9960_set_gesture_fifo_threshold(apds9960_handle_t *handle, apds9960_gesture_fifo_threshold_t threshold)
set the gesture fifo threshold
uint8_t apds9960_set_proximity_pulse_count(apds9960_handle_t *handle, uint16_t count)
set the proximity pulse count
uint8_t apds9960_set_proximity_up_right_offset(apds9960_handle_t *handle, int8_t offset)
set the proximity up right offset
uint8_t apds9960_set_gesture_pulse_length(apds9960_handle_t *handle, apds9960_gesture_pulse_length_t len)
set the gesture pulse length
uint8_t apds9960_set_proximity_gain_compensation(apds9960_handle_t *handle, apds9960_bool_t enable)
enable or disable the proximity gain compensation
uint8_t apds9960_set_gesture_led_current(apds9960_handle_t *handle, apds9960_gesture_led_current_t current)
set the gesture led current
uint8_t apds9960_set_gesture_pulse_count(apds9960_handle_t *handle, uint16_t count)
set the gesture pulse count
uint8_t apds9960_set_wait_long(apds9960_handle_t *handle, apds9960_bool_t enable)
enable or disable the wait long
uint8_t apds9960_set_gesture_exit_mask(apds9960_handle_t *handle, uint8_t mask)
set the gesture exit mask
uint8_t apds9960_set_als_color_gain(apds9960_handle_t *handle, apds9960_als_color_gain_t gain)
set the als color gain
uint8_t apds9960_set_gesture_proximity_enter_threshold(apds9960_handle_t *handle, uint8_t threshold)
set the gesture proximity enter threshold
struct apds9960_info_s apds9960_info_t
apds9960 information structure definition
uint8_t apds9960_set_gesture_mode(apds9960_handle_t *handle, apds9960_bool_t enable)
enable or disable the gesture mode
uint8_t apds9960_set_led_boost(apds9960_handle_t *handle, apds9960_led_boost_t boost)
set the led boost
struct apds9960_handle_s apds9960_handle_t
apds9960 handle structure definition
uint8_t apds9960_set_sleep_after_interrupt(apds9960_handle_t *handle, apds9960_bool_t enable)
enable or disable sleeping after interrupt
uint8_t apds9960_read_rgbc(apds9960_handle_t *handle, uint16_t *red, uint16_t *green, uint16_t *blue, uint16_t *clear)
read the rgbc data
uint8_t apds9960_all_non_gesture_interrupt_clear(apds9960_handle_t *handle)
clear the all not gesture interrupt
uint8_t apds9960_set_conf(apds9960_handle_t *handle, apds9960_conf_t conf, apds9960_bool_t enable)
set the configuration
uint8_t apds9960_set_als_interrupt_low_threshold(apds9960_handle_t *handle, uint16_t threshold)
set the als interrupt low threshold
uint8_t apds9960_set_gesture_up_offset(apds9960_handle_t *handle, int8_t offset)
set the gesture up offset
uint8_t apds9960_set_gesture_interrupt(apds9960_handle_t *handle, apds9960_bool_t enable)
enable or disable the gesture interrupt
uint8_t apds9960_set_proximity_interrupt_low_threshold(apds9960_handle_t *handle, uint8_t threshold)
set the proximity interrupt low threshold
uint8_t apds9960_set_gesture_left_offset(apds9960_handle_t *handle, int8_t offset)
set the gesture left offset
uint8_t apds9960_set_adc_integration_time(apds9960_handle_t *handle, uint8_t integration_time)
set the adc integration time
uint8_t apds9960_set_led_current(apds9960_handle_t *handle, apds9960_led_current_t current)
set the led current
uint8_t apds9960_set_proximity_interrupt_high_threshold(apds9960_handle_t *handle, uint8_t threshold)
set the proximity interrupt high threshold
uint8_t apds9960_set_wait_time(apds9960_handle_t *handle, uint8_t wait_time)
set the wait time
uint8_t apds9960_set_gesture_proximity_exit_threshold(apds9960_handle_t *handle, uint8_t threshold)
set the gesture proximity exit threshold
uint8_t apds9960_set_proximity_mask(apds9960_handle_t *handle, apds9960_proximity_mask_t mask, apds9960_bool_t enable)
enable or disable the proximity mask
uint8_t apds9960_info(apds9960_info_t *info)
get chip's information
uint8_t apds9960_set_gesture_down_offset(apds9960_handle_t *handle, int8_t offset)
set the gesture down offset
@ APDS9960_LED_BOOST_100_PERCENTAGE
@ APDS9960_GESTURE_LED_CURRENT_100_MA
@ APDS9960_PROXIMITY_INTERRUPT_CYCLE_2
@ APDS9960_PROXIMITY_GAIN_4X
@ APDS9960_GESTURE_DIMENSION_SELECT_BOTH_PAIRS_ACTIVE
@ APDS9960_GESTURE_PULSE_LENGTH_32_US
@ APDS9960_GESTURE_WAIT_TIME_2P8_MS
@ APDS9960_BOOL_FALSE
@ APDS9960_BOOL_TRUE
@ APDS9960_PROXIMITY_MASK_RIGHT
@ APDS9960_PROXIMITY_MASK_DOWN
@ APDS9960_PROXIMITY_MASK_UP
@ APDS9960_PROXIMITY_MASK_LEFT
@ APDS9960_GESTURE_EXIT_PERSISTENCE_1ST
@ APDS9960_ALS_INTERRUPT_CYCLE_2
@ APDS9960_GESTURE_GAIN_2X
@ APDS9960_SATURATION_INTERRUPT_PROXIMITY
@ APDS9960_SATURATION_INTERRUPT_CLEAR_PHOTODIODE
@ APDS9960_CONF_WAIT_ENABLE
@ APDS9960_CONF_ALS_ENABLE
@ APDS9960_CONF_PROXIMITY_DETECT_ENABLE
@ APDS9960_CONF_GESTURE_ENABLE
@ APDS9960_CONF_PROXIMITY_INTERRUPT_ENABLE
@ APDS9960_CONF_ALS_INTERRUPT_ENABLE
@ APDS9960_CONF_POWER_ON
@ APDS9960_PROXIMITY_PULSE_LENGTH_8_US
@ APDS9960_LED_CURRENT_100_MA
@ APDS9960_ALS_COLOR_GAIN_4X
@ APDS9960_GESTURE_FIFO_THRESHOLD_8_DATASET
uint8_t apds9960_interface_iic_init(void)
interface iic bus init
uint8_t apds9960_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
void apds9960_interface_receive_callback(uint8_t type)
interface receive callback
void apds9960_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t apds9960_interface_iic_deinit(void)
interface iic bus deinit
uint8_t apds9960_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
void apds9960_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t apds9960_read_test(uint32_t times)
register test
char manufacturer_name[32]