LibDriver MAX31855
Loading...
Searching...
No Matches
driver_max31855_basic.c
Go to the documentation of this file.
1
36
38
39static max31855_handle_t gs_handle;
40
49{
50 uint8_t res;
51
52 /* link functions */
59
60 /* max31855 init */
61 res = max31855_init(&gs_handle);
62 if (res != 0)
63 {
64 max31855_interface_debug_print("max31855: init failed.\n");
65
66 return 1;
67 }
68
69 return 0;
70}
71
80{
81 /* close max31855 */
82 if (max31855_deinit(&gs_handle) != 0)
83 {
84 return 1;
85 }
86
87 return 0;
88}
89
100uint8_t max31855_basic_read(int16_t *raw, float *temp, max31855_fault_t *fault)
101{
102 int16_t reference_junction_raw;
103 float reference_junction_temp;
104
105 /* read data */
106 if (max31855_read(&gs_handle, raw, temp,
107 &reference_junction_raw, &reference_junction_temp) != 0)
108 {
109 return 1;
110 }
111
112 /* get last fault */
113 if (max31855_get_last_fault(&gs_handle, fault) != 0)
114 {
115 return 1;
116 }
117
118 return 0;
119}
driver max31855 basic include file
max31855_fault_t
max31855 fault enumeration definition
uint8_t max31855_deinit(max31855_handle_t *handle)
close the chip
uint8_t max31855_get_last_fault(max31855_handle_t *handle, max31855_fault_t *fault)
get the last fault
uint8_t max31855_read(max31855_handle_t *handle, int16_t *thermocouple_raw, float *thermocouple_temp, int16_t *reference_junction_raw, float *reference_junction_temp)
read the temperature
struct max31855_handle_s max31855_handle_t
max31855 handle structure definition
uint8_t max31855_init(max31855_handle_t *handle)
initialize the chip
uint8_t max31855_basic_read(int16_t *raw, float *temp, max31855_fault_t *fault)
basic example read the temperature
uint8_t max31855_basic_init(void)
basic example init
uint8_t max31855_basic_deinit(void)
basic example deinit
uint8_t max31855_interface_spi_read_cmd(uint8_t *buf, uint16_t len)
interface spi bus read command
uint8_t max31855_interface_spi_deinit(void)
interface spi bus deinit
void max31855_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t max31855_interface_spi_init(void)
interface spi bus init
void max31855_interface_delay_ms(uint32_t ms)
interface delay ms