42#define CHIP_NAME "Maxim Integrated max31855"
43#define MANUFACTURER_NAME "Maxim Integrated"
44#define SUPPLY_VOLTAGE_MIN 3.0f
45#define SUPPLY_VOLTAGE_MAX 3.6f
46#define MAX_CURRENT 1.5f
47#define TEMPERATURE_MIN -20.0f
48#define TEMPERATURE_MAX 125.0f
49#define DRIVER_VERSION 1000
70 *data = (((uint32_t)buf[0]) << 24) |
71 (((uint32_t)buf[1]) << 16) |
72 (((uint32_t)buf[2]) << 8) |
73 (((uint32_t)buf[3]) << 0);
103 handle->
debug_print(
"max31855: spi_init is null.\n");
109 handle->
debug_print(
"max31855: spi_deinit is null.\n");
115 handle->
debug_print(
"max31855: spi_read_cmd is null.\n");
121 handle->
debug_print(
"max31855: delay_ms is null.\n");
128 handle->
debug_print(
"max31855: spi init failed.\n");
132 if (a_max31855_spi_read(handle, &data) != 0)
134 handle->
debug_print(
"max31855: read data failed.\n");
139 handle->
fault = 0x00;
171 handle->
debug_print(
"max31855: spi deinit failed.\n");
222 int16_t *reference_junction_raw,
float *reference_junction_temp)
238 res = a_max31855_spi_read(handle, &data);
241 handle->
debug_print(
"max31855: read data failed.\n");
245 d1 = (data >> 16) & 0xFFFFU;
246 d0 = (data >> 0) & 0xFFFFU;
247 if ((d1 & 0x01) != 0)
250 handle->
fault = d0 & 0x07;
256 *thermocouple_raw = (int16_t)((d1 >> 2) | 0xC000U);
260 *thermocouple_raw = (int16_t)(d1 >> 2);
262 *thermocouple_temp = (float)(*thermocouple_raw) * 0.25f;
265 *reference_junction_raw = (int16_t)((d1 >> 4) | 0xF000U);
269 *reference_junction_raw = (int16_t)(d0 >> 4);
271 *reference_junction_temp = (float)(*reference_junction_raw) * 0.0625f;
298 return a_max31855_spi_read(handle, data);
#define SUPPLY_VOLTAGE_MAX
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define CHIP_NAME
chip information definition
driver max31855 header 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_info(max31855_info_t *info)
get chip's information
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_info_s max31855_info_t
max31855 information structure definition
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_get_reg(max31855_handle_t *handle, uint32_t *data)
get the chip register
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* spi_read_cmd)(uint8_t *buf, uint16_t len)
void(* debug_print)(const char *const fmt,...)
uint8_t(* spi_deinit)(void)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v