LibDriver MAX31856
Loading...
Searching...
No Matches
driver_max31856_register_test.c
Go to the documentation of this file.
1
36
38#include <stdlib.h>
39
40static max31856_handle_t gs_handle;
41
50{
51 uint8_t res;
52 uint8_t status;
53 int8_t threshold_reg8;
54 int8_t threshold_reg8_check;
55 int16_t threshold_reg16;
56 int16_t threshold_reg16_check;
57 float deg;
58 float deg_check;
59 max31856_info_t info;
60 max31856_bool_t enable;
66
67 /* link interface function */
76
77 /* get information */
78 res = max31856_info(&info);
79 if (res != 0)
80 {
81 max31856_interface_debug_print("max31856: get info failed.\n");
82
83 return 1;
84 }
85 else
86 {
87 /* print chip info */
88 max31856_interface_debug_print("max31856: chip is %s.\n", info.chip_name);
89 max31856_interface_debug_print("max31856: manufacturer is %s.\n", info.manufacturer_name);
90 max31856_interface_debug_print("max31856: interface is %s.\n", info.interface);
91 max31856_interface_debug_print("max31856: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
92 max31856_interface_debug_print("max31856: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
93 max31856_interface_debug_print("max31856: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
94 max31856_interface_debug_print("max31856: max current is %0.2fmA.\n", info.max_current_ma);
95 max31856_interface_debug_print("max31856: max temperature is %0.1fC.\n", info.temperature_max);
96 max31856_interface_debug_print("max31856: min temperature is %0.1fC.\n", info.temperature_min);
97 }
98
99 /* start register test */
100 max31856_interface_debug_print("max31856: start register test.\n");
101
102 /* init the max31856 */
103 res = max31856_init(&gs_handle);
104 if (res != 0)
105 {
106 max31856_interface_debug_print("max31856: init failed.\n");
107
108 return 1;
109 }
110
111 /* max31856_set_open_circuit_detection/max31856_get_open_circuit_detection test */
112 max31856_interface_debug_print("max31856: max31856_set_open_circuit_detection/max31856_get_open_circuit_detection test.\n");
113
114 /* disable open circuit detection */
116 if (res != 0)
117 {
118 max31856_interface_debug_print("max31856: set open circuit detection failed.\n");
119 (void)max31856_deinit(&gs_handle);
120
121 return 1;
122 }
123 max31856_interface_debug_print("max31856: disable open circuit detection.\n");
124 res = max31856_get_open_circuit_detection(&gs_handle, &detection);
125 if (res != 0)
126 {
127 max31856_interface_debug_print("max31856: get open circuit detection failed.\n");
128 (void)max31856_deinit(&gs_handle);
129
130 return 1;
131 }
132 max31856_interface_debug_print("max31856: check open circuit detection %s.\n", (detection == MAX31856_OPEN_CIRCUIT_DETECTION_DISABLE) ? "ok" : "error");
133
134 /* set open circuit detection mode1 */
136 if (res != 0)
137 {
138 max31856_interface_debug_print("max31856: set open circuit detection failed.\n");
139 (void)max31856_deinit(&gs_handle);
140
141 return 1;
142 }
143 max31856_interface_debug_print("max31856: set open circuit detection mode1.\n");
144 res = max31856_get_open_circuit_detection(&gs_handle, &detection);
145 if (res != 0)
146 {
147 max31856_interface_debug_print("max31856: get open circuit detection failed.\n");
148 (void)max31856_deinit(&gs_handle);
149
150 return 1;
151 }
152 max31856_interface_debug_print("max31856: check open circuit detection %s.\n", (detection == MAX31856_OPEN_CIRCUIT_DETECTION_MODE1) ? "ok" : "error");
153
154 /* set open circuit detection mode2 */
156 if (res != 0)
157 {
158 max31856_interface_debug_print("max31856: set open circuit detection failed.\n");
159 (void)max31856_deinit(&gs_handle);
160
161 return 1;
162 }
163 max31856_interface_debug_print("max31856: set open circuit detection mode2.\n");
164 res = max31856_get_open_circuit_detection(&gs_handle, &detection);
165 if (res != 0)
166 {
167 max31856_interface_debug_print("max31856: get open circuit detection failed.\n");
168 (void)max31856_deinit(&gs_handle);
169
170 return 1;
171 }
172 max31856_interface_debug_print("max31856: check open circuit detection %s.\n", (detection == MAX31856_OPEN_CIRCUIT_DETECTION_MODE2) ? "ok" : "error");
173
174 /* set open circuit detection mode3 */
176 if (res != 0)
177 {
178 max31856_interface_debug_print("max31856: set open circuit detection failed.\n");
179 (void)max31856_deinit(&gs_handle);
180
181 return 1;
182 }
183 max31856_interface_debug_print("max31856: set open circuit detection mode3.\n");
184 res = max31856_get_open_circuit_detection(&gs_handle, &detection);
185 if (res != 0)
186 {
187 max31856_interface_debug_print("max31856: get open circuit detection failed.\n");
188 (void)max31856_deinit(&gs_handle);
189
190 return 1;
191 }
192 max31856_interface_debug_print("max31856: check open circuit detection %s.\n", (detection == MAX31856_OPEN_CIRCUIT_DETECTION_MODE3) ? "ok" : "error");
193
194 /* max31856_set_cold_junction_sensor/max31856_get_cold_junction_sensor test */
195 max31856_interface_debug_print("max31856: max31856_set_cold_junction_sensor/max31856_get_cold_junction_sensor test.\n");
196
197 /* enable cold junction sensor */
199 if (res != 0)
200 {
201 max31856_interface_debug_print("max31856: set cold junction sensor failed.\n");
202 (void)max31856_deinit(&gs_handle);
203
204 return 1;
205 }
206 max31856_interface_debug_print("max31856: enable cold junction sensor.\n");
207 res = max31856_get_cold_junction_sensor(&gs_handle, &enable);
208 if (res != 0)
209 {
210 max31856_interface_debug_print("max31856: get cold junction sensor failed.\n");
211 (void)max31856_deinit(&gs_handle);
212
213 return 1;
214 }
215 max31856_interface_debug_print("max31856: check cold junction sensor %s.\n", (enable == MAX31856_BOOL_TRUE) ? "ok" : "error");
216
217 /* disable cold junction sensor */
219 if (res != 0)
220 {
221 max31856_interface_debug_print("max31856: set cold junction sensor failed.\n");
222 (void)max31856_deinit(&gs_handle);
223
224 return 1;
225 }
226 max31856_interface_debug_print("max31856: disable cold junction sensor.\n");
227 res = max31856_get_cold_junction_sensor(&gs_handle, &enable);
228 if (res != 0)
229 {
230 max31856_interface_debug_print("max31856: get cold junction sensor failed.\n");
231 (void)max31856_deinit(&gs_handle);
232
233 return 1;
234 }
235 max31856_interface_debug_print("max31856: check cold junction sensor %s.\n", (enable == MAX31856_BOOL_FALSE) ? "ok" : "error");
236
237 /* max31856_set_fault_mode/max31856_get_fault_mode test */
238 max31856_interface_debug_print("max31856: max31856_set_fault_mode/max31856_get_fault_mode test.\n");
239
240 /* set fault comparator mode */
242 if (res != 0)
243 {
244 max31856_interface_debug_print("max31856: set fault mode failed.\n");
245 (void)max31856_deinit(&gs_handle);
246
247 return 1;
248 }
249 max31856_interface_debug_print("max31856: set fault comparator mode.\n");
250 res = max31856_get_fault_mode(&gs_handle, &mode);
251 if (res != 0)
252 {
253 max31856_interface_debug_print("max31856: get fault mode failed.\n");
254 (void)max31856_deinit(&gs_handle);
255
256 return 1;
257 }
258 max31856_interface_debug_print("max31856: check fault mode %s.\n", (mode == MAX31856_FAULT_MODE_COMPARATOR) ? "ok" : "error");
259
260 /* set fault interrupt mode */
262 if (res != 0)
263 {
264 max31856_interface_debug_print("max31856: set fault mode failed.\n");
265 (void)max31856_deinit(&gs_handle);
266
267 return 1;
268 }
269 max31856_interface_debug_print("max31856: set fault interrupt mode.\n");
270 res = max31856_get_fault_mode(&gs_handle, &mode);
271 if (res != 0)
272 {
273 max31856_interface_debug_print("max31856: get fault mode failed.\n");
274 (void)max31856_deinit(&gs_handle);
275
276 return 1;
277 }
278 max31856_interface_debug_print("max31856: check fault mode %s.\n", (mode == MAX31856_FAULT_MODE_INTERRUPT) ? "ok" : "error");
279
280 /* max31856_set_noise_rejection_filter/max31856_get_noise_rejection_filter test */
281 max31856_interface_debug_print("max31856: max31856_set_noise_rejection_filter/max31856_get_noise_rejection_filter test.\n");
282
283 /* set noise rejection filter 60hz */
285 if (res != 0)
286 {
287 max31856_interface_debug_print("max31856: set noise rejection filter failed.\n");
288 (void)max31856_deinit(&gs_handle);
289
290 return 1;
291 }
292 max31856_interface_debug_print("max31856: set noise rejection filter 60hz.\n");
293 res = max31856_get_noise_rejection_filter(&gs_handle, &filter);
294 if (res != 0)
295 {
296 max31856_interface_debug_print("max31856: get noise rejection filter failed.\n");
297 (void)max31856_deinit(&gs_handle);
298
299 return 1;
300 }
301 max31856_interface_debug_print("max31856: check noise rejection filter %s.\n", (filter == MAX31856_NOISE_REJECTION_FILTER_60HZ) ? "ok" : "error");
302
303 /* set noise rejection filter 50hz */
305 if (res != 0)
306 {
307 max31856_interface_debug_print("max31856: set noise rejection filter failed.\n");
308 (void)max31856_deinit(&gs_handle);
309
310 return 1;
311 }
312 max31856_interface_debug_print("max31856: set noise rejection filter 50hz.\n");
313 res = max31856_get_noise_rejection_filter(&gs_handle, &filter);
314 if (res != 0)
315 {
316 max31856_interface_debug_print("max31856: get noise rejection filter failed.\n");
317 (void)max31856_deinit(&gs_handle);
318
319 return 1;
320 }
321 max31856_interface_debug_print("max31856: check noise rejection filter %s.\n", (filter == MAX31856_NOISE_REJECTION_FILTER_50HZ) ? "ok" : "error");
322
323 /* max31856_set_sample_average/max31856_get_sample_average test */
324 max31856_interface_debug_print("max31856: max31856_set_sample_average/max31856_get_sample_average test.\n");
325
326 /* set sample average 1 */
328 if (res != 0)
329 {
330 max31856_interface_debug_print("max31856: set sample average failed.\n");
331 (void)max31856_deinit(&gs_handle);
332
333 return 1;
334 }
335 max31856_interface_debug_print("max31856: set sample average 1.\n");
336 res = max31856_get_sample_average(&gs_handle, &average);
337 if (res != 0)
338 {
339 max31856_interface_debug_print("max31856: get sample average failed.\n");
340 (void)max31856_deinit(&gs_handle);
341
342 return 1;
343 }
344 max31856_interface_debug_print("max31856: check sample average %s.\n", (average == MAX31856_SAMPLE_AVERAGE_1) ? "ok" : "error");
345
346 /* set sample average 2 */
348 if (res != 0)
349 {
350 max31856_interface_debug_print("max31856: set sample average failed.\n");
351 (void)max31856_deinit(&gs_handle);
352
353 return 1;
354 }
355 max31856_interface_debug_print("max31856: set sample average 2.\n");
356 res = max31856_get_sample_average(&gs_handle, &average);
357 if (res != 0)
358 {
359 max31856_interface_debug_print("max31856: get sample average failed.\n");
360 (void)max31856_deinit(&gs_handle);
361
362 return 1;
363 }
364 max31856_interface_debug_print("max31856: check sample average %s.\n", (average == MAX31856_SAMPLE_AVERAGE_2) ? "ok" : "error");
365
366 /* set sample average 4 */
368 if (res != 0)
369 {
370 max31856_interface_debug_print("max31856: set sample average failed.\n");
371 (void)max31856_deinit(&gs_handle);
372
373 return 1;
374 }
375 max31856_interface_debug_print("max31856: set sample average 4.\n");
376 res = max31856_get_sample_average(&gs_handle, &average);
377 if (res != 0)
378 {
379 max31856_interface_debug_print("max31856: get sample average failed.\n");
380 (void)max31856_deinit(&gs_handle);
381
382 return 1;
383 }
384 max31856_interface_debug_print("max31856: check sample average %s.\n", (average == MAX31856_SAMPLE_AVERAGE_4) ? "ok" : "error");
385
386 /* set sample average 8 */
388 if (res != 0)
389 {
390 max31856_interface_debug_print("max31856: set sample average failed.\n");
391 (void)max31856_deinit(&gs_handle);
392
393 return 1;
394 }
395 max31856_interface_debug_print("max31856: set sample average 8.\n");
396 res = max31856_get_sample_average(&gs_handle, &average);
397 if (res != 0)
398 {
399 max31856_interface_debug_print("max31856: get sample average failed.\n");
400 (void)max31856_deinit(&gs_handle);
401
402 return 1;
403 }
404 max31856_interface_debug_print("max31856: check sample average %s.\n", (average == MAX31856_SAMPLE_AVERAGE_8) ? "ok" : "error");
405
406 /* set sample average 16 */
408 if (res != 0)
409 {
410 max31856_interface_debug_print("max31856: set sample average failed.\n");
411 (void)max31856_deinit(&gs_handle);
412
413 return 1;
414 }
415 max31856_interface_debug_print("max31856: set sample average 16.\n");
416 res = max31856_get_sample_average(&gs_handle, &average);
417 if (res != 0)
418 {
419 max31856_interface_debug_print("max31856: get sample average failed.\n");
420 (void)max31856_deinit(&gs_handle);
421
422 return 1;
423 }
424 max31856_interface_debug_print("max31856: check sample average %s.\n", (average == MAX31856_SAMPLE_AVERAGE_16) ? "ok" : "error");
425
426 /* max31856_set_thermocouple_type/max31856_get_thermocouple_type test */
427 max31856_interface_debug_print("max31856: max31856_set_thermocouple_type/max31856_get_thermocouple_type test.\n");
428
429 /* set thermocouple type b */
431 if (res != 0)
432 {
433 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
434 (void)max31856_deinit(&gs_handle);
435
436 return 1;
437 }
438 max31856_interface_debug_print("max31856: set thermocouple type b.\n");
439 res = max31856_get_thermocouple_type(&gs_handle, &type);
440 if (res != 0)
441 {
442 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
443 (void)max31856_deinit(&gs_handle);
444
445 return 1;
446 }
447 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_B) ? "ok" : "error");
448
449 /* set thermocouple type e */
451 if (res != 0)
452 {
453 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
454 (void)max31856_deinit(&gs_handle);
455
456 return 1;
457 }
458 max31856_interface_debug_print("max31856: set thermocouple type e.\n");
459 res = max31856_get_thermocouple_type(&gs_handle, &type);
460 if (res != 0)
461 {
462 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
463 (void)max31856_deinit(&gs_handle);
464
465 return 1;
466 }
467 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_E) ? "ok" : "error");
468
469 /* set thermocouple type j */
471 if (res != 0)
472 {
473 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
474 (void)max31856_deinit(&gs_handle);
475
476 return 1;
477 }
478 max31856_interface_debug_print("max31856: set thermocouple type j.\n");
479 res = max31856_get_thermocouple_type(&gs_handle, &type);
480 if (res != 0)
481 {
482 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
483 (void)max31856_deinit(&gs_handle);
484
485 return 1;
486 }
487 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_J) ? "ok" : "error");
488
489 /* set thermocouple type k */
491 if (res != 0)
492 {
493 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
494 (void)max31856_deinit(&gs_handle);
495
496 return 1;
497 }
498 max31856_interface_debug_print("max31856: set thermocouple type k.\n");
499 res = max31856_get_thermocouple_type(&gs_handle, &type);
500 if (res != 0)
501 {
502 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
503 (void)max31856_deinit(&gs_handle);
504
505 return 1;
506 }
507 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_K) ? "ok" : "error");
508
509 /* set thermocouple type n */
511 if (res != 0)
512 {
513 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
514 (void)max31856_deinit(&gs_handle);
515
516 return 1;
517 }
518 max31856_interface_debug_print("max31856: set thermocouple type n.\n");
519 res = max31856_get_thermocouple_type(&gs_handle, &type);
520 if (res != 0)
521 {
522 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
523 (void)max31856_deinit(&gs_handle);
524
525 return 1;
526 }
527 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_N) ? "ok" : "error");
528
529 /* set thermocouple type r */
531 if (res != 0)
532 {
533 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
534 (void)max31856_deinit(&gs_handle);
535
536 return 1;
537 }
538 max31856_interface_debug_print("max31856: set thermocouple type r.\n");
539 res = max31856_get_thermocouple_type(&gs_handle, &type);
540 if (res != 0)
541 {
542 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
543 (void)max31856_deinit(&gs_handle);
544
545 return 1;
546 }
547 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_R) ? "ok" : "error");
548
549 /* set thermocouple type s */
551 if (res != 0)
552 {
553 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
554 (void)max31856_deinit(&gs_handle);
555
556 return 1;
557 }
558 max31856_interface_debug_print("max31856: set thermocouple type s.\n");
559 res = max31856_get_thermocouple_type(&gs_handle, &type);
560 if (res != 0)
561 {
562 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
563 (void)max31856_deinit(&gs_handle);
564
565 return 1;
566 }
567 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_S) ? "ok" : "error");
568
569 /* set thermocouple type t */
571 if (res != 0)
572 {
573 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
574 (void)max31856_deinit(&gs_handle);
575
576 return 1;
577 }
578 max31856_interface_debug_print("max31856: set thermocouple type t.\n");
579 res = max31856_get_thermocouple_type(&gs_handle, &type);
580 if (res != 0)
581 {
582 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
583 (void)max31856_deinit(&gs_handle);
584
585 return 1;
586 }
587 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_T) ? "ok" : "error");
588
589 /* set thermocouple voltage gain 8 */
591 if (res != 0)
592 {
593 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
594 (void)max31856_deinit(&gs_handle);
595
596 return 1;
597 }
598 max31856_interface_debug_print("max31856: set thermocouple voltage gain 8.\n");
599 res = max31856_get_thermocouple_type(&gs_handle, &type);
600 if (res != 0)
601 {
602 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
603 (void)max31856_deinit(&gs_handle);
604
605 return 1;
606 }
607 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_VOLTAGE_GAIN_8) ? "ok" : "error");
608
609 /* set thermocouple voltage gain 32 */
611 if (res != 0)
612 {
613 max31856_interface_debug_print("max31856: set thermocouple type failed.\n");
614 (void)max31856_deinit(&gs_handle);
615
616 return 1;
617 }
618 max31856_interface_debug_print("max31856: set thermocouple voltage gain 32.\n");
619 res = max31856_get_thermocouple_type(&gs_handle, &type);
620 if (res != 0)
621 {
622 max31856_interface_debug_print("max31856: get thermocouple type failed.\n");
623 (void)max31856_deinit(&gs_handle);
624
625 return 1;
626 }
627 max31856_interface_debug_print("max31856: check thermocouple type %s.\n", (type == MAX31856_THERMOCOUPLE_TYPE_VOLTAGE_GAIN_32) ? "ok" : "error");
628
629 /* max31856_set_fault_mask/max31856_get_fault_mask test */
630 max31856_interface_debug_print("max31856: max31856_set_fault_mask/max31856_get_fault_mask test.\n");
631
632 /* enable cold junction high fault threshold mask */
634 if (res != 0)
635 {
636 max31856_interface_debug_print("max31856: set fault mask failed.\n");
637 (void)max31856_deinit(&gs_handle);
638
639 return 1;
640 }
641 max31856_interface_debug_print("max31856: enable cold junction high fault threshold mask.\n");
642 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_CJHIGH, &enable);
643 if (res != 0)
644 {
645 max31856_interface_debug_print("max31856: get fault mask failed.\n");
646 (void)max31856_deinit(&gs_handle);
647
648 return 1;
649 }
650 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_TRUE) ? "ok" : "error");
651
652 /* disable cold junction high fault threshold mask */
654 if (res != 0)
655 {
656 max31856_interface_debug_print("max31856: set fault mask failed.\n");
657 (void)max31856_deinit(&gs_handle);
658
659 return 1;
660 }
661 max31856_interface_debug_print("max31856: disable cold junction high fault threshold mask.\n");
662 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_CJHIGH, &enable);
663 if (res != 0)
664 {
665 max31856_interface_debug_print("max31856: get fault mask failed.\n");
666 (void)max31856_deinit(&gs_handle);
667
668 return 1;
669 }
670 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_FALSE) ? "ok" : "error");
671
672 /* enable cold junction low fault threshold mask */
674 if (res != 0)
675 {
676 max31856_interface_debug_print("max31856: set fault mask failed.\n");
677 (void)max31856_deinit(&gs_handle);
678
679 return 1;
680 }
681 max31856_interface_debug_print("max31856: enable cold junction low fault threshold mask.\n");
682 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_CJLOW, &enable);
683 if (res != 0)
684 {
685 max31856_interface_debug_print("max31856: get fault mask failed.\n");
686 (void)max31856_deinit(&gs_handle);
687
688 return 1;
689 }
690 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_TRUE) ? "ok" : "error");
691
692 /* disable cold junction low fault threshold mask */
694 if (res != 0)
695 {
696 max31856_interface_debug_print("max31856: set fault mask failed.\n");
697 (void)max31856_deinit(&gs_handle);
698
699 return 1;
700 }
701 max31856_interface_debug_print("max31856: disable cold junction low fault threshold mask.\n");
702 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_CJLOW, &enable);
703 if (res != 0)
704 {
705 max31856_interface_debug_print("max31856: get fault mask failed.\n");
706 (void)max31856_deinit(&gs_handle);
707
708 return 1;
709 }
710 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_FALSE) ? "ok" : "error");
711
712 /* enable thermocouple temperature high fault threshold mask */
714 if (res != 0)
715 {
716 max31856_interface_debug_print("max31856: set fault mask failed.\n");
717 (void)max31856_deinit(&gs_handle);
718
719 return 1;
720 }
721 max31856_interface_debug_print("max31856: enable thermocouple temperature high fault threshold mask.\n");
722 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_TCHIGH, &enable);
723 if (res != 0)
724 {
725 max31856_interface_debug_print("max31856: get fault mask failed.\n");
726 (void)max31856_deinit(&gs_handle);
727
728 return 1;
729 }
730 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_TRUE) ? "ok" : "error");
731
732 /* disable thermocouple temperature high fault threshold mask */
734 if (res != 0)
735 {
736 max31856_interface_debug_print("max31856: set fault mask failed.\n");
737 (void)max31856_deinit(&gs_handle);
738
739 return 1;
740 }
741 max31856_interface_debug_print("max31856: disable thermocouple temperature high fault threshold mask.\n");
742 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_TCHIGH, &enable);
743 if (res != 0)
744 {
745 max31856_interface_debug_print("max31856: get fault mask failed.\n");
746 (void)max31856_deinit(&gs_handle);
747
748 return 1;
749 }
750 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_FALSE) ? "ok" : "error");
751
752 /* enable thermocouple temperature low fault threshold mask */
754 if (res != 0)
755 {
756 max31856_interface_debug_print("max31856: set fault mask failed.\n");
757 (void)max31856_deinit(&gs_handle);
758
759 return 1;
760 }
761 max31856_interface_debug_print("max31856: enable thermocouple temperature low fault threshold mask.\n");
762 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_TCLOW, &enable);
763 if (res != 0)
764 {
765 max31856_interface_debug_print("max31856: get fault mask failed.\n");
766 (void)max31856_deinit(&gs_handle);
767
768 return 1;
769 }
770 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_TRUE) ? "ok" : "error");
771
772 /* disable thermocouple temperature low fault threshold mask */
774 if (res != 0)
775 {
776 max31856_interface_debug_print("max31856: set fault mask failed.\n");
777 (void)max31856_deinit(&gs_handle);
778
779 return 1;
780 }
781 max31856_interface_debug_print("max31856: disable thermocouple temperature low fault threshold mask.\n");
782 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_TCLOW, &enable);
783 if (res != 0)
784 {
785 max31856_interface_debug_print("max31856: get fault mask failed.\n");
786 (void)max31856_deinit(&gs_handle);
787
788 return 1;
789 }
790 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_FALSE) ? "ok" : "error");
791
792 /* enable over voltage or undervoltage input fault mask */
794 if (res != 0)
795 {
796 max31856_interface_debug_print("max31856: set fault mask failed.\n");
797 (void)max31856_deinit(&gs_handle);
798
799 return 1;
800 }
801 max31856_interface_debug_print("max31856: enable over voltage or undervoltage input fault mask.\n");
802 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_OVUV, &enable);
803 if (res != 0)
804 {
805 max31856_interface_debug_print("max31856: get fault mask failed.\n");
806 (void)max31856_deinit(&gs_handle);
807
808 return 1;
809 }
810 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_TRUE) ? "ok" : "error");
811
812 /* disable over voltage or undervoltage input fault mask */
814 if (res != 0)
815 {
816 max31856_interface_debug_print("max31856: set fault mask failed.\n");
817 (void)max31856_deinit(&gs_handle);
818
819 return 1;
820 }
821 max31856_interface_debug_print("max31856: disable over voltage or undervoltage input fault mask.\n");
822 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_OVUV, &enable);
823 if (res != 0)
824 {
825 max31856_interface_debug_print("max31856: get fault mask failed.\n");
826 (void)max31856_deinit(&gs_handle);
827
828 return 1;
829 }
830 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_FALSE) ? "ok" : "error");
831
832 /* enable thermocouple open circuit fault mask */
834 if (res != 0)
835 {
836 max31856_interface_debug_print("max31856: set fault mask failed.\n");
837 (void)max31856_deinit(&gs_handle);
838
839 return 1;
840 }
841 max31856_interface_debug_print("max31856: enable thermocouple open circuit fault mask.\n");
842 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_OPEN, &enable);
843 if (res != 0)
844 {
845 max31856_interface_debug_print("max31856: get fault mask failed.\n");
846 (void)max31856_deinit(&gs_handle);
847
848 return 1;
849 }
850 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_TRUE) ? "ok" : "error");
851
852 /* disable thermocouple open circuit fault mask */
854 if (res != 0)
855 {
856 max31856_interface_debug_print("max31856: set fault mask failed.\n");
857 (void)max31856_deinit(&gs_handle);
858
859 return 1;
860 }
861 max31856_interface_debug_print("max31856: disable thermocouple open circuit fault mask.\n");
862 res = max31856_get_fault_mask(&gs_handle, MAX31856_FAULT_MASK_OPEN, &enable);
863 if (res != 0)
864 {
865 max31856_interface_debug_print("max31856: get fault mask failed.\n");
866 (void)max31856_deinit(&gs_handle);
867
868 return 1;
869 }
870 max31856_interface_debug_print("max31856: check fault mask %s.\n", (enable == MAX31856_BOOL_FALSE) ? "ok" : "error");
871
872 /* max31856_set_cold_junction_high_fault_threshold/max31856_get_cold_junction_high_fault_threshold test */
873 max31856_interface_debug_print("max31856: max31856_set_cold_junction_high_fault_threshold/max31856_get_cold_junction_high_fault_threshold test.\n");
874
875 threshold_reg8 = rand() % 128;
876 res = max31856_set_cold_junction_high_fault_threshold(&gs_handle, threshold_reg8);
877 if (res != 0)
878 {
879 max31856_interface_debug_print("max31856: set cold junction high fault threshold failed.\n");
880 (void)max31856_deinit(&gs_handle);
881
882 return 1;
883 }
884 max31856_interface_debug_print("max31856: set cold junction high fault threshold %d.\n", threshold_reg8);
885 res = max31856_get_cold_junction_high_fault_threshold(&gs_handle, &threshold_reg8_check);
886 if (res != 0)
887 {
888 max31856_interface_debug_print("max31856: get cold junction high fault threshold failed.\n");
889 (void)max31856_deinit(&gs_handle);
890
891 return 1;
892 }
893 max31856_interface_debug_print("max31856: check cold junction high fault threshold %s.\n", (threshold_reg8 == threshold_reg8_check) ? "ok" : "error");
894
895 /* max31856_set_cold_junction_low_fault_threshold/max31856_get_cold_junction_low_fault_threshold test */
896 max31856_interface_debug_print("max31856: max31856_set_cold_junction_low_fault_threshold/max31856_get_cold_junction_low_fault_threshold test.\n");
897
898 threshold_reg8 = -(rand() % 128);
899 res = max31856_set_cold_junction_low_fault_threshold(&gs_handle, threshold_reg8);
900 if (res != 0)
901 {
902 max31856_interface_debug_print("max31856: set cold junction low fault threshold failed.\n");
903 (void)max31856_deinit(&gs_handle);
904
905 return 1;
906 }
907 max31856_interface_debug_print("max31856: set cold junction low fault threshold %d.\n", threshold_reg8);
908 res = max31856_get_cold_junction_low_fault_threshold(&gs_handle, &threshold_reg8_check);
909 if (res != 0)
910 {
911 max31856_interface_debug_print("max31856: get cold junction low fault threshold failed.\n");
912 (void)max31856_deinit(&gs_handle);
913
914 return 1;
915 }
916 max31856_interface_debug_print("max31856: check cold junction low fault threshold %s.\n", (threshold_reg8 == threshold_reg8_check) ? "ok" : "error");
917
918 /* max31856_set_temperature_high_fault_threshold/max31856_get_temperature_high_fault_threshold test */
919 max31856_interface_debug_print("max31856: max31856_set_temperature_high_fault_threshold/max31856_get_temperature_high_fault_threshold test.\n");
920
921 threshold_reg16 = rand() % 32768;
922 res = max31856_set_temperature_high_fault_threshold(&gs_handle, threshold_reg16);
923 if (res != 0)
924 {
925 max31856_interface_debug_print("max31856: set temperature high fault threshold failed.\n");
926 (void)max31856_deinit(&gs_handle);
927
928 return 1;
929 }
930 max31856_interface_debug_print("max31856: set temperature high fault threshold %d.\n", threshold_reg16);
931 res = max31856_get_temperature_high_fault_threshold(&gs_handle, &threshold_reg16_check);
932 if (res != 0)
933 {
934 max31856_interface_debug_print("max31856: get temperature high fault threshold failed.\n");
935 (void)max31856_deinit(&gs_handle);
936
937 return 1;
938 }
939 max31856_interface_debug_print("max31856: check temperature high fault threshold %s.\n", (threshold_reg16 == threshold_reg16_check) ? "ok" : "error");
940
941 /* max31856_set_temperature_low_fault_threshold/max31856_get_temperature_low_fault_threshold test */
942 max31856_interface_debug_print("max31856: max31856_set_temperature_low_fault_threshold/max31856_get_temperature_low_fault_threshold test.\n");
943
944 threshold_reg16 = -(rand() % 32768);
945 res = max31856_set_temperature_low_fault_threshold(&gs_handle, threshold_reg16);
946 if (res != 0)
947 {
948 max31856_interface_debug_print("max31856: set temperature low fault threshold failed.\n");
949 (void)max31856_deinit(&gs_handle);
950
951 return 1;
952 }
953 max31856_interface_debug_print("max31856: set temperature low fault threshold %d.\n", threshold_reg16);
954 res = max31856_get_temperature_low_fault_threshold(&gs_handle, &threshold_reg16_check);
955 if (res != 0)
956 {
957 max31856_interface_debug_print("max31856: get temperature low fault threshold failed.\n");
958 (void)max31856_deinit(&gs_handle);
959
960 return 1;
961 }
962 max31856_interface_debug_print("max31856: check temperature low fault threshold %s.\n", (threshold_reg16 == threshold_reg16_check) ? "ok" : "error");
963
964 /* max31856_set_cold_junction_temperature_offset/max31856_get_cold_junction_temperature_offset test */
965 max31856_interface_debug_print("max31856: max31856_set_cold_junction_temperature_offset/max31856_get_cold_junction_temperature_offset test.\n");
966
967 threshold_reg8 = -(rand() % 128);
968 res = max31856_set_cold_junction_temperature_offset(&gs_handle, threshold_reg8);
969 if (res != 0)
970 {
971 max31856_interface_debug_print("max31856: set cold junction temperature offset failed.\n");
972 (void)max31856_deinit(&gs_handle);
973
974 return 1;
975 }
976 max31856_interface_debug_print("max31856: set cold junction temperature offset %d.\n", threshold_reg8);
977 res = max31856_get_cold_junction_temperature_offset(&gs_handle, &threshold_reg8_check);
978 if (res != 0)
979 {
980 max31856_interface_debug_print("max31856: get cold junction temperature offset failed.\n");
981 (void)max31856_deinit(&gs_handle);
982
983 return 1;
984 }
985 max31856_interface_debug_print("max31856: check cold junction temperature offset %s.\n", (threshold_reg8 == threshold_reg8_check) ? "ok" : "error");
986
987 /* max31856_set_cold_junction_temperature/max31856_get_cold_junction_temperature test */
988 max31856_interface_debug_print("max31856: max31856_set_cold_junction_temperature/max31856_get_cold_junction_temperature test.\n");
989
990 threshold_reg16 = rand() % 32768;
991 res = max31856_set_cold_junction_temperature(&gs_handle, threshold_reg16);
992 if (res != 0)
993 {
994 max31856_interface_debug_print("max31856: set cold junction temperature failed.\n");
995 (void)max31856_deinit(&gs_handle);
996
997 return 1;
998 }
999 max31856_interface_debug_print("max31856: set cold junction temperature %d.\n", threshold_reg16);
1000 res = max31856_get_cold_junction_temperature(&gs_handle, &threshold_reg16_check);
1001 if (res != 0)
1002 {
1003 max31856_interface_debug_print("max31856: get cold junction temperature failed.\n");
1004 (void)max31856_deinit(&gs_handle);
1005
1006 return 1;
1007 }
1008 max31856_interface_debug_print("max31856: check cold junction temperature %d.\n", threshold_reg16_check);
1009
1010 /* max31856_clear_fault test */
1011 max31856_interface_debug_print("max31856: max31856_clear_fault test.\n");
1012
1013 /* clear fault */
1014 res = max31856_clear_fault(&gs_handle);
1015 if (res != 0)
1016 {
1017 max31856_interface_debug_print("max31856: clear fault failed.\n");
1018 (void)max31856_deinit(&gs_handle);
1019
1020 return 1;
1021 }
1022 max31856_interface_debug_print("max31856: check clear fault %s.\n", (res == 0) ? "ok" : "error");
1023
1024 /* max31856_get_fault_status test */
1025 max31856_interface_debug_print("max31856: max31856_get_fault_status test.\n");
1026
1027 /* get fault status */
1028 res = max31856_get_fault_status(&gs_handle, &status);
1029 if (res != 0)
1030 {
1031 max31856_interface_debug_print("max31856: get fault status failed.\n");
1032 (void)max31856_deinit(&gs_handle);
1033
1034 return 1;
1035 }
1036 max31856_interface_debug_print("max31856: status is 0x%02X.\n", status);
1037
1038 /* max31856_cold_junction_fault_threshold_convert_to_register/max31856_cold_junction_fault_threshold_convert_to_data test */
1039 max31856_interface_debug_print("max31856: max31856_cold_junction_fault_threshold_convert_to_register/max31856_cold_junction_fault_threshold_convert_to_data test.\n");
1040
1041 deg = (float)(rand() % 100) / 1000.0f + 2.0f;
1042 res = max31856_cold_junction_fault_threshold_convert_to_register(&gs_handle, deg, &threshold_reg8);
1043 if (res != 0)
1044 {
1045 max31856_interface_debug_print("max31856: cold junction fault threshold convert to register failed.\n");
1046 (void)max31856_deinit(&gs_handle);
1047
1048 return 1;
1049 }
1050 max31856_interface_debug_print("max31856: set cold junction fault threshold %0.3fC.\n", deg);
1051 res = max31856_cold_junction_fault_threshold_convert_to_data(&gs_handle, threshold_reg8, &deg_check);
1052 if (res != 0)
1053 {
1054 max31856_interface_debug_print("max31856: cold junction fault threshold convert to data failed.\n");
1055 (void)max31856_deinit(&gs_handle);
1056
1057 return 1;
1058 }
1059 max31856_interface_debug_print("max31856: check cold junction fault threshold %0.3fC.\n", deg_check);
1060
1061 /* max31856_temperature_fault_threshold_convert_to_register/max31856_temperature_fault_threshold_convert_to_data test */
1062 max31856_interface_debug_print("max31856: max31856_temperature_fault_threshold_convert_to_register/max31856_temperature_fault_threshold_convert_to_data test.\n");
1063
1064 deg = (float)(rand() % 1000) / 20.0f;
1065 res = max31856_temperature_fault_threshold_convert_to_register(&gs_handle, deg, &threshold_reg16);
1066 if (res != 0)
1067 {
1068 max31856_interface_debug_print("max31856: temperature fault threshold convert to register failed.\n");
1069 (void)max31856_deinit(&gs_handle);
1070
1071 return 1;
1072 }
1073 max31856_interface_debug_print("max31856: set temperature fault threshold %0.3fC.\n", deg);
1074 res = max31856_temperature_fault_threshold_convert_to_data(&gs_handle, threshold_reg16, &deg_check);
1075 if (res != 0)
1076 {
1077 max31856_interface_debug_print("max31856: temperature fault threshold convert to data failed.\n");
1078 (void)max31856_deinit(&gs_handle);
1079
1080 return 1;
1081 }
1082 max31856_interface_debug_print("max31856: check temperature fault threshold %0.3fC.\n", deg_check);
1083
1084 /* max31856_cold_junction_temperature_offset_convert_to_register/max31856_cold_junction_temperature_offset_convert_to_data test */
1085 max31856_interface_debug_print("max31856: max31856_cold_junction_temperature_offset_convert_to_register/max31856_cold_junction_temperature_offset_convert_to_data test.\n");
1086
1087 deg = (float)(rand() % 1000) / 500.0f;
1088 res = max31856_cold_junction_temperature_offset_convert_to_register(&gs_handle, deg, &threshold_reg8);
1089 if (res != 0)
1090 {
1091 max31856_interface_debug_print("max31856: cold junction temperature offset convert to register failed.\n");
1092 (void)max31856_deinit(&gs_handle);
1093
1094 return 1;
1095 }
1096 max31856_interface_debug_print("max31856: set cold junction temperature offset %0.3fC.\n", deg);
1097 res = max31856_cold_junction_temperature_offset_convert_to_data(&gs_handle, threshold_reg8, &deg_check);
1098 if (res != 0)
1099 {
1100 max31856_interface_debug_print("max31856: cold junction temperature offset convert to data failed.\n");
1101 (void)max31856_deinit(&gs_handle);
1102
1103 return 1;
1104 }
1105 max31856_interface_debug_print("max31856: check cold junction temperature offset %0.3fC.\n", deg_check);
1106
1107 /* max31856_cold_junction_temperature_convert_to_register/max31856_cold_junction_temperature_convert_to_data test */
1108 max31856_interface_debug_print("max31856: max31856_cold_junction_temperature_convert_to_register/max31856_cold_junction_temperature_convert_to_data test.\n");
1109
1110 deg = (float)(rand() % 1000) / 50.0f;
1111 res = max31856_cold_junction_temperature_convert_to_register(&gs_handle, deg, &threshold_reg16);
1112 if (res != 0)
1113 {
1114 max31856_interface_debug_print("max31856: cold junction temperature convert to register failed.\n");
1115 (void)max31856_deinit(&gs_handle);
1116
1117 return 1;
1118 }
1119 max31856_interface_debug_print("max31856: set cold junction temperature %0.3fC.\n", deg);
1120 res = max31856_cold_junction_temperature_convert_to_data(&gs_handle, threshold_reg16, &deg_check);
1121 if (res != 0)
1122 {
1123 max31856_interface_debug_print("max31856: cold junction temperature convert to data failed.\n");
1124 (void)max31856_deinit(&gs_handle);
1125
1126 return 1;
1127 }
1128 max31856_interface_debug_print("max31856: check cold junction temperature %0.3fC.\n", deg_check);
1129
1130 /* finish register */
1131 max31856_interface_debug_print("max31856: finish register test.\n");
1132 (void)max31856_deinit(&gs_handle);
1133
1134 return 0;
1135}
driver max31856 register test header file
struct max31856_info_s max31856_info_t
max31856 information structure definition
uint8_t max31856_set_cold_junction_high_fault_threshold(max31856_handle_t *handle, int8_t threshold)
set cold junction high fault threshold
uint8_t max31856_get_fault_status(max31856_handle_t *handle, uint8_t *status)
get fault status
uint8_t max31856_set_cold_junction_sensor(max31856_handle_t *handle, max31856_bool_t enable)
enable or disable cold junction sensor
uint8_t max31856_set_thermocouple_type(max31856_handle_t *handle, max31856_thermocouple_type_t type)
set thermocouple type
max31856_bool_t
max31856 bool enumeration definition
uint8_t max31856_info(max31856_info_t *info)
get chip's information
uint8_t max31856_clear_fault(max31856_handle_t *handle)
clear fault
uint8_t max31856_get_cold_junction_sensor(max31856_handle_t *handle, max31856_bool_t *enable)
get cold junction sensor status
uint8_t max31856_get_fault_mode(max31856_handle_t *handle, max31856_fault_mode_t *mode)
get fault mode
uint8_t max31856_cold_junction_temperature_convert_to_data(max31856_handle_t *handle, int16_t reg, float *deg)
convert the register raw data to the cold junction temperature
uint8_t max31856_set_fault_mask(max31856_handle_t *handle, max31856_fault_mask_t mask, max31856_bool_t enable)
set fault mask
uint8_t max31856_set_open_circuit_detection(max31856_handle_t *handle, max31856_open_circuit_detection_t detection)
set open circuit detection
uint8_t max31856_get_temperature_low_fault_threshold(max31856_handle_t *handle, int16_t *threshold)
get temperature low fault threshold
max31856_open_circuit_detection_t
max31856 open circuit detection enumeration definition
uint8_t max31856_get_temperature_high_fault_threshold(max31856_handle_t *handle, int16_t *threshold)
get temperature high fault threshold
uint8_t max31856_get_thermocouple_type(max31856_handle_t *handle, max31856_thermocouple_type_t *type)
get thermocouple type
max31856_sample_average_t
max31856 sample average enumeration definition
uint8_t max31856_get_cold_junction_high_fault_threshold(max31856_handle_t *handle, int8_t *threshold)
get cold junction high fault threshold
uint8_t max31856_set_temperature_low_fault_threshold(max31856_handle_t *handle, int16_t threshold)
set temperature low fault threshold
uint8_t max31856_get_sample_average(max31856_handle_t *handle, max31856_sample_average_t *average)
get sample average
uint8_t max31856_get_cold_junction_temperature(max31856_handle_t *handle, int16_t *temperature)
get cold junction temperature
uint8_t max31856_get_cold_junction_low_fault_threshold(max31856_handle_t *handle, int8_t *threshold)
get cold junction low fault threshold
max31856_noise_rejection_filter_t
max31856 noise rejection filter enumeration definition
uint8_t max31856_get_fault_mask(max31856_handle_t *handle, max31856_fault_mask_t mask, max31856_bool_t *enable)
get fault mask
uint8_t max31856_temperature_fault_threshold_convert_to_register(max31856_handle_t *handle, float deg, int16_t *reg)
convert the temperature fault threshold to the register raw data
max31856_fault_mode_t
max31856 fault mode enumeration definition
uint8_t max31856_deinit(max31856_handle_t *handle)
close the chip
uint8_t max31856_set_noise_rejection_filter(max31856_handle_t *handle, max31856_noise_rejection_filter_t filter)
set noise rejection filter
max31856_thermocouple_type_t
max31856 thermocouple type enumeration definition
uint8_t max31856_get_open_circuit_detection(max31856_handle_t *handle, max31856_open_circuit_detection_t *detection)
get open circuit detection
uint8_t max31856_init(max31856_handle_t *handle)
initialize the chip
uint8_t max31856_set_cold_junction_low_fault_threshold(max31856_handle_t *handle, int8_t threshold)
set cold junction low fault threshold
uint8_t max31856_set_cold_junction_temperature(max31856_handle_t *handle, int16_t temperature)
set cold junction temperature
uint8_t max31856_temperature_fault_threshold_convert_to_data(max31856_handle_t *handle, int16_t reg, float *deg)
convert the register raw data to the temperature fault threshold
struct max31856_handle_s max31856_handle_t
max31856 handle structure definition
uint8_t max31856_get_cold_junction_temperature_offset(max31856_handle_t *handle, int8_t *offset)
get cold junction temperature offset
uint8_t max31856_cold_junction_temperature_convert_to_register(max31856_handle_t *handle, float deg, int16_t *reg)
convert the cold junction temperature to the register raw data
uint8_t max31856_cold_junction_fault_threshold_convert_to_register(max31856_handle_t *handle, float deg, int8_t *reg)
convert the cold junction fault threshold to the register raw data
uint8_t max31856_set_sample_average(max31856_handle_t *handle, max31856_sample_average_t average)
set sample average
uint8_t max31856_cold_junction_temperature_offset_convert_to_register(max31856_handle_t *handle, float deg, int8_t *reg)
convert the cold junction temperature offset to the register raw data
uint8_t max31856_cold_junction_fault_threshold_convert_to_data(max31856_handle_t *handle, int8_t reg, float *deg)
convert the register raw data to the cold junction fault threshold
uint8_t max31856_cold_junction_temperature_offset_convert_to_data(max31856_handle_t *handle, int8_t reg, float *deg)
convert the register raw data to the cold junction temperature offset
uint8_t max31856_set_fault_mode(max31856_handle_t *handle, max31856_fault_mode_t mode)
set fault mode
uint8_t max31856_set_cold_junction_temperature_offset(max31856_handle_t *handle, int8_t offset)
set cold junction temperature offset
uint8_t max31856_set_temperature_high_fault_threshold(max31856_handle_t *handle, int16_t threshold)
set temperature high fault threshold
uint8_t max31856_get_noise_rejection_filter(max31856_handle_t *handle, max31856_noise_rejection_filter_t *filter)
get noise rejection filter
@ MAX31856_BOOL_TRUE
@ MAX31856_BOOL_FALSE
@ MAX31856_OPEN_CIRCUIT_DETECTION_MODE2
@ MAX31856_OPEN_CIRCUIT_DETECTION_MODE3
@ MAX31856_OPEN_CIRCUIT_DETECTION_DISABLE
@ MAX31856_OPEN_CIRCUIT_DETECTION_MODE1
@ MAX31856_SAMPLE_AVERAGE_16
@ MAX31856_SAMPLE_AVERAGE_8
@ MAX31856_SAMPLE_AVERAGE_2
@ MAX31856_SAMPLE_AVERAGE_1
@ MAX31856_SAMPLE_AVERAGE_4
@ MAX31856_NOISE_REJECTION_FILTER_50HZ
@ MAX31856_NOISE_REJECTION_FILTER_60HZ
@ MAX31856_FAULT_MODE_INTERRUPT
@ MAX31856_FAULT_MODE_COMPARATOR
@ MAX31856_THERMOCOUPLE_TYPE_K
@ MAX31856_THERMOCOUPLE_TYPE_E
@ MAX31856_THERMOCOUPLE_TYPE_T
@ MAX31856_THERMOCOUPLE_TYPE_J
@ MAX31856_THERMOCOUPLE_TYPE_N
@ MAX31856_THERMOCOUPLE_TYPE_R
@ MAX31856_THERMOCOUPLE_TYPE_B
@ MAX31856_THERMOCOUPLE_TYPE_S
@ MAX31856_THERMOCOUPLE_TYPE_VOLTAGE_GAIN_8
@ MAX31856_THERMOCOUPLE_TYPE_VOLTAGE_GAIN_32
@ MAX31856_FAULT_MASK_OPEN
@ MAX31856_FAULT_MASK_TCLOW
@ MAX31856_FAULT_MASK_CJHIGH
@ MAX31856_FAULT_MASK_TCHIGH
@ MAX31856_FAULT_MASK_OVUV
@ MAX31856_FAULT_MASK_CJLOW
uint8_t max31856_interface_spi_read(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus read
void max31856_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t max31856_interface_spi_init(void)
interface spi bus init
void max31856_interface_debug_print(const char *const fmt,...)
interface print format data
void max31856_interface_receive_callback(uint8_t type)
interface receive callback
uint8_t max31856_interface_spi_write(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus write
uint8_t max31856_interface_spi_deinit(void)
interface spi bus deinit
uint8_t max31856_register_test(void)
register test
char manufacturer_name[32]