LibDriver MAX31856
Loading...
Searching...
No Matches
driver_max31856.h File Reference

driver max31856 header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for driver_max31856.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  max31856_handle_s
 max31856 handle structure definition More...
struct  max31856_info_s
 max31856 information structure definition More...

Macros

#define DRIVER_MAX31856_LINK_INIT(HANDLE, STRUCTURE)
 initialize max31856_handle_t structure
#define DRIVER_MAX31856_LINK_SPI_INIT(HANDLE, FUC)
 link spi_init function
#define DRIVER_MAX31856_LINK_SPI_DEINIT(HANDLE, FUC)
 link spi_deinit function
#define DRIVER_MAX31856_LINK_SPI_READ(HANDLE, FUC)
 link spi_read function
#define DRIVER_MAX31856_LINK_SPI_WRITE(HANDLE, FUC)
 link spi_write function
#define DRIVER_MAX31856_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_MAX31856_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function
#define DRIVER_MAX31856_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
 link receive_callback function

Typedefs

typedef struct max31856_handle_s max31856_handle_t
 max31856 handle structure definition
typedef struct max31856_info_s max31856_info_t
 max31856 information structure definition

Enumerations

enum  max31856_bool_t { MAX31856_BOOL_FALSE = 0x00 , MAX31856_BOOL_TRUE = 0x01 }
 max31856 bool enumeration definition More...
enum  max31856_open_circuit_detection_t { MAX31856_OPEN_CIRCUIT_DETECTION_DISABLE = 0x00 , MAX31856_OPEN_CIRCUIT_DETECTION_MODE1 = 0x01 , MAX31856_OPEN_CIRCUIT_DETECTION_MODE2 = 0x02 , MAX31856_OPEN_CIRCUIT_DETECTION_MODE3 = 0x03 }
 max31856 open circuit detection enumeration definition More...
enum  max31856_fault_mode_t { MAX31856_FAULT_MODE_COMPARATOR = 0x00 , MAX31856_FAULT_MODE_INTERRUPT = 0x01 }
 max31856 fault mode enumeration definition More...
enum  max31856_noise_rejection_filter_t { MAX31856_NOISE_REJECTION_FILTER_60HZ = 0x00 , MAX31856_NOISE_REJECTION_FILTER_50HZ = 0x01 }
 max31856 noise rejection filter enumeration definition More...
enum  max31856_sample_average_t {
  MAX31856_SAMPLE_AVERAGE_1 = 0x00 , MAX31856_SAMPLE_AVERAGE_2 = 0x01 , MAX31856_SAMPLE_AVERAGE_4 = 0x02 , MAX31856_SAMPLE_AVERAGE_8 = 0x03 ,
  MAX31856_SAMPLE_AVERAGE_16 = 0x04
}
 max31856 sample average enumeration definition More...
enum  max31856_thermocouple_type_t {
  MAX31856_THERMOCOUPLE_TYPE_B = 0x00 , MAX31856_THERMOCOUPLE_TYPE_E = 0x01 , MAX31856_THERMOCOUPLE_TYPE_J = 0x02 , MAX31856_THERMOCOUPLE_TYPE_K = 0x03 ,
  MAX31856_THERMOCOUPLE_TYPE_N = 0x04 , MAX31856_THERMOCOUPLE_TYPE_R = 0x05 , MAX31856_THERMOCOUPLE_TYPE_S = 0x06 , MAX31856_THERMOCOUPLE_TYPE_T = 0x07 ,
  MAX31856_THERMOCOUPLE_TYPE_VOLTAGE_GAIN_8 = 0x08 , MAX31856_THERMOCOUPLE_TYPE_VOLTAGE_GAIN_32 = 0x0C
}
 max31856 thermocouple type enumeration definition More...
enum  max31856_fault_mask_t {
  MAX31856_FAULT_MASK_CJHIGH = 5 , MAX31856_FAULT_MASK_CJLOW = 4 , MAX31856_FAULT_MASK_TCHIGH = 3 , MAX31856_FAULT_MASK_TCLOW = 2 ,
  MAX31856_FAULT_MASK_OVUV = 1 , MAX31856_FAULT_MASK_OPEN = 0
}
 max31856 fault mask enumeration definition More...
enum  max31856_fault_status_t {
  MAX31856_FAULT_STATUS_CJRANGE = (1 << 7) , MAX31856_FAULT_STATUS_TCRANGE = (1 << 6) , MAX31856_FAULT_STATUS_CJHIGH = (1 << 5) , MAX31856_FAULT_STATUS_CJLOW = (1 << 4) ,
  MAX31856_FAULT_STATUS_TCHIGH = (1 << 3) , MAX31856_FAULT_STATUS_TCLOW = (1 << 2) , MAX31856_FAULT_STATUS_OVUV = (1 << 1) , MAX31856_FAULT_STATUS_OPEN = (1 << 0)
}
 max31856 fault status enumeration definition More...

