LibDriver LM75B
Loading...
Searching...
No Matches
driver_lm75b.c
Go to the documentation of this file.
1
37
38#include "driver_lm75b.h"
39
43#define CHIP_NAME "NXP LM75B"
44#define MANUFACTURER_NAME "NXP"
45#define SUPPLY_VOLTAGE_MIN 2.8f
46#define SUPPLY_VOLTAGE_MAX 5.5f
47#define MAX_CURRENT 10.0f
48#define TEMPERATURE_MIN -55.0f
49#define TEMPERATURE_MAX 125.0f
50#define DRIVER_VERSION 2000
51
55#define LM75B_REG_CONF 0x01
56#define LM75B_REG_TEMP 0x00
57#define LM75B_REG_TOS 0x03
58#define LM75B_REG_THYST 0x02
59
70{
71 if (handle == NULL) /* check handle */
72 {
73 return 2; /* return error */
74 }
75
76 handle->iic_addr = 0x90; /* set iic addr */
77 handle->iic_addr |= addr_pin << 1; /* set iic address */
78
79 return 0; /* success return 0 */
80}
81
92{
93 if (handle == NULL) /* check handle */
94 {
95 return 2; /* return error */
96 }
97
98 *addr_pin = (lm75b_address_t)((handle->iic_addr&(~0x90)) >> 1); /* get iic address */
99
100 return 0; /* success return 0 */
101}
102
114uint8_t lm75b_hysteresis_convert_to_register(lm75b_handle_t *handle, float c, uint16_t *reg)
115{
116 if (handle == NULL) /* check handle */
117 {
118 return 2; /* return error */
119 }
120 if (handle->inited != 1) /* check handle initialization */
121 {
122 return 3; /* return error */
123 }
124
125 if (c > 0) /* if positive */
126 {
127 *reg = ((uint16_t)(c / 0.5f) & 0xFF) << 7; /* get reg */
128 }
129 else /* if negative */
130 {
131 *reg = (1<<15) | (~(((uint16_t)(-c /0.5f) & 0xFF) - 1))<<7; /* get reg */
132 }
133
134 return 0; /* success return 0 */
135}
136
148uint8_t lm75b_hysteresis_convert_to_data(lm75b_handle_t *handle, uint16_t reg, float *c)
149{
150 if (handle == NULL) /* check handle */
151 {
152 return 2; /* return error */
153 }
154 if (handle->inited != 1) /* check handle initialization */
155 {
156 return 3; /* return error */
157 }
158
159 reg = reg >> 7; /* right shift 7 */
160 if ((reg & 0x0100) != 0) /* check first bit */
161 {
162 *c= -0.5f * (float)((uint16_t)((~(reg))&0xFF) + 1); /* if negative set convert temp */
163 }
164 else
165 {
166 *c = (float)(reg) * 0.5f; /* if positive set convert temp */
167 }
168
169 return 0; /* success return 0 */
170}
171
183uint8_t lm75b_set_hysteresis(lm75b_handle_t *handle, uint16_t hysteresis)
184{
185 uint8_t res;
186 uint8_t buf[2];
187
188 if (handle == NULL) /* check handle */
189 {
190 return 2; /* return error */
191 }
192 if (handle->inited != 1) /* check handle initialization */
193 {
194 return 3; /* return error */
195 }
196
197 buf[0] = (hysteresis >> 8) & 0xFF; /* set MSB */
198 buf[1] = hysteresis & 0xFF; /* set LSB */
199 res = handle->iic_write(handle->iic_addr, LM75B_REG_THYST, (uint8_t *)buf, 2); /* set hysteresis */
200 if (res != 0) /* check result */
201 {
202 handle->debug_print("lm75b: write hysteresis failed.\n"); /* write hysteresis failed */
203
204 return 1; /* return error */
205 }
206
207 return 0; /* success return 0 */
208}
209
221uint8_t lm75b_get_hysteresis(lm75b_handle_t *handle, uint16_t *hysteresis)
222{
223 uint8_t res;
224 uint8_t buf[2];
225
226 if (handle == NULL) /* check handle */
227 {
228 return 2; /* return error */
229 }
230 if (handle->inited != 1) /* check handle initialization */
231 {
232 return 3; /* return error */
233 }
234
235 res = handle->iic_read(handle->iic_addr, LM75B_REG_THYST, (uint8_t *)buf, 2); /* get hysteresis */
236 if (res != 0) /* check result */
237 {
238 handle->debug_print("lm75b: read hysteresis failed.\n"); /* read hysteresis failed */
239
240 return 1; /* return error */
241 }
242 *hysteresis = (uint16_t)(((uint16_t)buf[0]) << 8) | buf[1]; /* set data */
243
244 return 0; /* success return 0 */
245}
246
259{
260 if (handle == NULL) /* check handle */
261 {
262 return 2; /* return error */
263 }
264 if (handle->inited != 1) /* check handle initialization */
265 {
266 return 3; /* return error */
267 }
268
269 if (c > 0) /* if positive */
270 {
271 *reg = ((uint16_t)(c / 0.5f) & 0xFF) << 7; /* get reg */
272 }
273 else /* if negative */
274 {
275 *reg = (1<<15) | (~(((uint16_t)(-c /0.5f) & 0xFF) - 1))<<7; /* get reg */
276 }
277
278 return 0; /* success return 0 */
279}
280
293{
294 if (handle == NULL) /* check handle */
295 {
296 return 2; /* return error */
297 }
298 if (handle->inited != 1) /* check handle initialization */
299 {
300 return 3; /* return error */
301 }
302
303 reg = reg >> 7; /* right shift 7 */
304 if ((reg & 0x0100) != 0) /* check first bit */
305 {
306 *c= -0.5f * (float)((uint16_t)((~(reg))&0xFF) + 1); /* if negative set convert temp */
307 }
308 else
309 {
310 *c = (float)(reg) * 0.5f; /* if positive set convert temp */
311 }
312
313 return 0; /* success return 0 */
314}
315
327uint8_t lm75b_set_over_temperature_threshold(lm75b_handle_t *handle, uint16_t threshold)
328{
329 uint8_t res;
330 uint8_t buf[2];
331
332 if (handle == NULL) /* check handle */
333 {
334 return 2; /* return error */
335 }
336 if (handle->inited != 1) /* check handle initialization */
337 {
338 return 3; /* return error */
339 }
340
341 buf[0] = (threshold >> 8) & 0xFF; /* set MSB */
342 buf[1] = threshold & 0xFF; /* set LSB */
343 res = handle->iic_write(handle->iic_addr, LM75B_REG_TOS, (uint8_t *)buf, 2); /* set threshold */
344 if (res != 0) /* check result */
345 {
346 handle->debug_print("lm75b: write tos failed.\n"); /* write tos failed */
347
348 return 1; /* return error */
349 }
350
351 return 0; /* success return 0 */
352}
353
365uint8_t lm75b_get_over_temperature_threshold(lm75b_handle_t *handle, uint16_t *threshold)
366{
367 uint8_t res;
368 uint8_t buf[2];
369
370 if (handle == NULL) /* check handle */
371 {
372 return 2; /* return error */
373 }
374 if (handle->inited != 1) /* check handle initialization */
375 {
376 return 3; /* return error */
377 }
378
379 res = handle->iic_read(handle->iic_addr, LM75B_REG_TOS, (uint8_t *)buf, 2); /* get threshold */
380 if (res != 0) /* check result */
381 {
382 handle->debug_print("lm75b: read tos failed.\n"); /* read tos failed */
383
384 return 1; /* return error */
385 }
386 *threshold = (uint16_t)(((uint16_t)buf[0]) << 8) | buf[1]; /* set data */
387
388 return 0; /* success return 0 */
389}
390
403{
404 uint8_t res;
405 uint8_t prev;
406
407 if (handle == NULL) /* check handle */
408 {
409 return 2; /* return error */
410 }
411 if (handle->inited != 1) /* check handle initialization */
412 {
413 return 3; /* return error */
414 }
415
416 res = handle->iic_read(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* read config */
417 if (res != 0) /* check result */
418 {
419 handle->debug_print("lm75b: read configure failed.\n"); /* read configure failed */
420
421 return 1; /* return error */
422 }
423 prev &= ~(0x03 << 3); /* clear fault queue */
424 prev |= fault_queue << 3; /* set queue */
425 res = handle->iic_write(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* write conf */
426 if (res != 0) /* check result */
427 {
428 handle->debug_print("lm75b: write configure failed.\n"); /* write configure failed */
429
430 return 1; /* return error */
431 }
432
433 return 0; /* success return 0 */
434}
435
448{
449 uint8_t res;
450 uint8_t prev;
451
452 if (handle == NULL) /* check handle */
453 {
454 return 2; /* return error */
455 }
456 if (handle->inited != 1) /* check handle initialization */
457 {
458 return 3; /* return error */
459 }
460
461 res = handle->iic_read(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* read configure */
462 if (res != 0) /* check result */
463 {
464 handle->debug_print("lm75b: read configure failed.\n"); /* read configure failed */
465
466 return 1; /* return error */
467 }
468 *fault_queue = (lm75b_fault_queue_t)((prev >> 3) & 0x03); /* get fault queue */
469
470 return 0; /* success return 0 */
471}
472
485{
486 uint8_t res;
487 uint8_t prev;
488
489 if (handle == NULL) /* check handle */
490 {
491 return 2; /* return error */
492 }
493 if (handle->inited != 1) /* check handle initialization */
494 {
495 return 3; /* return error */
496 }
497
498 res = handle->iic_read(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* read configure */
499 if (res != 0) /* check result */
500 {
501 handle->debug_print("lm75b: read configure failed.\n"); /* read configure failed */
502
503 return 1; /* return error */
504 }
505 prev &= ~(1 << 2); /* clear polarity */
506 prev |= polarity << 2; /* set polarity */
507 res = handle->iic_write(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* write configure */
508 if (res != 0) /* check result */
509 {
510 handle->debug_print("lm75b: write configure failed.\n"); /* write configure failed */
511
512 return 1; /* return error */
513 }
514
515 return 0; /* success return 0 */
516}
517
530{
531 uint8_t res;
532 uint8_t prev;
533
534 if (handle == NULL) /* check handle */
535 {
536 return 2; /* return error */
537 }
538 if (handle->inited != 1) /* check handle initialization */
539 {
540 return 3; /* return error */
541 }
542
543 res = handle->iic_read(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* read configure */
544 if (res != 0) /* check result */
545 {
546 handle->debug_print("lm75b: read configure failed.\n"); /* read configure failed */
547
548 return 1; /* return error */
549 }
550 *polarity = (lm75b_os_polarity_t)((prev >> 2) & 0x01); /* get polarity */
551
552 return 0; /* success return 0 */
553}
554
567{
568 uint8_t res;
569 uint8_t prev;
570
571 if (handle == NULL) /* check handle */
572 {
573 return 2; /* return error */
574 }
575 if (handle->inited != 1) /* check handle initialization */
576 {
577 return 3; /* return error */
578 }
579
580 res = handle->iic_read(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* read configure */
581 if (res != 0) /* check result */
582 {
583 handle->debug_print("lm75b: read configure failed.\n"); /* read configure failed */
584
585 return 1; /* return error */
586 }
587 prev &= ~(1 << 1); /* clear mode */
588 prev |= mode << 1; /* set mode */
589 res = handle->iic_write(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* write configure */
590 if (res != 0) /* check result */
591 {
592 handle->debug_print("lm75b: write configure failed.\n"); /* write configure failed */
593
594 return 1; /* return error */
595 }
596
597 return 0; /* success return 0 */
598}
599
612{
613 uint8_t res;
614 uint8_t prev;
615
616 if (handle == NULL) /* check handle */
617 {
618 return 2; /* return error */
619 }
620 if (handle->inited != 1) /* check handle initialization */
621 {
622 return 3; /* return error */
623 }
624
625 res = handle->iic_read(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* read configure */
626 if (res != 0) /* check result */
627 {
628 handle->debug_print("lm75b: read configure failed.\n"); /* read configure failed */
629
630 return 1; /* return error */
631 }
632 *mode = (lm75b_os_operation_mode_t)((prev >> 1) & 0x01); /* get mode */
633
634 return 0; /* success return 0 */
635}
636
649{
650 uint8_t res;
651 uint8_t prev;
652
653 if (handle == NULL) /* check handle */
654 {
655 return 2; /* return error */
656 }
657 if (handle->inited != 1) /* check handle initialization */
658 {
659 return 3; /* return error */
660 }
661
662 res = handle->iic_read(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* read configure */
663 if (res != 0) /* check result */
664 {
665 handle->debug_print("lm75b: read configure failed.\n"); /* read configure failed */
666
667 return 1; /* return error */
668 }
669 prev &= ~(1 << 0); /* clear mode */
670 prev |= mode << 0; /* set mode */
671 res = handle->iic_write(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* write conf */
672 if (res != 0) /* check result */
673 {
674 handle->debug_print("lm75b: write configure failed.\n"); /* write configure failed */
675
676 return 1; /* return error */
677 }
678
679 return 0; /* success return 0 */
680}
681
694{
695 uint8_t res;
696 uint8_t prev;
697
698 if (handle == NULL) /* check handle */
699 {
700 return 2; /* return error */
701 }
702 if (handle->inited != 1) /* check handle initialization */
703 {
704 return 3; /* return error */
705 }
706
707 res = handle->iic_read(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* read configure */
708 if (res != 0) /* check error */
709 {
710 handle->debug_print("lm75b: read configure failed.\n"); /* read config failed */
711
712 return 1; /* return error */
713 }
714 *mode = (lm75b_mode_t)((prev >> 0) & 0x01); /* get mode */
715
716 return 0; /* success return 0 */
717}
718
730{
731 if (handle == NULL) /* check handle */
732 {
733 return 2; /* return error */
734 }
735 if (handle->debug_print == NULL) /* check debug_print */
736 {
737 return 3; /* return error */
738 }
739 if (handle->iic_init == NULL) /* check iic_init */
740 {
741 handle->debug_print("lm75b: iic_init is null.\n"); /* iic_init is null */
742
743 return 3; /* return error */
744 }
745 if (handle->iic_deinit == NULL) /* check iic_deinit */
746 {
747 handle->debug_print("lm75b: iic_deinit is null.\n"); /* iic_deinit is null */
748
749 return 3; /* return error */
750 }
751 if (handle->iic_read == NULL) /* check iic_read */
752 {
753 handle->debug_print("lm75b: iic_read is null.\n"); /* iic_read is null */
754
755 return 3; /* return error */
756 }
757 if (handle->iic_write == NULL) /* check iic_write */
758 {
759 handle->debug_print("lm75b: iic_write is null.\n"); /* iic_write is null */
760
761 return 3; /* return error */
762 }
763 if (handle->delay_ms == NULL) /* check delay_ms */
764 {
765 handle->debug_print("lm75b: delay_ms is null.\n"); /* delay_ms is null */
766
767 return 3; /* return error */
768 }
769
770 if (handle->iic_init() != 0) /* initialize iic bus */
771 {
772 handle->debug_print("lm75b: iic init failed.\n"); /* iic init failed */
773
774 return 1; /* return error */
775 }
776 handle->inited = 1; /* flag finish initialization */
777
778 return 0; /* success return 0 */
779}
780
792{
793 uint8_t res;
794 uint8_t prev;
795
796 if (handle == NULL) /* check handle */
797 {
798 return 2; /* return error */
799 }
800 if (handle->inited != 1) /* check handle initialization */
801 {
802 return 3; /* return error */
803 }
804
805 res = handle->iic_read(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* read config */
806 if (res != 0) /* check result */
807 {
808 handle->debug_print("lm75b: read configure failed.\n"); /* read config failed */
809
810 return 1; /* return error */
811 }
812 prev &= ~(1 << 0); /* clear mode */
813 res = handle->iic_write(handle->iic_addr, LM75B_REG_CONF, (uint8_t *)&prev, 1); /* write configure */
814 if (res != 0) /* check result */
815 {
816 handle->debug_print("lm75b: write configure failed.\n"); /* write configure failed */
817
818 return 1; /* return error */
819 }
820 if (handle->iic_deinit() != 0) /* close iic bus */
821 {
822 handle->debug_print("lm75b: iic deinit failed.\n"); /* iic deinit failed */
823
824 return 1; /* return error */
825 }
826 handle->inited = 0; /* flag close */
827
828 return 0; /* success return 0 */
829}
830
843uint8_t lm75b_read(lm75b_handle_t *handle, uint16_t *raw, float *s)
844{
845 uint8_t res;
846 uint8_t buf[2];
847
848 if (handle == NULL) /* check handle */
849 {
850 return 2; /* return error */
851 }
852 if (handle->inited != 1) /* check handle initialization */
853 {
854 return 3; /* return error */
855 }
856
857 memset(buf, 0, sizeof(uint8_t) * 2); /* clear the buffer */
858 res = handle->iic_read(handle->iic_addr, LM75B_REG_TEMP, (uint8_t *)buf, 2); /* get temperature */
859 if (res != 0) /* check result */
860 {
861 handle->debug_print("lm75b: read temp failed.\n"); /* read temp failed */
862
863 return 1; /* return error */
864 }
865 *raw = (uint16_t)(((uint16_t)buf[0]) << 8) | buf[1]; /* set raw data */
866 *raw = (*raw) >> 5; /* right shift 5 */
867 if (((*raw) & 0x0400) != 0) /* check first bit */
868 {
869 *raw = (*raw) | 0xF800U; /* set negative part */
870 *s = (float)(-(~(*raw) + 1)) * 0.125f; /* if negative set convert temp */
871 }
872 else
873 {
874 *s = (float)(*raw) * 0.125f; /* if positive set convert temp */
875 }
876
877 return 0; /* success return 0 */
878}
879
893uint8_t lm75b_set_reg(lm75b_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
894{
895 if (handle == NULL) /* check handle */
896 {
897 return 2; /* return error */
898 }
899 if (handle->inited != 1) /* check handle initialization */
900 {
901 return 3; /* return error */
902 }
903
904 if (handle->iic_write(handle->iic_addr, reg, buf, len) != 0) /* write register */
905 {
906 handle->debug_print("lm75b: write failed.\n"); /* write failed */
907
908 return 1; /* return error */
909 }
910 else
911 {
912 return 0; /* success return 0 */
913 }
914}
915
929uint8_t lm75b_get_reg(lm75b_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
930{
931 if (handle == NULL) /* check handle */
932 {
933 return 2; /* return error */
934 }
935 if (handle->inited != 1) /* check handle initialization */
936 {
937 return 3; /* return error */
938 }
939
940 if (handle->iic_read(handle->iic_addr, reg, buf, len) != 0) /* read register */
941 {
942 handle->debug_print("lm75b: read failed.\n"); /* read failed */
943
944 return 1; /* return error */
945 }
946 else
947 {
948 return 0; /* success return 0 */
949 }
950}
951
961{
962 if (info == NULL) /* check handle */
963 {
964 return 2; /* return error */
965 }
966
967 memset(info, 0, sizeof(lm75b_info_t)); /* initialize lm75b info structure */
968 strncpy(info->chip_name, CHIP_NAME, 32); /* copy chip name */
969 strncpy(info->manufacturer_name, MANUFACTURER_NAME, 32); /* copy manufacturer name */
970 strncpy(info->interface, "IIC", 8); /* copy interface name */
971 info->supply_voltage_min_v = SUPPLY_VOLTAGE_MIN; /* set minimal supply voltage */
972 info->supply_voltage_max_v = SUPPLY_VOLTAGE_MAX; /* set maximum supply voltage */
973 info->max_current_ma = MAX_CURRENT; /* set maximum current */
974 info->temperature_max = TEMPERATURE_MAX; /* set minimal temperature */
975 info->temperature_min = TEMPERATURE_MIN; /* set maximum temperature */
976 info->driver_version = DRIVER_VERSION; /* set driver version */
977
978 return 0; /* success return 0 */
979}
#define LM75B_REG_TOS
#define MAX_CURRENT
#define LM75B_REG_THYST
#define SUPPLY_VOLTAGE_MAX
#define LM75B_REG_CONF
chip register definition
#define TEMPERATURE_MAX
#define MANUFACTURER_NAME
#define TEMPERATURE_MIN
#define SUPPLY_VOLTAGE_MIN
#define LM75B_REG_TEMP
#define CHIP_NAME
chip information definition
#define DRIVER_VERSION
driver lm75b header file
struct lm75b_handle_s lm75b_handle_t
lm75b handle structure definition
lm75b_mode_t
lm75b os polarity enumeration definition
uint8_t lm75b_set_mode(lm75b_handle_t *handle, lm75b_mode_t mode)
set the chip mode
lm75b_fault_queue_t
lm75b fault queue enumeration definition
lm75b_address_t
lm75b address enumeration definition
uint8_t lm75b_get_mode(lm75b_handle_t *handle, lm75b_mode_t *mode)
get the chip mode
struct lm75b_info_s lm75b_info_t
lm75b information structure definition
lm75b_os_polarity_t
lm75b os polarity enumeration definition
uint8_t lm75b_read(lm75b_handle_t *handle, uint16_t *raw, float *s)
read data from the chip
uint8_t lm75b_info(lm75b_info_t *info)
get chip's information
uint8_t lm75b_set_addr_pin(lm75b_handle_t *handle, lm75b_address_t addr_pin)
set the iic address pin
uint8_t lm75b_get_addr_pin(lm75b_handle_t *handle, lm75b_address_t *addr_pin)
get the iic address pin
uint8_t lm75b_init(lm75b_handle_t *handle)
initialize the chip
uint8_t lm75b_deinit(lm75b_handle_t *handle)
close the chip
lm75b_os_operation_mode_t
lm75b os operation enumeration definition
uint8_t lm75b_set_reg(lm75b_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
uint8_t lm75b_get_reg(lm75b_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
uint8_t lm75b_hysteresis_convert_to_register(lm75b_handle_t *handle, float c, uint16_t *reg)
convert the hysteresis value to the register data
uint8_t lm75b_get_fault_queue(lm75b_handle_t *handle, lm75b_fault_queue_t *fault_queue)
get the chip fault queue
uint8_t lm75b_get_over_temperature_threshold(lm75b_handle_t *handle, uint16_t *threshold)
get the over temperature threshold
uint8_t lm75b_set_hysteresis(lm75b_handle_t *handle, uint16_t hysteresis)
set the hysteresis value
uint8_t lm75b_get_hysteresis(lm75b_handle_t *handle, uint16_t *hysteresis)
get the hysteresis value
uint8_t lm75b_get_os_polarity(lm75b_handle_t *handle, lm75b_os_polarity_t *polarity)
get the chip os polarity
uint8_t lm75b_over_temperature_threshold_convert_to_data(lm75b_handle_t *handle, uint16_t reg, float *c)
convert the register raw data to the over temperature threshold
uint8_t lm75b_hysteresis_convert_to_data(lm75b_handle_t *handle, uint16_t reg, float *c)
convert the register raw data to the hysteresis value
uint8_t lm75b_get_interrupt_mode(lm75b_handle_t *handle, lm75b_os_operation_mode_t *mode)
get the chip interrupt mode
uint8_t lm75b_set_os_polarity(lm75b_handle_t *handle, lm75b_os_polarity_t polarity)
set the chip os polarity
uint8_t lm75b_set_interrupt_mode(lm75b_handle_t *handle, lm75b_os_operation_mode_t mode)
set the chip interrupt mode
uint8_t lm75b_set_fault_queue(lm75b_handle_t *handle, lm75b_fault_queue_t fault_queue)
set the chip fault queue
uint8_t lm75b_set_over_temperature_threshold(lm75b_handle_t *handle, uint16_t threshold)
set the over temperature threshold
uint8_t lm75b_over_temperature_threshold_convert_to_register(lm75b_handle_t *handle, float c, uint16_t *reg)
convert the over temperature threshold to the register data
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
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)
float temperature_max
float supply_voltage_max_v
uint32_t driver_version
float temperature_min
float max_current_ma
char manufacturer_name[32]
float supply_voltage_min_v
char interface[8]
char chip_name[32]