LibDriver HDC2080
Loading...
Searching...
No Matches
driver_hdc2080_read_test.c
Go to the documentation of this file.
1
36
38
39static hdc2080_handle_t gs_handle;
40
50uint8_t hdc2080_read_test(hdc2080_address_t addr_pin, uint32_t times)
51{
52 uint8_t res;
53 uint8_t reg;
54 uint8_t max;
55 int8_t offset;
56 uint32_t i;
57 float percent;
58 float deg;
59 hdc2080_info_t info;
60
61 /* link interface function */
69
70 /* get hdc2080 information */
71 res = hdc2080_info(&info);
72 if (res != 0)
73 {
74 hdc2080_interface_debug_print("hdc2080: get info failed.\n");
75
76 return 1;
77 }
78 else
79 {
80 /* print hdc2080 information */
81 hdc2080_interface_debug_print("hdc2080: chip is %s.\n", info.chip_name);
82 hdc2080_interface_debug_print("hdc2080: manufacturer is %s.\n", info.manufacturer_name);
83 hdc2080_interface_debug_print("hdc2080: interface is %s.\n", info.interface);
84 hdc2080_interface_debug_print("hdc2080: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
85 hdc2080_interface_debug_print("hdc2080: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
86 hdc2080_interface_debug_print("hdc2080: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
87 hdc2080_interface_debug_print("hdc2080: max current is %0.2fmA.\n", info.max_current_ma);
88 hdc2080_interface_debug_print("hdc2080: max temperature is %0.1fC.\n", info.temperature_max);
89 hdc2080_interface_debug_print("hdc2080: min temperature is %0.1fC.\n", info.temperature_min);
90 }
91
92 /* start basic read test */
93 hdc2080_interface_debug_print("hdc2080: start read test.\n");
94
95 /* set addr pin */
96 res = hdc2080_set_addr_pin(&gs_handle, addr_pin);
97 if (res != 0)
98 {
99 hdc2080_interface_debug_print("hdc2080: set addr pin failed.\n");
100
101 return 1;
102 }
103
104 /* hdc2080 init */
105 res = hdc2080_init(&gs_handle);
106 if (res != 0)
107 {
108 hdc2080_interface_debug_print("hdc2080: init failed.\n");
109
110 return 1;
111 }
112
113 /* set temperature resolution 14bits */
115 if (res != 0)
116 {
117 hdc2080_interface_debug_print("hdc2080: set temperature resolution failed.\n");
118 (void)hdc2080_deinit(&gs_handle);
119
120 return 1;
121 }
122
123 /* set humidity resolution 14bits */
125 if (res != 0)
126 {
127 hdc2080_interface_debug_print("hdc2080: set humidity resolution failed.\n");
128 (void)hdc2080_deinit(&gs_handle);
129
130 return 1;
131 }
132
133 /* set humidity and temperature */
135 if (res != 0)
136 {
137 hdc2080_interface_debug_print("hdc2080: set mode failed.\n");
138 (void)hdc2080_deinit(&gs_handle);
139
140 return 1;
141 }
142
143 /* disable heater */
144 res = hdc2080_set_heater(&gs_handle, HDC2080_BOOL_FALSE);
145 if (res != 0)
146 {
147 hdc2080_interface_debug_print("hdc2080: set heater failed.\n");
148 (void)hdc2080_deinit(&gs_handle);
149
150 return 1;
151 }
152
153 /* disable interrupt pin */
155 if (res != 0)
156 {
157 hdc2080_interface_debug_print("hdc2080: set interrupt pin failed.\n");
158 (void)hdc2080_deinit(&gs_handle);
159
160 return 1;
161 }
162
163 /* set interrupt polarity low */
165 if (res != 0)
166 {
167 hdc2080_interface_debug_print("hdc2080: set interrupt polarity failed.\n");
168 (void)hdc2080_deinit(&gs_handle);
169
170 return 1;
171 }
172
173 /* set comparator mode */
175 if (res != 0)
176 {
177 hdc2080_interface_debug_print("hdc2080: set interrupt mode failed.\n");
178 (void)hdc2080_deinit(&gs_handle);
179
180 return 1;
181 }
182
183 /* 0.0% */
184 res = hdc2080_humidity_convert_to_register(&gs_handle, 0.0f, &reg);
185 if (res != 0)
186 {
187 hdc2080_interface_debug_print("hdc2080: humidity convert to register failed.\n");
188 (void)hdc2080_deinit(&gs_handle);
189
190 return 1;
191 }
192
193 /* set humidity high threshold */
194 res = hdc2080_set_humidity_high_threshold(&gs_handle, reg);
195 if (res != 0)
196 {
197 hdc2080_interface_debug_print("hdc2080: set humidity high threshold failed.\n");
198 (void)hdc2080_deinit(&gs_handle);
199
200 return 1;
201 }
202
203 /* set humidity low threshold */
204 res = hdc2080_set_humidity_low_threshold(&gs_handle, reg);
205 if (res != 0)
206 {
207 hdc2080_interface_debug_print("hdc2080: set humidity low threshold failed.\n");
208 (void)hdc2080_deinit(&gs_handle);
209
210 return 1;
211 }
212
213 /* 0.0 */
214 res = hdc2080_temperature_convert_to_register(&gs_handle, 0.0f, &reg);
215 if (res != 0)
216 {
217 hdc2080_interface_debug_print("hdc2080: temperature convert to register failed.\n");
218 (void)hdc2080_deinit(&gs_handle);
219
220 return 1;
221 }
222
223 /* set temperature high threshold */
224 res = hdc2080_set_temperature_high_threshold(&gs_handle, reg);
225 if (res != 0)
226 {
227 hdc2080_interface_debug_print("hdc2080: set temperature high threshold failed.\n");
228 (void)hdc2080_deinit(&gs_handle);
229
230 return 1;
231 }
232
233 /* set temperature low threshold */
234 res = hdc2080_set_temperature_low_threshold(&gs_handle, reg);
235 if (res != 0)
236 {
237 hdc2080_interface_debug_print("hdc2080: set temperature low threshold failed.\n");
238 (void)hdc2080_deinit(&gs_handle);
239
240 return 1;
241 }
242
243 /* 0.0 */
244 res = hdc2080_humidity_offset_convert_to_register(&gs_handle, 0.0f, &offset);
245 if (res != 0)
246 {
247 hdc2080_interface_debug_print("hdc2080: humidity offset convert to register failed.\n");
248 (void)hdc2080_deinit(&gs_handle);
249
250 return 1;
251 }
252
253 /* set humidity offset adjustment */
254 res = hdc2080_set_humidity_offset_adjustment(&gs_handle, offset);
255 if (res != 0)
256 {
257 hdc2080_interface_debug_print("hdc2080: set humidity offset adjustment failed.\n");
258 (void)hdc2080_deinit(&gs_handle);
259
260 return 1;
261 }
262
263 /* 0.0 */
264 res = hdc2080_temperature_offset_convert_to_register(&gs_handle, 0.0f, &offset);
265 if (res != 0)
266 {
267 hdc2080_interface_debug_print("hdc2080: temperature offset convert to register failed.\n");
268 (void)hdc2080_deinit(&gs_handle);
269
270 return 1;
271 }
272
273 /* set temperature offset adjustment */
274 res = hdc2080_set_temperature_offset_adjustment(&gs_handle, offset);
275 if (res != 0)
276 {
277 hdc2080_interface_debug_print("hdc2080: set temperature offset adjustment failed.\n");
278 (void)hdc2080_deinit(&gs_handle);
279
280 return 1;
281 }
282
283 /* disable data ready */
285 if (res != 0)
286 {
287 hdc2080_interface_debug_print("hdc2080: set interrupt failed.\n");
288 (void)hdc2080_deinit(&gs_handle);
289
290 return 1;
291 }
292
293 /* disable temperature high threshold */
295 if (res != 0)
296 {
297 hdc2080_interface_debug_print("hdc2080: set interrupt failed.\n");
298 (void)hdc2080_deinit(&gs_handle);
299
300 return 1;
301 }
302
303 /* disable temperature low threshold */
305 if (res != 0)
306 {
307 hdc2080_interface_debug_print("hdc2080: set interrupt failed.\n");
308 (void)hdc2080_deinit(&gs_handle);
309
310 return 1;
311 }
312
313 /* disable humidity high threshold */
315 if (res != 0)
316 {
317 hdc2080_interface_debug_print("hdc2080: set interrupt failed.\n");
318 (void)hdc2080_deinit(&gs_handle);
319
320 return 1;
321 }
322
323 /* disable humidity low threshold */
325 if (res != 0)
326 {
327 hdc2080_interface_debug_print("hdc2080: set interrupt failed.\n");
328 (void)hdc2080_deinit(&gs_handle);
329
330 return 1;
331 }
332
333 /* disable auto measurement mode */
335 if (res != 0)
336 {
337 hdc2080_interface_debug_print("hdc2080: set auto measurement mode failed.\n");
338 (void)hdc2080_deinit(&gs_handle);
339
340 return 1;
341 }
342
343 /* output */
344 hdc2080_interface_debug_print("hdc2080: shot read test.\n");
345
346 /* loop */
347 for (i = 0; i < times; i++)
348 {
349 uint16_t temperature_raw;
350 float temperature_s;
351 uint16_t humidity_raw;
352 float humidity_s;
353
354 /* read poll */
355 res = hdc2080_read_poll(&gs_handle);
356 if (res != 0)
357 {
358 hdc2080_interface_debug_print("hdc2080: read poll failed.\n");
359 (void)hdc2080_deinit(&gs_handle);
360
361 return 1;
362 }
363
364 /* read temperature humidity */
365 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
366 if (res != 0)
367 {
368 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
369 (void)hdc2080_deinit(&gs_handle);
370
371 return 1;
372 }
373
374 /* output */
375 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
376 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
377
378 /* delay 1000ms */
380 }
381
382 /* get humidity max */
383 res = hdc2080_get_humidity_max(&gs_handle, &max);
384 if (res != 0)
385 {
386 hdc2080_interface_debug_print("hdc2080: get humidity max failed.\n");
387 (void)hdc2080_deinit(&gs_handle);
388
389 return 1;
390 }
391
392 /* humidity convert to data */
393 res = hdc2080_humidity_convert_to_data(&gs_handle, max, &percent);
394 if (res != 0)
395 {
396 hdc2080_interface_debug_print("hdc2080: humidity convert to data failed.\n");
397 (void)hdc2080_deinit(&gs_handle);
398
399 return 1;
400 }
401
402 /* output */
403 hdc2080_interface_debug_print("hdc2080: humidity max is %0.2f%%.\n", percent);
404
405 /* get temperature max */
406 res = hdc2080_get_temperature_max(&gs_handle, &max);
407 if (res != 0)
408 {
409 hdc2080_interface_debug_print("hdc2080: get temperature max failed.\n");
410 (void)hdc2080_deinit(&gs_handle);
411
412 return 1;
413 }
414
415 /* temperature convert to data */
416 res = hdc2080_temperature_convert_to_data(&gs_handle, max, &deg);
417 if (res != 0)
418 {
419 hdc2080_interface_debug_print("hdc2080: temperature convert to data failed.\n");
420 (void)hdc2080_deinit(&gs_handle);
421
422 return 1;
423 }
424
425 /* output */
426 hdc2080_interface_debug_print("hdc2080: temperature max is %0.2fC.\n", deg);
427
428 /* set auto measurement mode 5 hz */
430 if (res != 0)
431 {
432 hdc2080_interface_debug_print("hdc2080: set auto measurement mode failed.\n");
433 (void)hdc2080_deinit(&gs_handle);
434
435 return 1;
436 }
437
438 /* enable measurement */
440 if (res != 0)
441 {
442 hdc2080_interface_debug_print("hdc2080: set measurement failed.\n");
443 (void)hdc2080_deinit(&gs_handle);
444
445 return 1;
446 }
447
448 /* output */
449 hdc2080_interface_debug_print("hdc2080: set auto measure 5 hz.\n");
450
451 /* loop */
452 for (i = 0; i < times; i++)
453 {
454 uint16_t temperature_raw;
455 float temperature_s;
456 uint16_t humidity_raw;
457 float humidity_s;
458
459 /* read temperature humidity */
460 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
461 if (res != 0)
462 {
463 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
464 (void)hdc2080_deinit(&gs_handle);
465
466 return 1;
467 }
468
469 /* output */
470 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
471 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
472
473 /* delay 1000ms */
475 }
476
477 /* set auto measurement mode 2 hz */
479 if (res != 0)
480 {
481 hdc2080_interface_debug_print("hdc2080: set auto measurement mode failed.\n");
482 (void)hdc2080_deinit(&gs_handle);
483
484 return 1;
485 }
486
487 /* output */
488 hdc2080_interface_debug_print("hdc2080: set auto measure 2 hz.\n");
489
490 /* loop */
491 for (i = 0; i < times; i++)
492 {
493 uint16_t temperature_raw;
494 float temperature_s;
495 uint16_t humidity_raw;
496 float humidity_s;
497
498 /* read temperature humidity */
499 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
500 if (res != 0)
501 {
502 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
503 (void)hdc2080_deinit(&gs_handle);
504
505 return 1;
506 }
507
508 /* output */
509 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
510 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
511
512 /* delay 1000ms */
514 }
515
516 /* set auto measurement mode 1 hz */
518 if (res != 0)
519 {
520 hdc2080_interface_debug_print("hdc2080: set auto measurement mode failed.\n");
521 (void)hdc2080_deinit(&gs_handle);
522
523 return 1;
524 }
525
526 /* output */
527 hdc2080_interface_debug_print("hdc2080: set auto measure 1 hz.\n");
528
529 /* loop */
530 for (i = 0; i < times; i++)
531 {
532 uint16_t temperature_raw;
533 float temperature_s;
534 uint16_t humidity_raw;
535 float humidity_s;
536
537 /* read temperature humidity */
538 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
539 if (res != 0)
540 {
541 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
542 (void)hdc2080_deinit(&gs_handle);
543
544 return 1;
545 }
546
547 /* output */
548 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
549 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
550
551 /* delay 1000ms */
553 }
554
555 /* set auto measurement mode 1/5 hz */
557 if (res != 0)
558 {
559 hdc2080_interface_debug_print("hdc2080: set auto measurement mode failed.\n");
560 (void)hdc2080_deinit(&gs_handle);
561
562 return 1;
563 }
564
565 /* output */
566 hdc2080_interface_debug_print("hdc2080: set auto measure 1/5 hz.\n");
567
568 /* loop */
569 for (i = 0; i < times; i++)
570 {
571 uint16_t temperature_raw;
572 float temperature_s;
573 uint16_t humidity_raw;
574 float humidity_s;
575
576 /* read temperature humidity */
577 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
578 if (res != 0)
579 {
580 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
581 (void)hdc2080_deinit(&gs_handle);
582
583 return 1;
584 }
585
586 /* output */
587 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
588 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
589
590 /* delay 1000ms */
592 }
593
594 /* set auto measurement mode 1/10 hz */
596 if (res != 0)
597 {
598 hdc2080_interface_debug_print("hdc2080: set auto measurement mode failed.\n");
599 (void)hdc2080_deinit(&gs_handle);
600
601 return 1;
602 }
603
604 /* output */
605 hdc2080_interface_debug_print("hdc2080: set auto measure 1/10 hz.\n");
606
607 /* loop */
608 for (i = 0; i < times; i++)
609 {
610 uint16_t temperature_raw;
611 float temperature_s;
612 uint16_t humidity_raw;
613 float humidity_s;
614
615 /* read temperature humidity */
616 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
617 if (res != 0)
618 {
619 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
620 (void)hdc2080_deinit(&gs_handle);
621
622 return 1;
623 }
624
625 /* output */
626 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
627 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
628
629 /* delay 1000ms */
631 }
632
633 /* set auto measurement mode 1/60 hz */
635 if (res != 0)
636 {
637 hdc2080_interface_debug_print("hdc2080: set auto measurement mode failed.\n");
638 (void)hdc2080_deinit(&gs_handle);
639
640 return 1;
641 }
642
643 /* output */
644 hdc2080_interface_debug_print("hdc2080: set auto measure 1/60 hz.\n");
645
646 /* loop */
647 for (i = 0; i < times; i++)
648 {
649 uint16_t temperature_raw;
650 float temperature_s;
651 uint16_t humidity_raw;
652 float humidity_s;
653
654 /* read temperature humidity */
655 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
656 if (res != 0)
657 {
658 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
659 (void)hdc2080_deinit(&gs_handle);
660
661 return 1;
662 }
663
664 /* output */
665 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
666 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
667
668 /* delay 1000ms */
670 }
671
672 /* set auto measurement mode 1/120 hz */
674 if (res != 0)
675 {
676 hdc2080_interface_debug_print("hdc2080: set auto measurement mode failed.\n");
677 (void)hdc2080_deinit(&gs_handle);
678
679 return 1;
680 }
681
682 /* output */
683 hdc2080_interface_debug_print("hdc2080: set auto measure 1/120 hz.\n");
684
685 /* loop */
686 for (i = 0; i < times; i++)
687 {
688 uint16_t temperature_raw;
689 float temperature_s;
690 uint16_t humidity_raw;
691 float humidity_s;
692
693 /* read temperature humidity */
694 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
695 if (res != 0)
696 {
697 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
698 (void)hdc2080_deinit(&gs_handle);
699
700 return 1;
701 }
702
703 /* output */
704 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
705 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
706
707 /* delay 1000ms */
709 }
710
711 /* set auto measurement mode 5 hz */
713 if (res != 0)
714 {
715 hdc2080_interface_debug_print("hdc2080: set auto measurement mode failed.\n");
716 (void)hdc2080_deinit(&gs_handle);
717
718 return 1;
719 }
720
721 /* output */
722 hdc2080_interface_debug_print("hdc2080: set resolution 11bits.\n");
723
724 /* set temperature resolution 11bits */
726 if (res != 0)
727 {
728 hdc2080_interface_debug_print("hdc2080: set temperature resolution failed.\n");
729 (void)hdc2080_deinit(&gs_handle);
730
731 return 1;
732 }
733
734 /* set humidity resolution 11bits */
736 if (res != 0)
737 {
738 hdc2080_interface_debug_print("hdc2080: set humidity resolution failed.\n");
739 (void)hdc2080_deinit(&gs_handle);
740
741 return 1;
742 }
743
744 /* loop */
745 for (i = 0; i < times; i++)
746 {
747 uint16_t temperature_raw;
748 float temperature_s;
749 uint16_t humidity_raw;
750 float humidity_s;
751
752 /* read temperature humidity */
753 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
754 if (res != 0)
755 {
756 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
757 (void)hdc2080_deinit(&gs_handle);
758
759 return 1;
760 }
761
762 /* output */
763 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
764 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
765
766 /* delay 1000ms */
768 }
769
770 /* output */
771 hdc2080_interface_debug_print("hdc2080: set resolution 9bits.\n");
772
773 /* set temperature resolution 9bits */
775 if (res != 0)
776 {
777 hdc2080_interface_debug_print("hdc2080: set temperature resolution failed.\n");
778 (void)hdc2080_deinit(&gs_handle);
779
780 return 1;
781 }
782
783 /* set humidity resolution 9bits */
785 if (res != 0)
786 {
787 hdc2080_interface_debug_print("hdc2080: set humidity resolution failed.\n");
788 (void)hdc2080_deinit(&gs_handle);
789
790 return 1;
791 }
792
793 /* loop */
794 for (i = 0; i < times; i++)
795 {
796 uint16_t temperature_raw;
797 float temperature_s;
798 uint16_t humidity_raw;
799 float humidity_s;
800
801 /* read temperature humidity */
802 res = hdc2080_read_temperature_humidity(&gs_handle, &temperature_raw, &temperature_s, &humidity_raw, &humidity_s);
803 if (res != 0)
804 {
805 hdc2080_interface_debug_print("hdc2080: read temperature humidity failed.\n");
806 (void)hdc2080_deinit(&gs_handle);
807
808 return 1;
809 }
810
811 /* output */
812 hdc2080_interface_debug_print("hdc2080: temperature[%d] is %0.2fC.\n", i, temperature_s);
813 hdc2080_interface_debug_print("hdc2080: humidity[%d] is %0.2f%%.\n", i, humidity_s);
814
815 /* delay 1000ms */
817 }
818
819 /* finish read test and exit */
820 hdc2080_interface_debug_print("hdc2080: finish read test.\n");
821 (void)hdc2080_deinit(&gs_handle);
822
823 return 0;
824}
driver hdc2080 read test header file
uint8_t hdc2080_set_measurement(hdc2080_handle_t *handle, hdc2080_bool_t enable)
enable or disable measurement
uint8_t hdc2080_init(hdc2080_handle_t *handle)
initialize the chip
uint8_t hdc2080_set_temperature_offset_adjustment(hdc2080_handle_t *handle, int8_t offset)
set temperature offset adjustment
uint8_t hdc2080_set_temperature_low_threshold(hdc2080_handle_t *handle, uint8_t threshold)
set temperature low threshold
uint8_t hdc2080_set_auto_measurement_mode(hdc2080_handle_t *handle, hdc2080_auto_measurement_mode_t mode)
set auto measurement mode
struct hdc2080_handle_s hdc2080_handle_t
hdc2080 handle structure definition
uint8_t hdc2080_set_humidity_resolution(hdc2080_handle_t *handle, hdc2080_resolution_t resolution)
set humidity resolution
uint8_t hdc2080_read_temperature_humidity(hdc2080_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
read the temperature and humidity data
uint8_t hdc2080_deinit(hdc2080_handle_t *handle)
close the chip
uint8_t hdc2080_humidity_offset_convert_to_register(hdc2080_handle_t *handle, float percent, int8_t *reg)
convert the humidity offset to the register raw data
uint8_t hdc2080_set_temperature_resolution(hdc2080_handle_t *handle, hdc2080_resolution_t resolution)
set temperature resolution
uint8_t hdc2080_temperature_offset_convert_to_register(hdc2080_handle_t *handle, float deg, int8_t *reg)
convert the temperature offset to the register raw data
uint8_t hdc2080_temperature_convert_to_data(hdc2080_handle_t *handle, uint8_t reg, float *deg)
convert the register raw data to the temperature
uint8_t hdc2080_humidity_convert_to_data(hdc2080_handle_t *handle, uint8_t reg, float *percent)
convert the register raw data to the humidity
uint8_t hdc2080_set_interrupt_pin(hdc2080_handle_t *handle, hdc2080_bool_t enable)
enable or disable interrupt pin
uint8_t hdc2080_set_humidity_low_threshold(hdc2080_handle_t *handle, uint8_t threshold)
set humidity low threshold
uint8_t hdc2080_get_humidity_max(hdc2080_handle_t *handle, uint8_t *max)
get humidity max
uint8_t hdc2080_set_addr_pin(hdc2080_handle_t *handle, hdc2080_address_t addr_pin)
set the iic address pin
uint8_t hdc2080_set_mode(hdc2080_handle_t *handle, hdc2080_mode_t mode)
set the chip mode
uint8_t hdc2080_set_humidity_high_threshold(hdc2080_handle_t *handle, uint8_t threshold)
set humidity high threshold
uint8_t hdc2080_set_interrupt_polarity(hdc2080_handle_t *handle, hdc2080_interrupt_polarity_t polarity)
set interrupt polarity
uint8_t hdc2080_set_interrupt_mode(hdc2080_handle_t *handle, hdc2080_interrupt_mode_t mode)
set interrupt mode
struct hdc2080_info_s hdc2080_info_t
hdc2080 information structure definition
uint8_t hdc2080_set_humidity_offset_adjustment(hdc2080_handle_t *handle, int8_t offset)
set humidity offset adjustment
uint8_t hdc2080_set_heater(hdc2080_handle_t *handle, hdc2080_bool_t enable)
enable or disable heater
uint8_t hdc2080_humidity_convert_to_register(hdc2080_handle_t *handle, float percent, uint8_t *reg)
convert the humidity to the register raw data
uint8_t hdc2080_info(hdc2080_info_t *info)
get chip's information
uint8_t hdc2080_get_temperature_max(hdc2080_handle_t *handle, uint8_t *max)
get temperature max
uint8_t hdc2080_set_interrupt(hdc2080_handle_t *handle, hdc2080_interrupt_t interrupt, hdc2080_bool_t enable)
enable or disable interrupt
uint8_t hdc2080_temperature_convert_to_register(hdc2080_handle_t *handle, float deg, uint8_t *reg)
convert the temperature to the register raw data
uint8_t hdc2080_set_temperature_high_threshold(hdc2080_handle_t *handle, uint8_t threshold)
set temperature high threshold
uint8_t hdc2080_read_poll(hdc2080_handle_t *handle)
read poll
hdc2080_address_t
hdc2080 address enumeration definition
@ HDC2080_BOOL_TRUE
@ HDC2080_BOOL_FALSE
@ HDC2080_RESOLUTION_9_BIT
@ HDC2080_RESOLUTION_11_BIT
@ HDC2080_RESOLUTION_14_BIT
@ HDC2080_AUTO_MEASUREMENT_MODE_1_HZ
@ HDC2080_AUTO_MEASUREMENT_MODE_1_DIV_120_HZ
@ HDC2080_AUTO_MEASUREMENT_MODE_1_DIV_60_HZ
@ HDC2080_AUTO_MEASUREMENT_MODE_1_DIV_5_HZ
@ HDC2080_AUTO_MEASUREMENT_MODE_2_HZ
@ HDC2080_AUTO_MEASUREMENT_MODE_5_HZ
@ HDC2080_AUTO_MEASUREMENT_MODE_DISABLED
@ HDC2080_AUTO_MEASUREMENT_MODE_1_DIV_10_HZ
@ HDC2080_INTERRUPT_POLARITY_LOW
@ HDC2080_INTERRUPT_MODE_COMPARATOR
@ HDC2080_INTERRUPT_DRDY
@ HDC2080_INTERRUPT_HUMIDITY_HIGH_THRESHOLD
@ HDC2080_INTERRUPT_HUMIDITY_LOW_THRESHOLD
@ HDC2080_INTERRUPT_TEMPERATURE_LOW_THRESHOLD
@ HDC2080_INTERRUPT_TEMPERATURE_HIGH_THRESHOLD
@ HDC2080_MODE_HUMIDITY_TEMPERATURE
uint8_t hdc2080_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
void hdc2080_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t hdc2080_interface_iic_init(void)
interface iic bus init
uint8_t hdc2080_interface_iic_deinit(void)
interface iic bus deinit
uint8_t hdc2080_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
void hdc2080_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t hdc2080_read_test(hdc2080_address_t addr_pin, uint32_t times)
read test
uint32_t driver_version
char manufacturer_name[32]