Functions

uint8_t max31856_info (max31856_info_t *info)
 get chip's information
uint8_t max31856_irq_handler (max31856_handle_t *handle)
 irq handler
uint8_t max31856_init (max31856_handle_t *handle)
 initialize the chip
uint8_t max31856_deinit (max31856_handle_t *handle)
 close the chip
uint8_t max31856_single_read (max31856_handle_t *handle, int32_t *raw, double *deg)
 read data from the chip once
uint8_t max31856_continuous_read (max31856_handle_t *handle, int32_t *raw, double *deg)
 read data from the chip continuously
uint8_t max31856_start_continuous_read (max31856_handle_t *handle)
 start the chip reading
uint8_t max31856_stop_continuous_read (max31856_handle_t *handle)
 stop the chip reading
uint8_t max31856_read_cold_junction_temperature (max31856_handle_t *handle, int16_t *raw, double *deg)
 read cold junction temperature
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_open_circuit_detection (max31856_handle_t *handle, max31856_open_circuit_detection_t *detection)
 get open circuit detection
uint8_t max31856_set_cold_junction_sensor (max31856_handle_t *handle, max31856_bool_t enable)
 enable or disable cold junction sensor
uint8_t max31856_get_cold_junction_sensor (max31856_handle_t *handle, max31856_bool_t *enable)
 get cold junction sensor status
uint8_t max31856_set_fault_mode (max31856_handle_t *handle, max31856_fault_mode_t mode)
 set fault mode
uint8_t max31856_get_fault_mode (max31856_handle_t *handle, max31856_fault_mode_t *mode)
 get fault mode
uint8_t max31856_clear_fault (max31856_handle_t *handle)
 clear fault
uint8_t max31856_set_noise_rejection_filter (max31856_handle_t *handle, max31856_noise_rejection_filter_t filter)
 set noise rejection filter
uint8_t max31856_get_noise_rejection_filter (max31856_handle_t *handle, max31856_noise_rejection_filter_t *filter)
 get noise rejection filter
uint8_t max31856_set_sample_average (max31856_handle_t *handle, max31856_sample_average_t average)
 set sample average
uint8_t max31856_get_sample_average (max31856_handle_t *handle, max31856_sample_average_t *average)
 get sample average
uint8_t max31856_set_thermocouple_type (max31856_handle_t *handle, max31856_thermocouple_type_t type)
 set thermocouple type
uint8_t max31856_get_thermocouple_type (max31856_handle_t *handle, max31856_thermocouple_type_t *type)
 get thermocouple type
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_get_fault_mask (max31856_handle_t *handle, max31856_fault_mask_t mask, max31856_bool_t *enable)
 get fault mask
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_cold_junction_high_fault_threshold (max31856_handle_t *handle, int8_t *threshold)
 get cold junction high fault threshold
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_get_cold_junction_low_fault_threshold (max31856_handle_t *handle, int8_t *threshold)
 get cold junction low fault threshold
uint8_t max31856_set_temperature_high_fault_threshold (max31856_handle_t *handle, int16_t threshold)
 set temperature high fault threshold
uint8_t max31856_get_temperature_high_fault_threshold (max31856_handle_t *handle, int16_t *threshold)
 get temperature 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_temperature_low_fault_threshold (max31856_handle_t *handle, int16_t *threshold)
 get temperature low fault threshold
uint8_t max31856_set_cold_junction_temperature_offset (max31856_handle_t *handle, int8_t offset)
 set cold junction temperature offset
uint8_t max31856_get_cold_junction_temperature_offset (max31856_handle_t *handle, int8_t *offset)
 get cold junction temperature offset
uint8_t max31856_set_cold_junction_temperature (max31856_handle_t *handle, int16_t temperature)
 set cold junction temperature
uint8_t max31856_get_cold_junction_temperature (max31856_handle_t *handle, int16_t *temperature)
 get cold junction temperature
uint8_t max31856_get_fault_status (max31856_handle_t *handle, uint8_t *status)
 get fault status
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_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_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
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
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_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_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_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_reg (max31856_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t max31856_get_reg (max31856_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver max31856 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2026-07-08

history

Date Version Author Description
2026/07/08 1.0 Shifeng Li first upload

Definition in file driver_max31856.h.