LibDriver HDC1080
Loading...
Searching...
No Matches
driver_hdc1080.c
Go to the documentation of this file.
1
36
37#include "driver_hdc1080.h"
38
42#define CHIP_NAME "Texas Instruments HDC1080"
43#define MANUFACTURER_NAME "Texas Instruments"
44#define SUPPLY_VOLTAGE_MIN 2.7f
45#define SUPPLY_VOLTAGE_MAX 5.5f
46#define MAX_CURRENT 7.2f
47#define TEMPERATURE_MIN -40.0f
48#define TEMPERATURE_MAX 125.0f
49#define DRIVER_VERSION 1000
50
54#define HDC1080_ADDRESS 0x80
55
59#define HDC1080_REG_TEMPERATURE 0x00
60#define HDC1080_REG_HUMIDITY 0x01
61#define HDC1080_REG_CONFIG 0x02
62#define HDC1080_REG_SERIAL_ID_0 0xFB
63#define HDC1080_REG_SERIAL_ID_1 0xFC
64#define HDC1080_REG_SERIAL_ID_2 0xFD
65#define HDC1080_REG_MANUFACTURER_ID 0xFE
66#define HDC1080_REG_DEVICE_ID 0xFF
67
78static uint8_t a_hdc1080_iic_read_with_wait(hdc1080_handle_t *handle, uint8_t reg, uint16_t *data)
79{
80 uint8_t buf[2];
81
82 if (handle->iic_read_with_wait(HDC1080_ADDRESS, reg, buf, 2) != 0) /* read the register */
83 {
84 return 1; /* return error */
85 }
86 else
87 {
88 *data = (uint16_t)((uint16_t)buf[0] << 8 | buf[1]); /* get data */
89
90 return 0; /* success return 0 */
91 }
92}
93
104static uint8_t a_hdc1080_iic_read(hdc1080_handle_t *handle, uint8_t reg, uint16_t *data)
105{
106 uint8_t buf[2];
107
108 if (handle->iic_read(HDC1080_ADDRESS, reg, buf, 2) != 0) /* read the register */
109 {
110 return 1; /* return error */
111 }
112 else
113 {
114 *data = (uint16_t)((uint16_t)buf[0] << 8 | buf[1]); /* get data */
115
116 return 0; /* success return 0 */
117 }
118}
119
130static uint8_t a_hdc1080_iic_write(hdc1080_handle_t *handle, uint8_t reg, uint16_t data)
131{
132 uint8_t buf[2];
133
134 buf[0] = (data >> 8) & 0xFF; /* msb */
135 buf[1] = (data >> 0) & 0xFF; /* lsb */
136 if (handle->iic_write(HDC1080_ADDRESS, reg, buf, 2) != 0) /* write the register */
137 {
138 return 1; /* return error */
139 }
140 else
141 {
142 return 0; /* success return 0 */
143 }
144}
145
160{
161 uint8_t res;
162 uint16_t data;
163 uint16_t id;
164
165 if (handle == NULL) /* check handle */
166 {
167 return 2; /* return error */
168 }
169 if (handle->debug_print == NULL) /* check debug_print */
170 {
171 return 3; /* return error */
172 }
173 if (handle->iic_init == NULL) /* check iic_init */
174 {
175 handle->debug_print("hdc1080: iic_init is null.\n"); /* iic_init is null */
176
177 return 3; /* return error */
178 }
179 if (handle->iic_deinit == NULL) /* check iic_deinit */
180 {
181 handle->debug_print("hdc1080: iic_deinit is null.\n"); /* iic_deinit is null */
182
183 return 3; /* return error */
184 }
185 if (handle->iic_read == NULL) /* check iic_read */
186 {
187 handle->debug_print("hdc1080: iic_read is null.\n"); /* iic_read is null */
188
189 return 3; /* return error */
190 }
191 if (handle->iic_read_with_wait == NULL) /* check iic_read_with_wait */
192 {
193 handle->debug_print("hdc1080: iic_read_with_wait is null.\n"); /* iic_read_with_wait is null */
194
195 return 3; /* return error */
196 }
197 if (handle->iic_write == NULL) /* check iic_write */
198 {
199 handle->debug_print("hdc1080: iic_write is null.\n"); /* iic_write is null */
200
201 return 3; /* return error */
202 }
203 if (handle->delay_ms == NULL) /* check delay_ms */
204 {
205 handle->debug_print("hdc1080: delay_ms is null.\n"); /* delay_ms is null */
206
207 return 3; /* return error */
208 }
209
210 if (handle->iic_init() != 0) /* iic init */
211 {
212 handle->debug_print("hdc1080: iic init failed.\n"); /* iic init failed */
213
214 return 1; /* return error */
215 }
216 res = a_hdc1080_iic_read(handle, HDC1080_REG_MANUFACTURER_ID, &id); /* read manufacturer id */
217 if (res != 0) /* check result */
218 {
219 handle->debug_print("hdc1080: read manufacturer id failed.\n"); /* read manufacturer id failed */
220 (void)handle->iic_deinit(); /* iic deinit */
221
222 return 4; /* return error */
223 }
224 if (id != 0x5449) /* check id */
225 {
226 handle->debug_print("hdc1080: manufacturer id is invalid.\n"); /* read manufacturer id failed */
227 (void)handle->iic_deinit(); /* iic deinit */
228
229 return 5; /* return error */
230 }
231 res = a_hdc1080_iic_read(handle, HDC1080_REG_DEVICE_ID, &id); /* read device id */
232 if (res != 0) /* check result */
233 {
234 handle->debug_print("hdc1080: read device id failed.\n"); /* read device id failed */
235 (void)handle->iic_deinit(); /* iic deinit */
236
237 return 4; /* return error */
238 }
239 if (id != 0x1050) /* check id */
240 {
241 handle->debug_print("hdc1080: device id is invalid.\n"); /* read device id failed */
242 (void)handle->iic_deinit(); /* iic deinit */
243
244 return 5; /* return error */
245 }
246
247 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
248 if (res != 0) /* check result */
249 {
250 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
251 (void)handle->iic_deinit(); /* iic deinit */
252
253 return 6; /* return error */
254 }
255 data &= ~(1 << 15); /* clear settings */
256 data |= 1 << 15; /* software reset */
257 res = a_hdc1080_iic_write(handle, HDC1080_REG_CONFIG, data); /* write config */
258 if (res != 0) /* check result */
259 {
260 handle->debug_print("hdc1080: write config failed.\n"); /* write config failed */
261 (void)handle->iic_deinit(); /* iic deinit */
262
263 return 6; /* return error */
264 }
265 handle->delay_ms(100); /* delay 100ms */
266 handle->inited = 1; /* flag finish initialization */
267
268 return 0; /* success return 0 */
269}
270
282{
283 if (handle == NULL) /* check handle */
284 {
285 return 2; /* return error */
286 }
287 if (handle->inited != 1) /* check handle initialization */
288 {
289 return 3; /* return error */
290 }
291
292 if (handle->iic_deinit() != 0) /* iic deinit */
293 {
294 handle->debug_print("hdc1080: iic deinit failed.\n"); /* iic deinit failed */
295
296 return 1; /* return error */
297 }
298 handle->inited = 0; /* set closed flag */
299
300 return 0; /* success return 0 */
301}
302
317uint8_t hdc1080_read_temperature_humidity(hdc1080_handle_t *handle, uint16_t *temperature_raw, float *temperature_s,
318 uint16_t *humidity_raw, float *humidity_s)
319{
320 uint8_t res;
321
322 if (handle == NULL) /* check handle */
323 {
324 return 2; /* return error */
325 }
326 if (handle->inited != 1) /* check handle initialization */
327 {
328 return 3; /* return error */
329 }
330
331 res = a_hdc1080_iic_read_with_wait(handle, HDC1080_REG_TEMPERATURE,
332 temperature_raw); /* read temperature */
333 if (res != 0) /* check result */
334 {
335 handle->debug_print("hdc1080: read temperature failed.\n"); /* read temperature failed */
336
337 return 1; /* return error */
338 }
339 *temperature_s = (float)(*temperature_raw) / 65536.0f * 165.0f - 40.0f; /* convert temperature */
340 res = a_hdc1080_iic_read_with_wait(handle, HDC1080_REG_HUMIDITY, humidity_raw); /* read humidity */
341 if (res != 0) /* check result */
342 {
343 handle->debug_print("hdc1080: read humidity failed.\n"); /* read humidity failed */
344
345 return 1; /* return error */
346 }
347 *humidity_s = (float)(*humidity_raw) / 65536.0f * 100.0f; /* get humidity */
348
349 return 0; /* success return 0 */
350}
351
364uint8_t hdc1080_read_temperature(hdc1080_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
365{
366 uint8_t res;
367
368 if (handle == NULL) /* check handle */
369 {
370 return 2; /* return error */
371 }
372 if (handle->inited != 1) /* check handle initialization */
373 {
374 return 3; /* return error */
375 }
376
377 res = a_hdc1080_iic_read_with_wait(handle, HDC1080_REG_TEMPERATURE, temperature_raw); /* read temperature */
378 if (res != 0) /* check result */
379 {
380 handle->debug_print("hdc1080: read temperature failed.\n"); /* read temperature failed */
381
382 return 1; /* return error */
383 }
384 *temperature_s = (float)(*temperature_raw) / 65536.0f * 165.0f - 40.0f; /* convert temperature */
385
386 return 0; /* success return 0 */
387}
388
401uint8_t hdc1080_read_humidity(hdc1080_handle_t *handle, uint16_t *humidity_raw, float *humidity_s)
402{
403 uint8_t res;
404
405 if (handle == NULL) /* check handle */
406 {
407 return 2; /* return error */
408 }
409 if (handle->inited != 1) /* check handle initialization */
410 {
411 return 3; /* return error */
412 }
413
414 res = a_hdc1080_iic_read_with_wait(handle, HDC1080_REG_HUMIDITY, humidity_raw); /* read humidity */
415 if (res != 0) /* check result */
416 {
417 handle->debug_print("hdc1080: read humidity failed.\n"); /* read humidity failed */
418
419 return 1; /* return error */
420 }
421 *humidity_s = (float)(*humidity_raw) / 65536.0f * 100.0f; /* get humidity */
422
423 return 0; /* success return 0 */
424}
425
437{
438 uint8_t res;
439 uint16_t data;
440
441 if (handle == NULL) /* check handle */
442 {
443 return 2; /* return error */
444 }
445 if (handle->inited != 1) /* check handle initialization */
446 {
447 return 3; /* return error */
448 }
449
450 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
451 if (res != 0)
452 {
453 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
454
455 return 1; /* return error */
456 }
457 data &= ~(1 << 15); /* clear settings */
458 data |= 1 << 15; /* software reset */
459 res = a_hdc1080_iic_write(handle, HDC1080_REG_CONFIG, data); /* write config */
460 if (res != 0)
461 {
462 handle->debug_print("hdc1080: write config failed.\n"); /* write config failed */
463
464 return 1; /* return error */
465 }
466 handle->delay_ms(100); /* delay 100ms */
467
468 return 0; /* success return 0 */
469}
470
483{
484 uint8_t res;
485 uint16_t data;
486
487 if (handle == NULL) /* check handle */
488 {
489 return 2; /* return error */
490 }
491 if (handle->inited != 1) /* check handle initialization */
492 {
493 return 3; /* return error */
494 }
495
496 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
497 if (res != 0)
498 {
499 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
500
501 return 1; /* return error */
502 }
503 data &= ~(1 << 13); /* clear settings */
504 data |= enable << 13; /* set bool */
505 res = a_hdc1080_iic_write(handle, HDC1080_REG_CONFIG, data); /* write config */
506 if (res != 0)
507 {
508 handle->debug_print("hdc1080: write config failed.\n"); /* write config failed */
509
510 return 1; /* return error */
511 }
512
513 return 0; /* success return 0 */
514}
515
528{
529 uint8_t res;
530 uint16_t data;
531
532 if (handle == NULL) /* check handle */
533 {
534 return 2; /* return error */
535 }
536 if (handle->inited != 1) /* check handle initialization */
537 {
538 return 3; /* return error */
539 }
540
541 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
542 if (res != 0)
543 {
544 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
545
546 return 1; /* return error */
547 }
548 *enable = (hdc1080_bool_t)((data >> 13) & 0x1); /* get the bool */
549
550 return 0; /* success return 0 */
551}
552
565{
566 uint8_t res;
567 uint16_t data;
568
569 if (handle == NULL) /* check handle */
570 {
571 return 2; /* return error */
572 }
573 if (handle->inited != 1) /* check handle initialization */
574 {
575 return 3; /* return error */
576 }
577
578 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
579 if (res != 0)
580 {
581 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
582
583 return 1; /* return error */
584 }
585 data &= ~(1 << 12); /* clear settings */
586 data |= mode << 12; /* set mode */
587 res = a_hdc1080_iic_write(handle, HDC1080_REG_CONFIG, data); /* write config */
588 if (res != 0)
589 {
590 handle->debug_print("hdc1080: write config failed.\n"); /* write config failed */
591
592 return 1; /* return error */
593 }
594
595 return 0; /* success return 0 */
596}
597
610{
611 uint8_t res;
612 uint16_t data;
613
614 if (handle == NULL) /* check handle */
615 {
616 return 2; /* return error */
617 }
618 if (handle->inited != 1) /* check handle initialization */
619 {
620 return 3; /* return error */
621 }
622
623 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
624 if (res != 0)
625 {
626 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
627
628 return 1; /* return error */
629 }
630 *mode = (hdc1080_mode_t)((data >> 12) & 0x1); /* get the mode */
631
632 return 0; /* success return 0 */
633}
634
647{
648 uint8_t res;
649 uint16_t data;
650
651 if (handle == NULL) /* check handle */
652 {
653 return 2; /* return error */
654 }
655 if (handle->inited != 1) /* check handle initialization */
656 {
657 return 3; /* return error */
658 }
659
660 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
661 if (res != 0)
662 {
663 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
664
665 return 1; /* return error */
666 }
667 *status = (hdc1080_battery_status_t)((data >> 11) & 0x1); /* get the status */
668
669 return 0; /* success return 0 */
670}
671
684{
685 uint8_t res;
686 uint16_t data;
687
688 if (handle == NULL) /* check handle */
689 {
690 return 2; /* return error */
691 }
692 if (handle->inited != 1) /* check handle initialization */
693 {
694 return 3; /* return error */
695 }
696
697 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
698 if (res != 0)
699 {
700 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
701
702 return 1; /* return error */
703 }
704 data &= ~(1 << 10); /* clear settings */
705 data |= resolution << 10; /* set resolution */
706 res = a_hdc1080_iic_write(handle, HDC1080_REG_CONFIG, data); /* write config */
707 if (res != 0)
708 {
709 handle->debug_print("hdc1080: write config failed.\n"); /* write config failed */
710
711 return 1; /* return error */
712 }
713
714 return 0; /* success return 0 */
715}
716
729{
730 uint8_t res;
731 uint16_t data;
732
733 if (handle == NULL) /* check handle */
734 {
735 return 2; /* return error */
736 }
737 if (handle->inited != 1) /* check handle initialization */
738 {
739 return 3; /* return error */
740 }
741
742 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
743 if (res != 0)
744 {
745 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
746
747 return 1; /* return error */
748 }
749 *resolution = (hdc1080_temperature_resolution_t)((data >> 10) & 0x1); /* get the resolution */
750
751 return 0; /* success return 0 */
752}
753
766{
767 uint8_t res;
768 uint16_t data;
769
770 if (handle == NULL) /* check handle */
771 {
772 return 2; /* return error */
773 }
774 if (handle->inited != 1) /* check handle initialization */
775 {
776 return 3; /* return error */
777 }
778
779 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
780 if (res != 0)
781 {
782 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
783
784 return 1; /* return error */
785 }
786 data &= ~(3 << 8); /* clear settings */
787 data |= resolution << 8; /* set resolution */
788 res = a_hdc1080_iic_write(handle, HDC1080_REG_CONFIG, data); /* write config */
789 if (res != 0)
790 {
791 handle->debug_print("hdc1080: write config failed.\n"); /* write config failed */
792
793 return 1; /* return error */
794 }
795
796 return 0; /* success return 0 */
797}
798
811{
812 uint8_t res;
813 uint16_t data;
814
815 if (handle == NULL) /* check handle */
816 {
817 return 2; /* return error */
818 }
819 if (handle->inited != 1) /* check handle initialization */
820 {
821 return 3; /* return error */
822 }
823
824 res = a_hdc1080_iic_read(handle, HDC1080_REG_CONFIG, &data); /* read config */
825 if (res != 0)
826 {
827 handle->debug_print("hdc1080: read config failed.\n"); /* read config failed */
828
829 return 1; /* return error */
830 }
831 *resolution = (hdc1080_humidity_resolution_t)((data >> 8) & 0x3); /* get the resolution */
832
833 return 0; /* success return 0 */
834}
835
847uint8_t hdc1080_get_serial_id(hdc1080_handle_t *handle, uint8_t id[6])
848{
849 uint8_t res;
850 uint16_t data;
851
852 if (handle == NULL) /* check handle */
853 {
854 return 2; /* return error */
855 }
856 if (handle->inited != 1) /* check handle initialization */
857 {
858 return 3; /* return error */
859 }
860
861 res = a_hdc1080_iic_read(handle, HDC1080_REG_SERIAL_ID_0, &data); /* read config */
862 if (res != 0)
863 {
864 handle->debug_print("hdc1080: read serial id 0 failed.\n"); /* read serial id 0 failed */
865
866 return 1; /* return error */
867 }
868 id[0] = (data >> 8) & 0xFF; /* id0 */
869 id[1] = (data >> 0) & 0xFF; /* id1 */
870 res = a_hdc1080_iic_read(handle, HDC1080_REG_SERIAL_ID_1, &data); /* read config */
871 if (res != 0)
872 {
873 handle->debug_print("hdc1080: read serial id 1 failed.\n"); /* read serial id 1 failed */
874
875 return 1; /* return error */
876 }
877 id[2] = (data >> 8) & 0xFF; /* id2 */
878 id[3] = (data >> 0) & 0xFF; /* id3 */
879 res = a_hdc1080_iic_read(handle, HDC1080_REG_SERIAL_ID_2, &data); /* read config */
880 if (res != 0)
881 {
882 handle->debug_print("hdc1080: read serial id 2 failed.\n"); /* read serial id 2 failed */
883
884 return 1; /* return error */
885 }
886 id[4] = (data >> 8) & 0xFF; /* id4 */
887 id[5] = (data >> 0) & 0xFF; /* id5 */
888
889 return 0; /* success return 0 */
890}
891
904uint8_t hdc1080_set_reg(hdc1080_handle_t *handle, uint8_t reg, uint16_t data)
905{
906 if (handle == NULL) /* check handle */
907 {
908 return 2; /* return error */
909 }
910 if (handle->inited != 1) /* check handle initialization */
911 {
912 return 3; /* return error */
913 }
914
915 if (a_hdc1080_iic_write(handle, reg, data) != 0) /* write data */
916 {
917 return 1; /* return error */
918 }
919 else
920 {
921 return 0; /* success return 0 */
922 }
923}
924
937uint8_t hdc1080_get_reg(hdc1080_handle_t *handle, uint8_t reg, uint16_t *data)
938{
939 if (handle == NULL) /* check handle */
940 {
941 return 2; /* return error */
942 }
943 if (handle->inited != 1) /* check handle initialization */
944 {
945 return 3; /* return error */
946 }
947
948 if (a_hdc1080_iic_read(handle, reg, data) != 0) /* read data */
949 {
950 return 1; /* return error */
951 }
952 else
953 {
954 return 0; /* success return 0 */
955 }
956}
957
967{
968 if (info == NULL) /* check handle */
969 {
970 return 2; /* return error */
971 }
972
973 memset(info, 0, sizeof(hdc1080_info_t)); /* initialize hdc1080 info structure */
974 strncpy(info->chip_name, CHIP_NAME, 32); /* copy chip name */
975 strncpy(info->manufacturer_name, MANUFACTURER_NAME, 32); /* copy manufacturer name */
976 strncpy(info->interface, "IIC", 8); /* copy interface name */
977 info->supply_voltage_min_v = SUPPLY_VOLTAGE_MIN; /* set minimal supply voltage */
978 info->supply_voltage_max_v = SUPPLY_VOLTAGE_MAX; /* set maximum supply voltage */
979 info->max_current_ma = MAX_CURRENT; /* set maximum current */
980 info->temperature_max = TEMPERATURE_MAX; /* set minimal temperature */
981 info->temperature_min = TEMPERATURE_MIN; /* set maximum temperature */
982 info->driver_version = DRIVER_VERSION; /* set driver version */
983
984 return 0; /* success return 0 */
985}
#define MAX_CURRENT
#define HDC1080_REG_HUMIDITY
#define HDC1080_REG_SERIAL_ID_0
#define HDC1080_REG_TEMPERATURE
chip register definition
#define HDC1080_ADDRESS
chip address definition
#define SUPPLY_VOLTAGE_MAX
#define HDC1080_REG_DEVICE_ID
#define TEMPERATURE_MAX
#define HDC1080_REG_SERIAL_ID_1
#define MANUFACTURER_NAME
#define TEMPERATURE_MIN
#define SUPPLY_VOLTAGE_MIN
#define HDC1080_REG_SERIAL_ID_2
#define CHIP_NAME
chip information definition
#define DRIVER_VERSION
#define HDC1080_REG_MANUFACTURER_ID
#define HDC1080_REG_CONFIG
driver hdc1080 header file
uint8_t hdc1080_get_serial_id(hdc1080_handle_t *handle, uint8_t id[6])
get serial id
uint8_t hdc1080_info(hdc1080_info_t *info)
get chip's information
struct hdc1080_info_s hdc1080_info_t
hdc1080 information structure definition
uint8_t hdc1080_get_temperature_resolution(hdc1080_handle_t *handle, hdc1080_temperature_resolution_t *resolution)
get temperature resolution
uint8_t hdc1080_read_humidity(hdc1080_handle_t *handle, uint16_t *humidity_raw, float *humidity_s)
read the humidity data
uint8_t hdc1080_get_battery_status(hdc1080_handle_t *handle, hdc1080_battery_status_t *status)
get battery status
struct hdc1080_handle_s hdc1080_handle_t
hdc1080 handle structure definition
hdc1080_humidity_resolution_t
hdc1080 humidity resolution enumeration definition
hdc1080_mode_t
hdc1080 mode enumeration definition
hdc1080_temperature_resolution_t
hdc1080 temperature resolution enumeration definition
uint8_t hdc1080_read_temperature_humidity(hdc1080_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 hdc1080_deinit(hdc1080_handle_t *handle)
close the chip
uint8_t hdc1080_set_heater(hdc1080_handle_t *handle, hdc1080_bool_t enable)
enable or disable heater
uint8_t hdc1080_set_mode(hdc1080_handle_t *handle, hdc1080_mode_t mode)
set the chip mode
uint8_t hdc1080_get_humidity_resolution(hdc1080_handle_t *handle, hdc1080_humidity_resolution_t *resolution)
get humidity resolution
uint8_t hdc1080_set_humidity_resolution(hdc1080_handle_t *handle, hdc1080_humidity_resolution_t resolution)
set humidity resolution
uint8_t hdc1080_init(hdc1080_handle_t *handle)
initialize the chip
hdc1080_battery_status_t
hdc1080 battery status enumeration definition
uint8_t hdc1080_get_heater(hdc1080_handle_t *handle, hdc1080_bool_t *enable)
get the heater status
uint8_t hdc1080_software_reset(hdc1080_handle_t *handle)
software reset
uint8_t hdc1080_read_temperature(hdc1080_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
read the temperature
uint8_t hdc1080_get_mode(hdc1080_handle_t *handle, hdc1080_mode_t *mode)
get the chip mode
uint8_t hdc1080_set_temperature_resolution(hdc1080_handle_t *handle, hdc1080_temperature_resolution_t resolution)
set temperature resolution
hdc1080_bool_t
hdc1080 bool enumeration definition
uint8_t hdc1080_get_reg(hdc1080_handle_t *handle, uint8_t reg, uint16_t *data)
get chip register
uint8_t hdc1080_set_reg(hdc1080_handle_t *handle, uint8_t reg, uint16_t data)
set chip register
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_read_with_wait)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
uint32_t driver_version
char manufacturer_name[32]