LibDriver MLX90614
Loading...
Searching...
No Matches
driver_mlx90614_read_test.c
Go to the documentation of this file.
1
36
38#include <stdlib.h>
39
40static mlx90614_handle_t gs_handle;
41
50uint8_t mlx90614_read_test(uint32_t times)
51{
52 uint8_t res;
53 float ambient;
54 float object;
55 float object2;
56 uint16_t raw;
57 uint16_t value;
58 uint16_t raw2;
59 uint32_t i;
60 mlx90614_info_t info;
61
62 /* link interface function */
72
73 /* get information */
74 res = mlx90614_info(&info);
75 if (res != 0)
76 {
77 mlx90614_interface_debug_print("mlx90614: get info failed.\n");
78
79 return 1;
80 }
81 else
82 {
83 /* print chip info */
84 mlx90614_interface_debug_print("mlx90614: chip is %s.\n", info.chip_name);
85 mlx90614_interface_debug_print("mlx90614: manufacturer is %s.\n", info.manufacturer_name);
86 mlx90614_interface_debug_print("mlx90614: interface is %s.\n", info.interface);
87 mlx90614_interface_debug_print("mlx90614: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
88 mlx90614_interface_debug_print("mlx90614: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
89 mlx90614_interface_debug_print("mlx90614: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
90 mlx90614_interface_debug_print("mlx90614: max current is %0.2fmA.\n", info.max_current_ma);
91 mlx90614_interface_debug_print("mlx90614: max temperature is %0.1fC.\n", info.temperature_max);
92 mlx90614_interface_debug_print("mlx90614: min temperature is %0.1fC.\n", info.temperature_min);
93 }
94
95 /* start read test */
96 mlx90614_interface_debug_print("mlx90614: start read test.\n");
97
98 /* set address */
100 if (res != 0)
101 {
102 mlx90614_interface_debug_print("mlx90614: set addr failed.\n");
103
104 return 1;
105 }
106
107 /* mlx90614 init */
108 res = mlx90614_init(&gs_handle);
109 if (res != 0)
110 {
111 mlx90614_interface_debug_print("mlx90614: init failed.\n");
112
113 return 1;
114 }
115
116 /* pwm to smbus */
117 res = mlx90614_pwm_to_smbus(&gs_handle);
118 if (res != 0)
119 {
120 mlx90614_interface_debug_print("mlx90614: pwm to smbus failed.\n");
121 (void)mlx90614_deinit(&gs_handle);
122
123 return 1;
124 }
125
126 /* exit sleep mode */
127 res = mlx90614_exit_sleep_mode(&gs_handle);
128 if (res != 0)
129 {
130 mlx90614_interface_debug_print("mlx90614: exit sleep mode failed.\n");
131 (void)mlx90614_deinit(&gs_handle);
132
133 return 1;
134 }
135
136 /* set mode */
137 res = mlx90614_set_mode(&gs_handle, MLX90614_MODE_TA_TOBJ1);
138 if (res != 0)
139 {
140 mlx90614_interface_debug_print("mlx90614: set mode failed.\n");
141 (void)mlx90614_deinit(&gs_handle);
142
143 return 1;
144 }
145
146 /* set fir length 8 */
148 if (res != 0)
149 {
150 mlx90614_interface_debug_print("mlx90614: set fir length failed.\n");
151 (void)mlx90614_deinit(&gs_handle);
152
153 return 1;
154 }
155 mlx90614_interface_debug_print("mlx90614: set fir length 8.\n");
156
157 /* delay 3000 ms */
159
160 /* read data */
161 for (i = 0; i < times; i++)
162 {
163 uint16_t channel_1;
164 uint16_t channel_2;
165
166 /* read ambient */
167 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
168 if (res != 0)
169 {
170 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
171 (void)mlx90614_deinit(&gs_handle);
172
173 return 1;
174 }
175
176 /* read object1 */
177 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
178 if (res != 0)
179 {
180 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
181 (void)mlx90614_deinit(&gs_handle);
182
183 return 1;
184 }
185
186 /* read raw ir channel */
187 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
188 if (res != 0)
189 {
190 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
191 (void)mlx90614_deinit(&gs_handle);
192
193 return 1;
194 }
195
196 /* print the data */
197 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
198 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
199
200 /* delay 1000 ms */
202 }
203
204 /* set fir length 16 */
206 if (res != 0)
207 {
208 mlx90614_interface_debug_print("mlx90614: set fir length failed.\n");
209 (void)mlx90614_deinit(&gs_handle);
210
211 return 1;
212 }
213 mlx90614_interface_debug_print("mlx90614: set fir length 16.\n");
214
215 /* delay 3000 ms */
217
218 /* read data */
219 for (i = 0; i < times; i++)
220 {
221 uint16_t channel_1;
222 uint16_t channel_2;
223
224 /* read ambient */
225 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
226 if (res != 0)
227 {
228 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
229 (void)mlx90614_deinit(&gs_handle);
230
231 return 1;
232 }
233
234 /* read object1 */
235 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
236 if (res != 0)
237 {
238 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
239 (void)mlx90614_deinit(&gs_handle);
240
241 return 1;
242 }
243
244 /* read raw ir channel */
245 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
246 if (res != 0)
247 {
248 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
249 (void)mlx90614_deinit(&gs_handle);
250
251 return 1;
252 }
253
254 /* print the data */
255 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
256 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
257
258 /* delay 1000 ms */
260 }
261
262 /* set fir length 32 */
264 if (res != 0)
265 {
266 mlx90614_interface_debug_print("mlx90614: set fir length failed.\n");
267 (void)mlx90614_deinit(&gs_handle);
268
269 return 1;
270 }
271 mlx90614_interface_debug_print("mlx90614: set fir length 32.\n");
272
273 /* delay 3000 ms */
275
276 /* read data */
277 for (i = 0; i < times; i++)
278 {
279 uint16_t channel_1;
280 uint16_t channel_2;
281
282 /* read ambient */
283 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
284 if (res != 0)
285 {
286 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
287 (void)mlx90614_deinit(&gs_handle);
288
289 return 1;
290 }
291
292 /* read object1 */
293 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
294 if (res != 0)
295 {
296 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
297 (void)mlx90614_deinit(&gs_handle);
298
299 return 1;
300 }
301
302 /* read raw ir channel */
303 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
304 if (res != 0)
305 {
306 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
307 (void)mlx90614_deinit(&gs_handle);
308
309 return 1;
310 }
311
312 /* print the data */
313 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
314 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
315
316 /* delay 1000 ms */
318 }
319
320 /* set fir length 64 */
322 if (res != 0)
323 {
324 mlx90614_interface_debug_print("mlx90614: set fir length failed.\n");
325 (void)mlx90614_deinit(&gs_handle);
326
327 return 1;
328 }
329 mlx90614_interface_debug_print("mlx90614: set fir length 64.\n");
330
331 /* delay 3000 ms */
333
334 /* read data */
335 for (i = 0; i < times; i++)
336 {
337 uint16_t channel_1;
338 uint16_t channel_2;
339
340 /* read ambient */
341 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
342 if (res != 0)
343 {
344 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
345 (void)mlx90614_deinit(&gs_handle);
346
347 return 1;
348 }
349
350 /* read object1 */
351 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
352 if (res != 0)
353 {
354 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
355 (void)mlx90614_deinit(&gs_handle);
356
357 return 1;
358 }
359
360 /* read raw ir channel */
361 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
362 if (res != 0)
363 {
364 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
365 (void)mlx90614_deinit(&gs_handle);
366
367 return 1;
368 }
369
370 /* print the data */
371 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
372 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
373
374 /* delay 1000 ms */
376 }
377
378 /* set fir length 128 */
380 if (res != 0)
381 {
382 mlx90614_interface_debug_print("mlx90614: set fir length failed.\n");
383 (void)mlx90614_deinit(&gs_handle);
384
385 return 1;
386 }
387 mlx90614_interface_debug_print("mlx90614: set fir length 128.\n");
388
389 /* delay 3000 ms */
391
392 /* read data */
393 for (i = 0; i < times; i++)
394 {
395 uint16_t channel_1;
396 uint16_t channel_2;
397
398 /* read ambient */
399 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
400 if (res != 0)
401 {
402 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
403 (void)mlx90614_deinit(&gs_handle);
404
405 return 1;
406 }
407
408 /* read object1 */
409 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
410 if (res != 0)
411 {
412 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
413 (void)mlx90614_deinit(&gs_handle);
414
415 return 1;
416 }
417
418 /* read raw ir channel */
419 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
420 if (res != 0)
421 {
422 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
423 (void)mlx90614_deinit(&gs_handle);
424
425 return 1;
426 }
427
428 /* print the data */
429 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
430 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
431
432 /* delay 1000 ms */
434 }
435
436 /* set fir length 256 */
438 if (res != 0)
439 {
440 mlx90614_interface_debug_print("mlx90614: set fir length failed.\n");
441 (void)mlx90614_deinit(&gs_handle);
442
443 return 1;
444 }
445 mlx90614_interface_debug_print("mlx90614: set fir length 256.\n");
446
447 /* delay 3000 ms */
449
450 /* read data */
451 for (i = 0; i < times; i++)
452 {
453 uint16_t channel_1;
454 uint16_t channel_2;
455
456 /* read ambient */
457 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
458 if (res != 0)
459 {
460 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
461 (void)mlx90614_deinit(&gs_handle);
462
463 return 1;
464 }
465
466 /* read object1 */
467 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
468 if (res != 0)
469 {
470 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
471 (void)mlx90614_deinit(&gs_handle);
472
473 return 1;
474 }
475
476 /* read raw ir channel */
477 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
478 if (res != 0)
479 {
480 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
481 (void)mlx90614_deinit(&gs_handle);
482
483 return 1;
484 }
485
486 /* print the data */
487 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
488 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
489
490 /* delay 1000 ms */
492 }
493
494 /* set fir length 512 */
496 if (res != 0)
497 {
498 mlx90614_interface_debug_print("mlx90614: set fir length failed.\n");
499 (void)mlx90614_deinit(&gs_handle);
500
501 return 1;
502 }
503 mlx90614_interface_debug_print("mlx90614: set fir length 512.\n");
504
505 /* delay 3000 ms */
507
508 /* read data */
509 for (i = 0; i < times; i++)
510 {
511 uint16_t channel_1;
512 uint16_t channel_2;
513
514 /* read ambient */
515 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
516 if (res != 0)
517 {
518 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
519 (void)mlx90614_deinit(&gs_handle);
520
521 return 1;
522 }
523
524 /* read object1 */
525 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
526 if (res != 0)
527 {
528 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
529 (void)mlx90614_deinit(&gs_handle);
530
531 return 1;
532 }
533
534 /* read raw ir channel */
535 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
536 if (res != 0)
537 {
538 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
539 (void)mlx90614_deinit(&gs_handle);
540
541 return 1;
542 }
543
544 /* print the data */
545 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
546 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
547
548 /* delay 1000 ms */
550 }
551
552 /* set fir length 1024 */
554 if (res != 0)
555 {
556 mlx90614_interface_debug_print("mlx90614: set fir length failed.\n");
557 (void)mlx90614_deinit(&gs_handle);
558
559 return 1;
560 }
561 mlx90614_interface_debug_print("mlx90614: set fir length 1024.\n");
562
563 /* delay 3000 ms */
565
566 /* read data */
567 for (i = 0; i < times; i++)
568 {
569 uint16_t channel_1;
570 uint16_t channel_2;
571
572 /* read ambient */
573 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
574 if (res != 0)
575 {
576 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
577 (void)mlx90614_deinit(&gs_handle);
578
579 return 1;
580 }
581
582 /* read object1 */
583 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
584 if (res != 0)
585 {
586 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
587 (void)mlx90614_deinit(&gs_handle);
588
589 return 1;
590 }
591
592 /* read raw ir channel */
593 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
594 if (res != 0)
595 {
596 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
597 (void)mlx90614_deinit(&gs_handle);
598
599 return 1;
600 }
601
602 /* print the data */
603 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
604 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
605
606 /* delay 1000 ms */
608 }
609
610 /* set iir a1 0.5 b1 0.5 */
612 if (res != 0)
613 {
614 mlx90614_interface_debug_print("mlx90614: set iir failed.\n");
615 (void)mlx90614_deinit(&gs_handle);
616
617 return 1;
618 }
619 mlx90614_interface_debug_print("mlx90614: set iir a1 0.5 b1 0.5.\n");
620
621 /* delay 3000 ms */
623
624 /* read data */
625 for (i = 0; i < times; i++)
626 {
627 uint16_t channel_1;
628 uint16_t channel_2;
629
630 /* read ambient */
631 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
632 if (res != 0)
633 {
634 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
635 (void)mlx90614_deinit(&gs_handle);
636
637 return 1;
638 }
639
640 /* read object1 */
641 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
642 if (res != 0)
643 {
644 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
645 (void)mlx90614_deinit(&gs_handle);
646
647 return 1;
648 }
649
650 /* read raw ir channel */
651 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
652 if (res != 0)
653 {
654 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
655 (void)mlx90614_deinit(&gs_handle);
656
657 return 1;
658 }
659
660 /* print the data */
661 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
662 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
663
664 /* delay 1000 ms */
666 }
667
668 /* set iir a1 0.25 b1 0.75 */
670 if (res != 0)
671 {
672 mlx90614_interface_debug_print("mlx90614: set iir failed.\n");
673 (void)mlx90614_deinit(&gs_handle);
674
675 return 1;
676 }
677 mlx90614_interface_debug_print("mlx90614: set iir a1 0.25 b1 0.75.\n");
678
679 /* delay 3000 ms */
681
682 /* read data */
683 for (i = 0; i < times; i++)
684 {
685 uint16_t channel_1;
686 uint16_t channel_2;
687
688 /* read ambient */
689 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
690 if (res != 0)
691 {
692 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
693 (void)mlx90614_deinit(&gs_handle);
694
695 return 1;
696 }
697
698 /* read object1 */
699 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
700 if (res != 0)
701 {
702 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
703 (void)mlx90614_deinit(&gs_handle);
704
705 return 1;
706 }
707
708 /* read raw ir channel */
709 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
710 if (res != 0)
711 {
712 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
713 (void)mlx90614_deinit(&gs_handle);
714
715 return 1;
716 }
717
718 /* print the data */
719 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
720 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
721
722 /* delay 1000 ms */
724 }
725
726 /* set iir a1 0.166 b1 0.83 */
728 if (res != 0)
729 {
730 mlx90614_interface_debug_print("mlx90614: set iir failed.\n");
731 (void)mlx90614_deinit(&gs_handle);
732
733 return 1;
734 }
735 mlx90614_interface_debug_print("mlx90614: set iir a1 0.166 b1 0.83.\n");
736
737 /* delay 3000 ms */
739
740 /* read data */
741 for (i = 0; i < times; i++)
742 {
743 uint16_t channel_1;
744 uint16_t channel_2;
745
746 /* read ambient */
747 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
748 if (res != 0)
749 {
750 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
751 (void)mlx90614_deinit(&gs_handle);
752
753 return 1;
754 }
755
756 /* read object1 */
757 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
758 if (res != 0)
759 {
760 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
761 (void)mlx90614_deinit(&gs_handle);
762
763 return 1;
764 }
765
766 /* read raw ir channel */
767 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
768 if (res != 0)
769 {
770 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
771 (void)mlx90614_deinit(&gs_handle);
772
773 return 1;
774 }
775
776 /* print the data */
777 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
778 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
779
780 /* delay 1000 ms */
782 }
783
784 /* set iir a1 0.125 b1 0.875 */
786 if (res != 0)
787 {
788 mlx90614_interface_debug_print("mlx90614: set iir failed.\n");
789 (void)mlx90614_deinit(&gs_handle);
790
791 return 1;
792 }
793 mlx90614_interface_debug_print("mlx90614: set iir a1 0.125 b1 0.875.\n");
794
795 /* delay 3000 ms */
797
798 /* read data */
799 for (i = 0; i < times; i++)
800 {
801 uint16_t channel_1;
802 uint16_t channel_2;
803
804 /* read ambient */
805 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
806 if (res != 0)
807 {
808 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
809 (void)mlx90614_deinit(&gs_handle);
810
811 return 1;
812 }
813
814 /* read object1 */
815 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
816 if (res != 0)
817 {
818 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
819 (void)mlx90614_deinit(&gs_handle);
820
821 return 1;
822 }
823
824 /* read raw ir channel */
825 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
826 if (res != 0)
827 {
828 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
829 (void)mlx90614_deinit(&gs_handle);
830
831 return 1;
832 }
833
834 /* print the data */
835 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
836 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
837
838 /* delay 1000 ms */
840 }
841
842 /* set iir a1 1 b1 0 */
843 res = mlx90614_set_iir(&gs_handle, MLX90614_IIR_A1_1_B1_0);
844 if (res != 0)
845 {
846 mlx90614_interface_debug_print("mlx90614: set iir failed.\n");
847 (void)mlx90614_deinit(&gs_handle);
848
849 return 1;
850 }
851 mlx90614_interface_debug_print("mlx90614: set iir a1 1 b1 0.\n");
852
853 /* delay 3000 ms */
855
856 /* read data */
857 for (i = 0; i < times; i++)
858 {
859 uint16_t channel_1;
860 uint16_t channel_2;
861
862 /* read ambient */
863 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
864 if (res != 0)
865 {
866 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
867 (void)mlx90614_deinit(&gs_handle);
868
869 return 1;
870 }
871
872 /* read object1 */
873 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
874 if (res != 0)
875 {
876 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
877 (void)mlx90614_deinit(&gs_handle);
878
879 return 1;
880 }
881
882 /* read raw ir channel */
883 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
884 if (res != 0)
885 {
886 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
887 (void)mlx90614_deinit(&gs_handle);
888
889 return 1;
890 }
891
892 /* print the data */
893 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
894 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
895
896 /* delay 1000 ms */
898 }
899
900 /* set iir a1 0.8 b1 0.2 */
902 if (res != 0)
903 {
904 mlx90614_interface_debug_print("mlx90614: set iir failed.\n");
905 (void)mlx90614_deinit(&gs_handle);
906
907 return 1;
908 }
909 mlx90614_interface_debug_print("mlx90614: set iir a1 0.8 b1 0.2.\n");
910
911 /* delay 3000 ms */
913
914 /* read data */
915 for (i = 0; i < times; i++)
916 {
917 uint16_t channel_1;
918 uint16_t channel_2;
919
920 /* read ambient */
921 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
922 if (res != 0)
923 {
924 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
925 (void)mlx90614_deinit(&gs_handle);
926
927 return 1;
928 }
929
930 /* read object1 */
931 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
932 if (res != 0)
933 {
934 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
935 (void)mlx90614_deinit(&gs_handle);
936
937 return 1;
938 }
939
940 /* read raw ir channel */
941 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
942 if (res != 0)
943 {
944 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
945 (void)mlx90614_deinit(&gs_handle);
946
947 return 1;
948 }
949
950 /* print the data */
951 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
952 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
953
954 /* delay 1000 ms */
956 }
957
958 /* set iir a1 0.666 b1 0.333 */
960 if (res != 0)
961 {
962 mlx90614_interface_debug_print("mlx90614: set iir failed.\n");
963 (void)mlx90614_deinit(&gs_handle);
964
965 return 1;
966 }
967 mlx90614_interface_debug_print("mlx90614: set iir a1 0.666 b1 0.333.\n");
968
969 /* delay 3000 ms */
971
972 /* read data */
973 for (i = 0; i < times; i++)
974 {
975 uint16_t channel_1;
976 uint16_t channel_2;
977
978 /* read ambient */
979 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
980 if (res != 0)
981 {
982 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
983 (void)mlx90614_deinit(&gs_handle);
984
985 return 1;
986 }
987
988 /* read object1 */
989 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
990 if (res != 0)
991 {
992 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
993 (void)mlx90614_deinit(&gs_handle);
994
995 return 1;
996 }
997
998 /* read raw ir channel */
999 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1000 if (res != 0)
1001 {
1002 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1003 (void)mlx90614_deinit(&gs_handle);
1004
1005 return 1;
1006 }
1007
1008 /* print the data */
1009 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1010 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1011
1012 /* delay 1000 ms */
1014 }
1015
1016 /* set iir a1 0.571 b1 0.428 */
1018 if (res != 0)
1019 {
1020 mlx90614_interface_debug_print("mlx90614: set iir failed.\n");
1021 (void)mlx90614_deinit(&gs_handle);
1022
1023 return 1;
1024 }
1025 mlx90614_interface_debug_print("mlx90614: set iir a1 0.571 b1 0.428.\n");
1026
1027 /* delay 3000 ms */
1029
1030 /* read data */
1031 for (i = 0; i < times; i++)
1032 {
1033 uint16_t channel_1;
1034 uint16_t channel_2;
1035
1036 /* read ambient */
1037 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1038 if (res != 0)
1039 {
1040 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1041 (void)mlx90614_deinit(&gs_handle);
1042
1043 return 1;
1044 }
1045
1046 /* read object1 */
1047 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1048 if (res != 0)
1049 {
1050 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1051 (void)mlx90614_deinit(&gs_handle);
1052
1053 return 1;
1054 }
1055
1056 /* read raw ir channel */
1057 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1058 if (res != 0)
1059 {
1060 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1061 (void)mlx90614_deinit(&gs_handle);
1062
1063 return 1;
1064 }
1065
1066 /* print the data */
1067 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1068 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1069
1070 /* delay 1000 ms */
1072 }
1073
1074 /* set ir sensor single */
1076 if (res != 0)
1077 {
1078 mlx90614_interface_debug_print("mlx90614: set ir sensor failed.\n");
1079 (void)mlx90614_deinit(&gs_handle);
1080
1081 return 1;
1082 }
1083 mlx90614_interface_debug_print("mlx90614: set ir sensor single.\n");
1084
1085 /* delay 3000 ms */
1087
1088 /* read data */
1089 for (i = 0; i < times; i++)
1090 {
1091 uint16_t channel_1;
1092 uint16_t channel_2;
1093
1094 /* read ambient */
1095 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1096 if (res != 0)
1097 {
1098 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1099 (void)mlx90614_deinit(&gs_handle);
1100
1101 return 1;
1102 }
1103
1104 /* read object1 */
1105 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1106 if (res != 0)
1107 {
1108 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1109 (void)mlx90614_deinit(&gs_handle);
1110
1111 return 1;
1112 }
1113
1114 /* read raw ir channel */
1115 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1116 if (res != 0)
1117 {
1118 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1119 (void)mlx90614_deinit(&gs_handle);
1120
1121 return 1;
1122 }
1123
1124 /* print the data */
1125 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1126 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1127
1128 /* delay 1000 ms */
1130 }
1131
1132 /* set ir sensor dual */
1134 if (res != 0)
1135 {
1136 mlx90614_interface_debug_print("mlx90614: set ir sensor failed.\n");
1137 (void)mlx90614_deinit(&gs_handle);
1138
1139 return 1;
1140 }
1141 mlx90614_interface_debug_print("mlx90614: set ir sensor dual.\n");
1142
1143 /* delay 3000 ms */
1145
1146 /* read data */
1147 for (i = 0; i < times; i++)
1148 {
1149 uint16_t channel_1;
1150 uint16_t channel_2;
1151
1152 /* read ambient */
1153 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1154 if (res != 0)
1155 {
1156 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1157 (void)mlx90614_deinit(&gs_handle);
1158
1159 return 1;
1160 }
1161
1162 /* read object1 */
1163 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1164 if (res != 0)
1165 {
1166 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1167 (void)mlx90614_deinit(&gs_handle);
1168
1169 return 1;
1170 }
1171
1172 /* read raw ir channel */
1173 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1174 if (res != 0)
1175 {
1176 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1177 (void)mlx90614_deinit(&gs_handle);
1178
1179 return 1;
1180 }
1181
1182 /* print the data */
1183 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1184 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1185
1186 /* delay 1000 ms */
1188 }
1189
1190 /* set ks positive */
1191 res = mlx90614_set_ks(&gs_handle, MLX90614_KS_POSITIVE);
1192 if (res != 0)
1193 {
1194 mlx90614_interface_debug_print("mlx90614: set ks failed.\n");
1195 (void)mlx90614_deinit(&gs_handle);
1196
1197 return 1;
1198 }
1199 mlx90614_interface_debug_print("mlx90614: set ks positive.\n");
1200
1201 /* delay 3000 ms */
1203
1204 /* read data */
1205 for (i = 0; i < times; i++)
1206 {
1207 uint16_t channel_1;
1208 uint16_t channel_2;
1209
1210 /* read ambient */
1211 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1212 if (res != 0)
1213 {
1214 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1215 (void)mlx90614_deinit(&gs_handle);
1216
1217 return 1;
1218 }
1219
1220 /* read object1 */
1221 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1222 if (res != 0)
1223 {
1224 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1225 (void)mlx90614_deinit(&gs_handle);
1226
1227 return 1;
1228 }
1229
1230 /* read raw ir channel */
1231 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1232 if (res != 0)
1233 {
1234 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1235 (void)mlx90614_deinit(&gs_handle);
1236
1237 return 1;
1238 }
1239
1240 /* print the data */
1241 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1242 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1243
1244 /* delay 1000 ms */
1246 }
1247
1248 /* set ks negative */
1249 res = mlx90614_set_ks(&gs_handle, MLX90614_KS_NEGATIVE);
1250 if (res != 0)
1251 {
1252 mlx90614_interface_debug_print("mlx90614: set ks failed.\n");
1253 (void)mlx90614_deinit(&gs_handle);
1254
1255 return 1;
1256 }
1257 mlx90614_interface_debug_print("mlx90614: set ks negative.\n");
1258
1259 /* delay 3000 ms */
1261
1262 /* read data */
1263 for (i = 0; i < times; i++)
1264 {
1265 uint16_t channel_1;
1266 uint16_t channel_2;
1267
1268 /* read ambient */
1269 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1270 if (res != 0)
1271 {
1272 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1273 (void)mlx90614_deinit(&gs_handle);
1274
1275 return 1;
1276 }
1277
1278 /* read object1 */
1279 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1280 if (res != 0)
1281 {
1282 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1283 (void)mlx90614_deinit(&gs_handle);
1284
1285 return 1;
1286 }
1287
1288 /* read raw ir channel */
1289 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1290 if (res != 0)
1291 {
1292 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1293 (void)mlx90614_deinit(&gs_handle);
1294
1295 return 1;
1296 }
1297
1298 /* print the data */
1299 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1300 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1301
1302 /* delay 1000 ms */
1304 }
1305
1306 /* set kt2 positive */
1307 res = mlx90614_set_kt2(&gs_handle, MLX90614_KT2_POSITIVE);
1308 if (res != 0)
1309 {
1310 mlx90614_interface_debug_print("mlx90614: set kt2 failed.\n");
1311 (void)mlx90614_deinit(&gs_handle);
1312
1313 return 1;
1314 }
1315 mlx90614_interface_debug_print("mlx90614: set kt2 positive.\n");
1316
1317 /* delay 3000 ms */
1319
1320 /* read data */
1321 for (i = 0; i < times; i++)
1322 {
1323 uint16_t channel_1;
1324 uint16_t channel_2;
1325
1326 /* read ambient */
1327 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1328 if (res != 0)
1329 {
1330 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1331 (void)mlx90614_deinit(&gs_handle);
1332
1333 return 1;
1334 }
1335
1336 /* read object1 */
1337 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1338 if (res != 0)
1339 {
1340 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1341 (void)mlx90614_deinit(&gs_handle);
1342
1343 return 1;
1344 }
1345
1346 /* read raw ir channel */
1347 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1348 if (res != 0)
1349 {
1350 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1351 (void)mlx90614_deinit(&gs_handle);
1352
1353 return 1;
1354 }
1355
1356 /* print the data */
1357 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1358 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1359
1360 /* delay 1000 ms */
1362 }
1363
1364 /* set kt2 negative */
1365 res = mlx90614_set_kt2(&gs_handle, MLX90614_KT2_NEGATIVE);
1366 if (res != 0)
1367 {
1368 mlx90614_interface_debug_print("mlx90614: set kt2 failed.\n");
1369 (void)mlx90614_deinit(&gs_handle);
1370
1371 return 1;
1372 }
1373 mlx90614_interface_debug_print("mlx90614: set kt2 negative.\n");
1374
1375 /* delay 3000 ms */
1377
1378 /* read data */
1379 for (i = 0; i < times; i++)
1380 {
1381 uint16_t channel_1;
1382 uint16_t channel_2;
1383
1384 /* read ambient */
1385 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1386 if (res != 0)
1387 {
1388 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1389 (void)mlx90614_deinit(&gs_handle);
1390
1391 return 1;
1392 }
1393
1394 /* read object1 */
1395 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1396 if (res != 0)
1397 {
1398 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1399 (void)mlx90614_deinit(&gs_handle);
1400
1401 return 1;
1402 }
1403
1404 /* read raw ir channel */
1405 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1406 if (res != 0)
1407 {
1408 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1409 (void)mlx90614_deinit(&gs_handle);
1410
1411 return 1;
1412 }
1413
1414 /* print the data */
1415 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1416 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1417
1418 /* delay 1000 ms */
1420 }
1421
1422 /* set gain 1 */
1423 res = mlx90614_set_gain(&gs_handle, MLX90614_GAIN_1);
1424 if (res != 0)
1425 {
1426 mlx90614_interface_debug_print("mlx90614: set gain failed.\n");
1427 (void)mlx90614_deinit(&gs_handle);
1428
1429 return 1;
1430 }
1431 mlx90614_interface_debug_print("mlx90614: set gain 1.\n");
1432
1433 /* delay 3000 ms */
1435
1436 /* read data */
1437 for (i = 0; i < times; i++)
1438 {
1439 uint16_t channel_1;
1440 uint16_t channel_2;
1441
1442 /* read ambient */
1443 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1444 if (res != 0)
1445 {
1446 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1447 (void)mlx90614_deinit(&gs_handle);
1448
1449 return 1;
1450 }
1451
1452 /* read object1 */
1453 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1454 if (res != 0)
1455 {
1456 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1457 (void)mlx90614_deinit(&gs_handle);
1458
1459 return 1;
1460 }
1461
1462 /* read raw ir channel */
1463 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1464 if (res != 0)
1465 {
1466 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1467 (void)mlx90614_deinit(&gs_handle);
1468
1469 return 1;
1470 }
1471
1472 /* print the data */
1473 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1474 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1475
1476 /* delay 1000 ms */
1478 }
1479
1480 /* set gain 3 */
1481 res = mlx90614_set_gain(&gs_handle, MLX90614_GAIN_3);
1482 if (res != 0)
1483 {
1484 mlx90614_interface_debug_print("mlx90614: set gain failed.\n");
1485 (void)mlx90614_deinit(&gs_handle);
1486
1487 return 1;
1488 }
1489 mlx90614_interface_debug_print("mlx90614: set gain 3.\n");
1490
1491 /* delay 3000 ms */
1493
1494 /* read data */
1495 for (i = 0; i < times; i++)
1496 {
1497 uint16_t channel_1;
1498 uint16_t channel_2;
1499
1500 /* read ambient */
1501 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1502 if (res != 0)
1503 {
1504 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1505 (void)mlx90614_deinit(&gs_handle);
1506
1507 return 1;
1508 }
1509
1510 /* read object1 */
1511 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1512 if (res != 0)
1513 {
1514 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1515 (void)mlx90614_deinit(&gs_handle);
1516
1517 return 1;
1518 }
1519
1520 /* read raw ir channel */
1521 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1522 if (res != 0)
1523 {
1524 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1525 (void)mlx90614_deinit(&gs_handle);
1526
1527 return 1;
1528 }
1529
1530 /* print the data */
1531 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1532 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1533
1534 /* delay 1000 ms */
1536 }
1537
1538 /* set gain 6 */
1539 res = mlx90614_set_gain(&gs_handle, MLX90614_GAIN_6);
1540 if (res != 0)
1541 {
1542 mlx90614_interface_debug_print("mlx90614: set gain failed.\n");
1543 (void)mlx90614_deinit(&gs_handle);
1544
1545 return 1;
1546 }
1547 mlx90614_interface_debug_print("mlx90614: set gain 6.\n");
1548
1549 /* delay 3000 ms */
1551
1552 /* read data */
1553 for (i = 0; i < times; i++)
1554 {
1555 uint16_t channel_1;
1556 uint16_t channel_2;
1557
1558 /* read ambient */
1559 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1560 if (res != 0)
1561 {
1562 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1563 (void)mlx90614_deinit(&gs_handle);
1564
1565 return 1;
1566 }
1567
1568 /* read object1 */
1569 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1570 if (res != 0)
1571 {
1572 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1573 (void)mlx90614_deinit(&gs_handle);
1574
1575 return 1;
1576 }
1577
1578 /* read raw ir channel */
1579 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1580 if (res != 0)
1581 {
1582 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1583 (void)mlx90614_deinit(&gs_handle);
1584
1585 return 1;
1586 }
1587
1588 /* print the data */
1589 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1590 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1591
1592 /* delay 1000 ms */
1594 }
1595
1596 /* set gain 12.5 */
1597 res = mlx90614_set_gain(&gs_handle, MLX90614_GAIN_12P5);
1598 if (res != 0)
1599 {
1600 mlx90614_interface_debug_print("mlx90614: set gain failed.\n");
1601 (void)mlx90614_deinit(&gs_handle);
1602
1603 return 1;
1604 }
1605 mlx90614_interface_debug_print("mlx90614: set gain 12.5.\n");
1606
1607 /* delay 3000 ms */
1609
1610 /* read data */
1611 for (i = 0; i < times; i++)
1612 {
1613 uint16_t channel_1;
1614 uint16_t channel_2;
1615
1616 /* read ambient */
1617 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1618 if (res != 0)
1619 {
1620 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1621 (void)mlx90614_deinit(&gs_handle);
1622
1623 return 1;
1624 }
1625
1626 /* read object1 */
1627 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1628 if (res != 0)
1629 {
1630 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1631 (void)mlx90614_deinit(&gs_handle);
1632
1633 return 1;
1634 }
1635
1636 /* read raw ir channel */
1637 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1638 if (res != 0)
1639 {
1640 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1641 (void)mlx90614_deinit(&gs_handle);
1642
1643 return 1;
1644 }
1645
1646 /* print the data */
1647 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1648 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1649
1650 /* delay 1000 ms */
1652 }
1653
1654 /* set gain 25 */
1655 res = mlx90614_set_gain(&gs_handle, MLX90614_GAIN_25);
1656 if (res != 0)
1657 {
1658 mlx90614_interface_debug_print("mlx90614: set gain failed.\n");
1659 (void)mlx90614_deinit(&gs_handle);
1660
1661 return 1;
1662 }
1663 mlx90614_interface_debug_print("mlx90614: set gain 25.\n");
1664
1665 /* delay 3000 ms */
1667
1668 /* read data */
1669 for (i = 0; i < times; i++)
1670 {
1671 uint16_t channel_1;
1672 uint16_t channel_2;
1673
1674 /* read ambient */
1675 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1676 if (res != 0)
1677 {
1678 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1679 (void)mlx90614_deinit(&gs_handle);
1680
1681 return 1;
1682 }
1683
1684 /* read object1 */
1685 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1686 if (res != 0)
1687 {
1688 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1689 (void)mlx90614_deinit(&gs_handle);
1690
1691 return 1;
1692 }
1693
1694 /* read raw ir channel */
1695 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1696 if (res != 0)
1697 {
1698 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1699 (void)mlx90614_deinit(&gs_handle);
1700
1701 return 1;
1702 }
1703
1704 /* print the data */
1705 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1706 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1707
1708 /* delay 1000 ms */
1710 }
1711
1712 /* set gain 50 */
1713 res = mlx90614_set_gain(&gs_handle, MLX90614_GAIN_50);
1714 if (res != 0)
1715 {
1716 mlx90614_interface_debug_print("mlx90614: set gain failed.\n");
1717 (void)mlx90614_deinit(&gs_handle);
1718
1719 return 1;
1720 }
1721 mlx90614_interface_debug_print("mlx90614: set gain 50.\n");
1722
1723 /* delay 3000 ms */
1725
1726 /* read data */
1727 for (i = 0; i < times; i++)
1728 {
1729 uint16_t channel_1;
1730 uint16_t channel_2;
1731
1732 /* read ambient */
1733 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1734 if (res != 0)
1735 {
1736 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1737 (void)mlx90614_deinit(&gs_handle);
1738
1739 return 1;
1740 }
1741
1742 /* read object1 */
1743 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1744 if (res != 0)
1745 {
1746 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1747 (void)mlx90614_deinit(&gs_handle);
1748
1749 return 1;
1750 }
1751
1752 /* read raw ir channel */
1753 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1754 if (res != 0)
1755 {
1756 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1757 (void)mlx90614_deinit(&gs_handle);
1758
1759 return 1;
1760 }
1761
1762 /* print the data */
1763 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1764 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1765
1766 /* delay 1000 ms */
1768 }
1769
1770 /* set gain 100 */
1771 res = mlx90614_set_gain(&gs_handle, MLX90614_GAIN_100);
1772 if (res != 0)
1773 {
1774 mlx90614_interface_debug_print("mlx90614: set gain failed.\n");
1775 (void)mlx90614_deinit(&gs_handle);
1776
1777 return 1;
1778 }
1779 mlx90614_interface_debug_print("mlx90614: set gain 100.\n");
1780
1781 /* delay 3000 ms */
1783
1784 /* read data */
1785 for (i = 0; i < times; i++)
1786 {
1787 uint16_t channel_1;
1788 uint16_t channel_2;
1789
1790 /* read ambient */
1791 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1792 if (res != 0)
1793 {
1794 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1795 (void)mlx90614_deinit(&gs_handle);
1796
1797 return 1;
1798 }
1799
1800 /* read object1 */
1801 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1802 if (res != 0)
1803 {
1804 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1805 (void)mlx90614_deinit(&gs_handle);
1806
1807 return 1;
1808 }
1809
1810 /* read raw ir channel */
1811 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1812 if (res != 0)
1813 {
1814 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1815 (void)mlx90614_deinit(&gs_handle);
1816
1817 return 1;
1818 }
1819
1820 /* print the data */
1821 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1822 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1823
1824 /* delay 1000 ms */
1826 }
1827
1828 value = rand() % 65536;
1829 res = mlx90614_set_emissivity_correction_coefficient(&gs_handle, value);
1830 if (res != 0)
1831 {
1832 mlx90614_interface_debug_print("mlx90614: set emissivity correction coefficient failed.\n");
1833 (void)mlx90614_deinit(&gs_handle);
1834
1835 return 1;
1836 }
1837 mlx90614_interface_debug_print("mlx90614: set emissivity correction coefficient %d.\n", value);
1838
1839 /* delay 3000 ms */
1841
1842 /* read data */
1843 for (i = 0; i < times; i++)
1844 {
1845 uint16_t channel_1;
1846 uint16_t channel_2;
1847
1848 /* read ambient */
1849 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1850 if (res != 0)
1851 {
1852 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1853 (void)mlx90614_deinit(&gs_handle);
1854
1855 return 1;
1856 }
1857
1858 /* read object1 */
1859 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1860 if (res != 0)
1861 {
1862 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1863 (void)mlx90614_deinit(&gs_handle);
1864
1865 return 1;
1866 }
1867
1868 /* read raw ir channel */
1869 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1870 if (res != 0)
1871 {
1872 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1873 (void)mlx90614_deinit(&gs_handle);
1874
1875 return 1;
1876 }
1877
1878 /* print the data */
1879 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1880 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1881
1882 /* delay 1000 ms */
1884 }
1885
1886 /* set ta tobj1 mode */
1887 res = mlx90614_set_mode(&gs_handle, MLX90614_MODE_TA_TOBJ1);
1888 if (res != 0)
1889 {
1890 mlx90614_interface_debug_print("mlx90614: set mode failed.\n");
1891 (void)mlx90614_deinit(&gs_handle);
1892
1893 return 1;
1894 }
1895 mlx90614_interface_debug_print("mlx90614: set ta tobj1 mode.\n");
1896
1897 /* delay 3000 ms */
1899
1900 /* read data */
1901 for (i = 0; i < times; i++)
1902 {
1903 uint16_t channel_1;
1904 uint16_t channel_2;
1905
1906 /* read ambient */
1907 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1908 if (res != 0)
1909 {
1910 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1911 (void)mlx90614_deinit(&gs_handle);
1912
1913 return 1;
1914 }
1915
1916 /* read object1 */
1917 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
1918 if (res != 0)
1919 {
1920 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
1921 (void)mlx90614_deinit(&gs_handle);
1922
1923 return 1;
1924 }
1925
1926 /* read raw ir channel */
1927 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1928 if (res != 0)
1929 {
1930 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1931 (void)mlx90614_deinit(&gs_handle);
1932
1933 return 1;
1934 }
1935
1936 /* print the data */
1937 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1938 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1939
1940 /* delay 1000 ms */
1942 }
1943
1944 /* set ta tobj2 mode */
1945 res = mlx90614_set_mode(&gs_handle, MLX90614_MODE_TA_TOBJ2);
1946 if (res != 0)
1947 {
1948 mlx90614_interface_debug_print("mlx90614: set mode failed.\n");
1949 (void)mlx90614_deinit(&gs_handle);
1950
1951 return 1;
1952 }
1953 mlx90614_interface_debug_print("mlx90614: set ta tobj2 mode.\n");
1954
1955 /* delay 3000 ms */
1957
1958 /* read data */
1959 for (i = 0; i < times; i++)
1960 {
1961 uint16_t channel_1;
1962 uint16_t channel_2;
1963
1964 /* read ambient */
1965 res = mlx90614_read_ambient(&gs_handle, (uint16_t *)&raw, (float *)&ambient);
1966 if (res != 0)
1967 {
1968 mlx90614_interface_debug_print("mlx90614: read ambient failed.\n");
1969 (void)mlx90614_deinit(&gs_handle);
1970
1971 return 1;
1972 }
1973
1974 /* read object2 */
1975 res = mlx90614_read_object2(&gs_handle, (uint16_t *)&raw, (float *)&object);
1976 if (res != 0)
1977 {
1978 mlx90614_interface_debug_print("mlx90614: read object2 failed.\n");
1979 (void)mlx90614_deinit(&gs_handle);
1980
1981 return 1;
1982 }
1983
1984 /* read raw ir channel */
1985 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
1986 if (res != 0)
1987 {
1988 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
1989 (void)mlx90614_deinit(&gs_handle);
1990
1991 return 1;
1992 }
1993
1994 /* print the data */
1995 mlx90614_interface_debug_print("mlx90614: ambient is %0.2fC object is %0.2fC.\n", ambient, object);
1996 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
1997
1998 /* delay 1000 ms */
2000 }
2001
2002 /* set tobj2 mode */
2003 res = mlx90614_set_mode(&gs_handle, MLX90614_MODE_TOBJ2);
2004 if (res != 0)
2005 {
2006 mlx90614_interface_debug_print("mlx90614: set mode failed.\n");
2007 (void)mlx90614_deinit(&gs_handle);
2008
2009 return 1;
2010 }
2011 mlx90614_interface_debug_print("mlx90614: set tobj2 mode.\n");
2012
2013 /* delay 3000 ms */
2015
2016 /* read data */
2017 for (i = 0; i < times; i++)
2018 {
2019 uint16_t channel_1;
2020 uint16_t channel_2;
2021
2022 /* read object2 */
2023 res = mlx90614_read_object2(&gs_handle, (uint16_t *)&raw, (float *)&object);
2024 if (res != 0)
2025 {
2026 mlx90614_interface_debug_print("mlx90614: read object2 failed.\n");
2027 (void)mlx90614_deinit(&gs_handle);
2028
2029 return 1;
2030 }
2031
2032 /* read raw ir channel */
2033 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
2034 if (res != 0)
2035 {
2036 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
2037 (void)mlx90614_deinit(&gs_handle);
2038
2039 return 1;
2040 }
2041
2042 /* print the data */
2043 mlx90614_interface_debug_print("mlx90614: object is %0.2fC.\n", object);
2044 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
2045
2046 /* delay 1000 ms */
2048 }
2049
2050 /* set tobj1 tobj2 mode */
2052 if (res != 0)
2053 {
2054 mlx90614_interface_debug_print("mlx90614: set mode failed.\n");
2055 (void)mlx90614_deinit(&gs_handle);
2056
2057 return 1;
2058 }
2059 mlx90614_interface_debug_print("mlx90614: set tobj1 tobj2 mode.\n");
2060
2061 /* delay 3000 ms */
2063
2064 /* read data */
2065 for (i = 0; i < times; i++)
2066 {
2067 uint16_t channel_1;
2068 uint16_t channel_2;
2069
2070 /* read object1 */
2071 res = mlx90614_read_object1(&gs_handle, (uint16_t *)&raw, (float *)&object);
2072 if (res != 0)
2073 {
2074 mlx90614_interface_debug_print("mlx90614: read object1 failed.\n");
2075 (void)mlx90614_deinit(&gs_handle);
2076
2077 return 1;
2078 }
2079
2080 /* read object2 */
2081 res = mlx90614_read_object2(&gs_handle, (uint16_t *)&raw2, (float *)&object2);
2082 if (res != 0)
2083 {
2084 mlx90614_interface_debug_print("mlx90614: read object2 failed.\n");
2085 (void)mlx90614_deinit(&gs_handle);
2086
2087 return 1;
2088 }
2089
2090 /* read raw ir channel */
2091 res = mlx90614_read_raw_ir_channel(&gs_handle, (uint16_t *)&channel_1, (uint16_t *)&channel_2);
2092 if (res != 0)
2093 {
2094 mlx90614_interface_debug_print("mlx90614: read raw ir channel failed.\n");
2095 (void)mlx90614_deinit(&gs_handle);
2096
2097 return 1;
2098 }
2099
2100 /* print the data */
2101 mlx90614_interface_debug_print("mlx90614: object1 is %0.2fC object2 is %0.2fC.\n", object, object2);
2102 mlx90614_interface_debug_print("mlx90614: channel1 raw is 0x%04X channel2 raw is 0x%04X.\n", channel_1, channel_2);
2103
2104 /* delay 1000 ms */
2106 }
2107
2108 /* finish read test */
2109 mlx90614_interface_debug_print("mlx90614: finish read test.\n");
2110 (void)mlx90614_deinit(&gs_handle);
2111
2112 return 0;
2113}
driver mlx90614 read test header file
uint8_t mlx90614_set_gain(mlx90614_handle_t *handle, mlx90614_gain_t gain)
set the gain param
uint8_t mlx90614_set_fir_length(mlx90614_handle_t *handle, mlx90614_fir_length_t len)
set the ir sensor fir length
uint8_t mlx90614_set_mode(mlx90614_handle_t *handle, mlx90614_mode_t mode)
set the mode
uint8_t mlx90614_set_emissivity_correction_coefficient(mlx90614_handle_t *handle, uint16_t value)
set the emissivity correction coefficient
uint8_t mlx90614_set_iir(mlx90614_handle_t *handle, mlx90614_iir_t iir)
set the iir param
uint8_t mlx90614_set_ir_sensor(mlx90614_handle_t *handle, mlx90614_ir_sensor_t sensor)
set the ir sensor mode
uint8_t mlx90614_exit_sleep_mode(mlx90614_handle_t *handle)
exit from sleep mode
uint8_t mlx90614_set_ks(mlx90614_handle_t *handle, mlx90614_ks_t ks)
set the ks param
uint8_t mlx90614_pwm_to_smbus(mlx90614_handle_t *handle)
change pwm mode to smbus mode
uint8_t mlx90614_set_kt2(mlx90614_handle_t *handle, mlx90614_kt2_t kt2)
set the kt2 param
@ MLX90614_GAIN_3
@ MLX90614_GAIN_25
@ MLX90614_GAIN_12P5
@ MLX90614_GAIN_1
@ MLX90614_GAIN_50
@ MLX90614_GAIN_6
@ MLX90614_GAIN_100
@ MLX90614_IR_SENSOR_SINGLE
@ MLX90614_IR_SENSOR_DUAL
@ MLX90614_KS_NEGATIVE
@ MLX90614_KS_POSITIVE
@ MLX90614_MODE_TOBJ1_TOBJ2
@ MLX90614_MODE_TOBJ2
@ MLX90614_MODE_TA_TOBJ1
@ MLX90614_MODE_TA_TOBJ2
@ MLX90614_IIR_A1_0P25_B1_0P75
@ MLX90614_IIR_A1_0P571_B1_0P428
@ MLX90614_IIR_A1_0P5_B1_0P5
@ MLX90614_IIR_A1_0P166_B1_0P83
@ MLX90614_IIR_A1_0P8_B1_0P2
@ MLX90614_IIR_A1_0P666_B1_0P333
@ MLX90614_IIR_A1_0P125_B1_0P875
@ MLX90614_IIR_A1_1_B1_0
@ MLX90614_KT2_POSITIVE
@ MLX90614_KT2_NEGATIVE
@ MLX90614_FIR_LENGTH_16
@ MLX90614_FIR_LENGTH_64
@ MLX90614_FIR_LENGTH_128
@ MLX90614_FIR_LENGTH_1024
@ MLX90614_FIR_LENGTH_32
@ MLX90614_FIR_LENGTH_256
@ MLX90614_FIR_LENGTH_512
@ MLX90614_FIR_LENGTH_8
uint8_t mlx90614_read_raw_ir_channel(mlx90614_handle_t *handle, uint16_t *channel_1, uint16_t *channel_2)
read the ir channel raw data
uint8_t mlx90614_read_object1(mlx90614_handle_t *handle, uint16_t *raw, float *celsius)
read the object1
uint8_t mlx90614_info(mlx90614_info_t *info)
get chip information
uint8_t mlx90614_init(mlx90614_handle_t *handle)
initialize the chip
uint8_t mlx90614_set_addr(mlx90614_handle_t *handle, uint8_t addr)
set the address
uint8_t mlx90614_read_ambient(mlx90614_handle_t *handle, uint16_t *raw, float *celsius)
read the ambient
struct mlx90614_info_s mlx90614_info_t
mlx90614 information structure definition
uint8_t mlx90614_deinit(mlx90614_handle_t *handle)
close the chip
uint8_t mlx90614_read_object2(mlx90614_handle_t *handle, uint16_t *raw, float *celsius)
read the object2
struct mlx90614_handle_s mlx90614_handle_t
mlx90614 handle structure definition
@ MLX90614_ADDRESS_DEFAULT
uint8_t mlx90614_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
uint8_t mlx90614_interface_iic_init(void)
interface iic bus init
void mlx90614_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t mlx90614_interface_iic_deinit(void)
interface iic bus deinit
uint8_t mlx90614_interface_sda_write(uint8_t value)
interface sda write
uint8_t mlx90614_interface_scl_write(uint8_t value)
interface scl write
uint8_t mlx90614_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
void mlx90614_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t mlx90614_read_test(uint32_t times)
read test
char manufacturer_name[32]