LibDriver APDS9960
Loading...
Searching...
No Matches
driver_apds9960_gesture_test.c
Go to the documentation of this file.
1
36
38
39static apds9960_handle_t gs_handle;
40static uint8_t gs_data[32][4];
41static volatile uint8_t gs_flag;
42
51{
52 if (apds9960_irq_handler(&gs_handle) != 0)
53 {
54 return 1;
55 }
56 else
57 {
58 return 0;
59 }
60}
61
67static void a_callback(uint8_t type)
68{
69 switch (type)
70 {
72 {
73 apds9960_interface_debug_print("apds9960: irq gesture left.\n");
74 gs_flag = 1;
75
76 break;
77 }
79 {
80 apds9960_interface_debug_print("apds9960: irq gesture right.\n");
81 gs_flag = 1;
82
83 break;
84 }
86 {
87 apds9960_interface_debug_print("apds9960: irq gesture up.\n");
88 gs_flag = 1;
89
90 break;
91 }
93 {
94 apds9960_interface_debug_print("apds9960: irq gesture down.\n");
95 gs_flag = 1;
96
97 break;
98 }
100 {
101 apds9960_interface_debug_print("apds9960: irq gesture near.\n");
102 gs_flag = 1;
103
104 break;
105 }
107 {
108 apds9960_interface_debug_print("apds9960: irq gesture far.\n");
109 gs_flag = 1;
110
111 break;
112 }
114 {
115 apds9960_interface_debug_print("apds9960: irq gesture fifo overflow.\n");
116
117 break;
118 }
120 {
121 uint8_t res;
122 uint8_t len;
123
124 /* read gesture fifo */
125 len = 32;
126 res = apds9960_read_gesture_fifo(&gs_handle, gs_data, (uint8_t *)&len);
127 if (res != 0)
128 {
129 apds9960_interface_debug_print("apds9960: read gesture fifo failed.\n");
130 }
131
132 /* gesture decode */
133 if (len >= 4)
134 {
135 res = apds9960_gesture_decode(&gs_handle, gs_data, len);
136 if (res != 0)
137 {
138 apds9960_interface_debug_print("apds9960: gesture decode failed.\n");
139 }
140 }
141
142 break;
143 }
145 {
146 apds9960_interface_debug_print("apds9960: irq clear photo diode saturation.\n");
147
148 break;
149 }
151 {
152 apds9960_interface_debug_print("apds9960: irq analog saturation.\n");
153
154 break;
155 }
157 {
158 apds9960_interface_debug_print("apds9960: irq proximity interrupt.\n");
159
160 break;
161 }
163 {
164 apds9960_interface_debug_print("apds9960: irq als interrupt.\n");
165
166 break;
167 }
169 {
170 break;
171 }
173 {
174 break;
175 }
177 {
178 apds9960_interface_debug_print("apds9960: irq als valid.\n");
179
180 break;
181 }
182 default :
183 {
184 apds9960_interface_debug_print("apds9960: irq unknown.\n");
185
186 break;
187 }
188 }
189}
190
199uint8_t apds9960_gesture_test(uint32_t times)
200{
201 uint8_t res;
202 uint8_t reg;
203 uint32_t i;
204 apds9960_info_t info;
205
206 /* link interface function */
214 DRIVER_APDS9960_LINK_RECEIVE_CALLBACK(&gs_handle, a_callback);
215
216 /* get information */
217 res = apds9960_info(&info);
218 if (res != 0)
219 {
220 apds9960_interface_debug_print("apds9960: get info failed.\n");
221
222 return 1;
223 }
224 else
225 {
226 /* print chip info */
227 apds9960_interface_debug_print("apds9960: chip is %s.\n", info.chip_name);
228 apds9960_interface_debug_print("apds9960: manufacturer is %s.\n", info.manufacturer_name);
229 apds9960_interface_debug_print("apds9960: interface is %s.\n", info.interface);
230 apds9960_interface_debug_print("apds9960: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
231 apds9960_interface_debug_print("apds9960: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
232 apds9960_interface_debug_print("apds9960: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
233 apds9960_interface_debug_print("apds9960: max current is %0.2fmA.\n", info.max_current_ma);
234 apds9960_interface_debug_print("apds9960: max temperature is %0.1fC.\n", info.temperature_max);
235 apds9960_interface_debug_print("apds9960: min temperature is %0.1fC.\n", info.temperature_min);
236 }
237
238 /* start gesture test */
239 apds9960_interface_debug_print("apds9960: start gesture test.\n");
240
241 /* init the apds9960 */
242 res = apds9960_init(&gs_handle);
243 if (res != 0)
244 {
245 apds9960_interface_debug_print("apds9960: init failed.\n");
246
247 return 1;
248 }
249
250 /* power on */
252 if (res != 0)
253 {
254 apds9960_interface_debug_print("apds9960: set conf failed.\n");
255 (void)apds9960_deinit(&gs_handle);
256
257 return 1;
258 }
259
260 /* disable wait time */
262 if (res != 0)
263 {
264 apds9960_interface_debug_print("apds9960: set conf failed.\n");
265 (void)apds9960_deinit(&gs_handle);
266
267 return 1;
268 }
269
270 /* disable proximity detect */
272 if (res != 0)
273 {
274 apds9960_interface_debug_print("apds9960: set conf failed.\n");
275 (void)apds9960_deinit(&gs_handle);
276
277 return 1;
278 }
279
280 /* disable als */
282 if (res != 0)
283 {
284 apds9960_interface_debug_print("apds9960: set conf failed.\n");
285 (void)apds9960_deinit(&gs_handle);
286
287 return 1;
288 }
289
290 /* disable als interrupt */
292 if (res != 0)
293 {
294 apds9960_interface_debug_print("apds9960: set conf failed.\n");
295 (void)apds9960_deinit(&gs_handle);
296
297 return 1;
298 }
299
300 /* disable proximity interrupt */
302 if (res != 0)
303 {
304 apds9960_interface_debug_print("apds9960: set conf failed.\n");
305 (void)apds9960_deinit(&gs_handle);
306
307 return 1;
308 }
309
310 /* disable gesture */
312 if (res != 0)
313 {
314 apds9960_interface_debug_print("apds9960: set conf failed.\n");
315 (void)apds9960_deinit(&gs_handle);
316
317 return 1;
318 }
319
320 /* convert adc integration time */
321 res = apds9960_adc_integration_time_convert_to_register(&gs_handle, 103.0f, (uint8_t *)&reg);
322 if (res != 0)
323 {
324 apds9960_interface_debug_print("apds9960: adc integration time convert to register failed.\n");
325 (void)apds9960_deinit(&gs_handle);
326
327 return 1;
328 }
329
330 /* set adc integration time */
331 res = apds9960_set_adc_integration_time(&gs_handle, reg);
332 if (res != 0)
333 {
334 apds9960_interface_debug_print("apds9960: set adc integration time failed.\n");
335 (void)apds9960_deinit(&gs_handle);
336
337 return 1;
338 }
339
340 /* disable wait long */
342 if (res != 0)
343 {
344 apds9960_interface_debug_print("apds9960: set wait long failed.\n");
345 (void)apds9960_deinit(&gs_handle);
346
347 return 1;
348 }
349
350 /* wait time convert to register */
351 res = apds9960_wait_time_convert_to_register(&gs_handle, 10.0f, (uint8_t *)&reg);
352 if (res != 0)
353 {
354 apds9960_interface_debug_print("apds9960: wait time convert to register failed.\n");
355 (void)apds9960_deinit(&gs_handle);
356
357 return 1;
358 }
359
360 /* set wait time */
361 res = apds9960_set_wait_time(&gs_handle, reg);
362 if (res != 0)
363 {
364 apds9960_interface_debug_print("apds9960: set wait time failed.\n");
365 (void)apds9960_deinit(&gs_handle);
366
367 return 1;
368 }
369
370 /* set als interrupt low threshold */
371 res = apds9960_set_als_interrupt_low_threshold(&gs_handle, 0x0000U);
372 if (res != 0)
373 {
374 apds9960_interface_debug_print("apds9960: set als interrupt low threshold failed.\n");
375 (void)apds9960_deinit(&gs_handle);
376
377 return 1;
378 }
379
380 /* set als interrupt high threshold */
381 res = apds9960_set_als_interrupt_high_threshold(&gs_handle, 0xFFFFU);
382 if (res != 0)
383 {
384 apds9960_interface_debug_print("apds9960: set als interrupt high threshold failed.\n");
385 (void)apds9960_deinit(&gs_handle);
386
387 return 1;
388 }
389
390 /* set proximity interrupt low threshold */
392 if (res != 0)
393 {
394 apds9960_interface_debug_print("apds9960: set proximity interrupt low threshold failed.\n");
395 (void)apds9960_deinit(&gs_handle);
396
397 return 1;
398 }
399
400 /* set proximity interrupt high threshold */
402 if (res != 0)
403 {
404 apds9960_interface_debug_print("apds9960: set proximity interrupt high threshold failed.\n");
405 (void)apds9960_deinit(&gs_handle);
406
407 return 1;
408 }
409
410 /* proximity interrupt cycle 2 */
412 if (res != 0)
413 {
414 apds9960_interface_debug_print("apds9960: set proximity interrupt cycle failed.\n");
415 (void)apds9960_deinit(&gs_handle);
416
417 return 1;
418 }
419
420 /* als interrupt cycle 2 */
422 if (res != 0)
423 {
424 apds9960_interface_debug_print("apds9960: set als interrupt cycle failed.\n");
425 (void)apds9960_deinit(&gs_handle);
426
427 return 1;
428 }
429
430 /* set proximity pulse length */
432 if (res != 0)
433 {
434 apds9960_interface_debug_print("apds9960: set proximity pulse length failed.\n");
435 (void)apds9960_deinit(&gs_handle);
436
437 return 1;
438 }
439
440 /* set proximity pulse count */
441 res = apds9960_set_proximity_pulse_count(&gs_handle, 7);
442 if (res != 0)
443 {
444 apds9960_interface_debug_print("apds9960: set proximity pulse count failed.\n");
445 (void)apds9960_deinit(&gs_handle);
446
447 return 1;
448 }
449
450 /* set led current */
452 if (res != 0)
453 {
454 apds9960_interface_debug_print("apds9960: set led current failed.\n");
455 (void)apds9960_deinit(&gs_handle);
456
457 return 1;
458 }
459
460 /* set proximity gain */
462 if (res != 0)
463 {
464 apds9960_interface_debug_print("apds9960: set proximity gain failed.\n");
465 (void)apds9960_deinit(&gs_handle);
466
467 return 1;
468 }
469
470 /* set als color gain */
472 if (res != 0)
473 {
474 apds9960_interface_debug_print("apds9960: set als color gain failed.\n");
475 (void)apds9960_deinit(&gs_handle);
476
477 return 1;
478 }
479
480 /* enable proximity saturation interrupt */
482 if (res != 0)
483 {
484 apds9960_interface_debug_print("apds9960: set saturation interrupt failed.\n");
485 (void)apds9960_deinit(&gs_handle);
486
487 return 1;
488 }
489
490 /* enable clear photo diode saturation interrupt */
492 if (res != 0)
493 {
494 apds9960_interface_debug_print("apds9960: set saturation interrupt failed.\n");
495 (void)apds9960_deinit(&gs_handle);
496
497 return 1;
498 }
499
500 /* 100% */
502 if (res != 0)
503 {
504 apds9960_interface_debug_print("apds9960: set led boost failed.\n");
505 (void)apds9960_deinit(&gs_handle);
506
507 return 1;
508 }
509
510 /* set proximity up right offset */
511 res = apds9960_set_proximity_up_right_offset(&gs_handle, 0);
512 if (res != 0)
513 {
514 apds9960_interface_debug_print("apds9960: set proximity up right offset failed.\n");
515 (void)apds9960_deinit(&gs_handle);
516
517 return 1;
518 }
519
520 /* set proximity down left offset */
521 res = apds9960_set_proximity_down_left_offset(&gs_handle, 0);
522 if (res != 0)
523 {
524 apds9960_interface_debug_print("apds9960: set proximity down left offset failed.\n");
525 (void)apds9960_deinit(&gs_handle);
526
527 return 1;
528 }
529
530 /* set proximity gain compensation */
532 if (res != 0)
533 {
534 apds9960_interface_debug_print("apds9960: set proximity gain compensation failed.\n");
535 (void)apds9960_deinit(&gs_handle);
536
537 return 1;
538 }
539
540 /* disable */
542 if (res != 0)
543 {
544 apds9960_interface_debug_print("apds9960: set sleep after interrupt failed.\n");
545 (void)apds9960_deinit(&gs_handle);
546
547 return 1;
548 }
549
550 /* disable proximity mask up */
552 if (res != 0)
553 {
554 apds9960_interface_debug_print("apds9960: set proximity mask failed.\n");
555 (void)apds9960_deinit(&gs_handle);
556
557 return 1;
558 }
559
560 /* disable proximity mask down */
562 if (res != 0)
563 {
564 apds9960_interface_debug_print("apds9960: set proximity mask failed.\n");
565 (void)apds9960_deinit(&gs_handle);
566
567 return 1;
568 }
569
570 /* disable proximity mask left */
572 if (res != 0)
573 {
574 apds9960_interface_debug_print("apds9960: set proximity mask failed.\n");
575 (void)apds9960_deinit(&gs_handle);
576
577 return 1;
578 }
579
580 /* disable proximity mask right */
582 if (res != 0)
583 {
584 apds9960_interface_debug_print("apds9960: set proximity mask failed.\n");
585 (void)apds9960_deinit(&gs_handle);
586
587 return 1;
588 }
589
590 /* set gesture proximity enter threshold */
592 if (res != 0)
593 {
594 apds9960_interface_debug_print("apds9960: set gesture proximity enter threshold failed.\n");
595 (void)apds9960_deinit(&gs_handle);
596
597 return 1;
598 }
599
600 /* set gesture proximity exit threshold */
602 if (res != 0)
603 {
604 apds9960_interface_debug_print("apds9960: set gesture proximity exit threshold failed.\n");
605 (void)apds9960_deinit(&gs_handle);
606
607 return 1;
608 }
609
610 /* set gesture fifo threshold */
612 if (res != 0)
613 {
614 apds9960_interface_debug_print("apds9960: set gesture fifo threshold failed.\n");
615 (void)apds9960_deinit(&gs_handle);
616
617 return 1;
618 }
619
620 /* set gesture exit persistence */
622 if (res != 0)
623 {
624 apds9960_interface_debug_print("apds9960: set gesture exit persistence failed.\n");
625 (void)apds9960_deinit(&gs_handle);
626
627 return 1;
628 }
629
630 /* set gesture exit mask */
631 res = apds9960_set_gesture_exit_mask(&gs_handle, 0x00);
632 if (res != 0)
633 {
634 apds9960_interface_debug_print("apds9960: set gesture exit mask failed.\n");
635 (void)apds9960_deinit(&gs_handle);
636
637 return 1;
638 }
639
640 /* set gesture gain */
642 if (res != 0)
643 {
644 apds9960_interface_debug_print("apds9960: set gesture gain failed.\n");
645 (void)apds9960_deinit(&gs_handle);
646
647 return 1;
648 }
649
650 /* set gesture led current */
652 if (res != 0)
653 {
654 apds9960_interface_debug_print("apds9960: set gesture led current failed.\n");
655 (void)apds9960_deinit(&gs_handle);
656
657 return 1;
658 }
659
660 /* set gesture wait time */
662 if (res != 0)
663 {
664 apds9960_interface_debug_print("apds9960: set gesture wait time failed.\n");
665 (void)apds9960_deinit(&gs_handle);
666
667 return 1;
668 }
669
670 /* set gesture up offset */
671 res = apds9960_set_gesture_up_offset(&gs_handle, 0);
672 if (res != 0)
673 {
674 apds9960_interface_debug_print("apds9960: set gesture up offset failed.\n");
675 (void)apds9960_deinit(&gs_handle);
676
677 return 1;
678 }
679
680 /* set gesture down offset */
681 res = apds9960_set_gesture_down_offset(&gs_handle, 0);
682 if (res != 0)
683 {
684 apds9960_interface_debug_print("apds9960: set gesture down offset failed.\n");
685 (void)apds9960_deinit(&gs_handle);
686
687 return 1;
688 }
689
690 /* set gesture left offset */
691 res = apds9960_set_gesture_left_offset(&gs_handle, 0);
692 if (res != 0)
693 {
694 apds9960_interface_debug_print("apds9960: set gesture left offset failed.\n");
695 (void)apds9960_deinit(&gs_handle);
696
697 return 1;
698 }
699
700 /* set gesture right offset */
701 res = apds9960_set_gesture_right_offset(&gs_handle, 0);
702 if (res != 0)
703 {
704 apds9960_interface_debug_print("apds9960: set gesture right offset failed.\n");
705 (void)apds9960_deinit(&gs_handle);
706
707 return 1;
708 }
709
710 /* set gesture pulse length */
712 if (res != 0)
713 {
714 apds9960_interface_debug_print("apds9960: set gesture pulse length failed.\n");
715 (void)apds9960_deinit(&gs_handle);
716
717 return 1;
718 }
719
720 /* set gesture pulse count */
721 res = apds9960_set_gesture_pulse_count(&gs_handle, 9);
722 if (res != 0)
723 {
724 apds9960_interface_debug_print("apds9960: set gesture pulse count failed.\n");
725 (void)apds9960_deinit(&gs_handle);
726
727 return 1;
728 }
729
730 /* set gesture dimension */
732 if (res != 0)
733 {
734 apds9960_interface_debug_print("apds9960: set gesture dimension failed.\n");
735 (void)apds9960_deinit(&gs_handle);
736
737 return 1;
738 }
739
740 /* set gesture decode threshold */
741 res = apds9960_set_gesture_decode_threshold(&gs_handle, 10);
742 if (res != 0)
743 {
744 apds9960_interface_debug_print("apds9960: set gesture decode threshold failed.\n");
745 (void)apds9960_deinit(&gs_handle);
746
747 return 1;
748 }
749
750 /* set gesture decode sensitivity 1 */
751 res = apds9960_set_gesture_decode_sensitivity_1(&gs_handle, 50);
752 if (res != 0)
753 {
754 apds9960_interface_debug_print("apds9960: set gesture decode sensitivity 1 failed.\n");
755 (void)apds9960_deinit(&gs_handle);
756
757 return 1;
758 }
759
760 /* set gesture decode sensitivity 2 */
761 res = apds9960_set_gesture_decode_sensitivity_2(&gs_handle, 20);
762 if (res != 0)
763 {
764 apds9960_interface_debug_print("apds9960: set gesture decode sensitivity 2 failed.\n");
765 (void)apds9960_deinit(&gs_handle);
766
767 return 1;
768 }
769
770 /* gesture fifo clear */
771 res = apds9960_gesture_fifo_clear(&gs_handle);
772 if (res != 0)
773 {
774 apds9960_interface_debug_print("apds9960: gesture fifo clear failed.\n");
775 (void)apds9960_deinit(&gs_handle);
776
777 return 1;
778 }
779
780 /* set gesture interrupt */
782 if (res != 0)
783 {
784 apds9960_interface_debug_print("apds9960: set gesture interrupt failed.\n");
785 (void)apds9960_deinit(&gs_handle);
786
787 return 1;
788 }
789
790 /* set gesture mode */
792 if (res != 0)
793 {
794 apds9960_interface_debug_print("apds9960: set gesture mode failed.\n");
795 (void)apds9960_deinit(&gs_handle);
796
797 return 1;
798 }
799
800 /* all non gesture interrupt clear */
802 if (res != 0)
803 {
804 apds9960_interface_debug_print("apds9960: all non gesture interrupt clear failed.\n");
805 (void)apds9960_deinit(&gs_handle);
806
807 return 1;
808 }
809
810 /* enable wait time */
812 if (res != 0)
813 {
814 apds9960_interface_debug_print("apds9960: set conf failed.\n");
815 (void)apds9960_deinit(&gs_handle);
816
817 return 1;
818 }
819
820 /* enable proximity detect */
822 if (res != 0)
823 {
824 apds9960_interface_debug_print("apds9960: set conf failed.\n");
825 (void)apds9960_deinit(&gs_handle);
826
827 return 1;
828 }
829
830 /* enable gesture */
832 if (res != 0)
833 {
834 apds9960_interface_debug_print("apds9960: set conf failed.\n");
835 (void)apds9960_deinit(&gs_handle);
836
837 return 1;
838 }
839
840 gs_flag = 0;
841 for (i = 0; i < times; i++)
842 {
843 while (1)
844 {
845 if (gs_flag != 0)
846 {
847 gs_flag = 0;
848
849 /* 1000 ms */
851
852 break;
853 }
854 else
855 {
856 /* 1000 ms */
858
859 continue;
860 }
861 }
862 }
863
864 /* finish gesture test */
865 apds9960_interface_debug_print("apds9960: finish gesture test.\n");
866 (void)apds9960_deinit(&gs_handle);
867
868 return 0;
869}
driver apds9960 gesture 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_gesture_decode_sensitivity_2(apds9960_handle_t *handle, int32_t sensitivity)
set the gesture decode sensitivity 2
uint8_t apds9960_read_gesture_fifo(apds9960_handle_t *handle, uint8_t(*data)[4], uint8_t *len)
read data from the gesture fifo
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_gesture_decode(apds9960_handle_t *handle, uint8_t(*data)[4], uint8_t len)
decode gestures from the fifo data
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_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_irq_handler(apds9960_handle_t *handle)
irq handler
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_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_gesture_decode_threshold(apds9960_handle_t *handle, uint8_t threshold)
set the gesture decode threshold
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_decode_sensitivity_1(apds9960_handle_t *handle, int32_t sensitivity)
set the gesture decode sensitivity 1
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_INTERRUPT_STATUS_CPSAT
@ APDS9960_INTERRUPT_STATUS_GESTURE_NEAR
@ APDS9960_INTERRUPT_STATUS_AVALID
@ APDS9960_INTERRUPT_STATUS_GVALID
@ APDS9960_INTERRUPT_STATUS_GESTURE_RIGHT
@ APDS9960_INTERRUPT_STATUS_GESTURE_LEFT
@ APDS9960_INTERRUPT_STATUS_GESTURE_DOWN
@ APDS9960_INTERRUPT_STATUS_AINT
@ APDS9960_INTERRUPT_STATUS_GINT
@ APDS9960_INTERRUPT_STATUS_PGSAT
@ APDS9960_INTERRUPT_STATUS_GESTURE_FAR
@ APDS9960_INTERRUPT_STATUS_PVALID
@ APDS9960_INTERRUPT_STATUS_GESTURE_UP
@ APDS9960_INTERRUPT_STATUS_PINT
@ APDS9960_INTERRUPT_STATUS_GFOV
@ 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_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_gesture_test_irq_handler(void)
gesture test irq
uint8_t apds9960_gesture_test(uint32_t times)
gesture test
char manufacturer_name[32]