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

driver max31856 source file More...

#include "driver_max31856.h"
Include dependency graph for driver_max31856.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "Maxim Integrated MAX31856"
 chip information definition
#define MANUFACTURER_NAME   "Maxim Integrated"
#define SUPPLY_VOLTAGE_MIN   3.0f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   2.0f
#define TEMPERATURE_MIN   -55.0f
#define TEMPERATURE_MAX   125.0f
#define DRIVER_VERSION   1000
#define MAX31856_REG_CR0   0x00
 chip register definition
#define MAX31856_REG_CR1   0x01
#define MAX31856_REG_MASK   0x02
#define MAX31856_REG_CJHF   0x03
#define MAX31856_REG_CJLF   0x04
#define MAX31856_REG_LTHFTH   0x05
#define MAX31856_REG_LTHFTL   0x06
#define MAX31856_REG_LTLFTH   0x07
#define MAX31856_REG_LTLFTL   0x08
#define MAX31856_REG_CJTO   0x09
#define MAX31856_REG_CJTH   0x0A
#define MAX31856_REG_CJTL   0x0B
#define MAX31856_REG_LTCBH   0x0C
#define MAX31856_REG_LTCBM   0x0D
#define MAX31856_REG_LTCBL   0x0E
#define MAX31856_REG_SR   0x0F

Functions

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_irq_handler (max31856_handle_t *handle)
 irq handler
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
uint8_t max31856_info (max31856_info_t *info)
 get chip's information

Detailed Description

driver max31856 source 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.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "Maxim Integrated MAX31856"

chip information definition

chip name

Definition at line 42 of file driver_max31856.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_max31856.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Maxim Integrated"

manufacturer name

Definition at line 43 of file driver_max31856.c.

◆ MAX31856_REG_CJHF

#define MAX31856_REG_CJHF   0x03

cold-junction high fault threshold register

Definition at line 57 of file driver_max31856.c.

◆ MAX31856_REG_CJLF

#define MAX31856_REG_CJLF   0x04

cold-junction low fault threshold register

Definition at line 58 of file driver_max31856.c.

◆ MAX31856_REG_CJTH

#define MAX31856_REG_CJTH   0x0A

cold-junction temperature msb register

Definition at line 64 of file driver_max31856.c.

◆ MAX31856_REG_CJTL

#define MAX31856_REG_CJTL   0x0B

cold-junction temperature lsb register

Definition at line 65 of file driver_max31856.c.

◆ MAX31856_REG_CJTO

#define MAX31856_REG_CJTO   0x09

cold-junction temperature offset register

Definition at line 63 of file driver_max31856.c.

◆ MAX31856_REG_CR0

#define MAX31856_REG_CR0   0x00

chip register definition

configuration 0 register

Definition at line 54 of file driver_max31856.c.

◆ MAX31856_REG_CR1

#define MAX31856_REG_CR1   0x01

configuration 1 register

Definition at line 55 of file driver_max31856.c.

◆ MAX31856_REG_LTCBH

#define MAX31856_REG_LTCBH   0x0C

linearized tc temperature byte 2 register

Definition at line 66 of file driver_max31856.c.

◆ MAX31856_REG_LTCBL

#define MAX31856_REG_LTCBL   0x0E

linearized tc temperature byte 0 register

Definition at line 68 of file driver_max31856.c.

◆ MAX31856_REG_LTCBM

#define MAX31856_REG_LTCBM   0x0D

linearized tc temperature byte 1 register

Definition at line 67 of file driver_max31856.c.

◆ MAX31856_REG_LTHFTH

#define MAX31856_REG_LTHFTH   0x05

linearized temperature high fault threshold msb register

Definition at line 59 of file driver_max31856.c.

◆ MAX31856_REG_LTHFTL

#define MAX31856_REG_LTHFTL   0x06

linearized temperature high fault threshold lsb register

Definition at line 60 of file driver_max31856.c.

◆ MAX31856_REG_LTLFTH

#define MAX31856_REG_LTLFTH   0x07

linearized temperature low fault threshold msb register

Definition at line 61 of file driver_max31856.c.

◆ MAX31856_REG_LTLFTL

#define MAX31856_REG_LTLFTL   0x08

linearized temperature low fault threshold lsb register

Definition at line 62 of file driver_max31856.c.

◆ MAX31856_REG_MASK

#define MAX31856_REG_MASK   0x02

fault mask register

Definition at line 56 of file driver_max31856.c.

◆ MAX31856_REG_SR

#define MAX31856_REG_SR   0x0F

fault status register

Definition at line 69 of file driver_max31856.c.

◆ MAX_CURRENT

#define MAX_CURRENT   2.0f

chip max current

Definition at line 46 of file driver_max31856.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 45 of file driver_max31856.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   3.0f

chip min supply voltage

Definition at line 44 of file driver_max31856.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   125.0f

chip max operating temperature

Definition at line 48 of file driver_max31856.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -55.0f

chip min operating temperature

Definition at line 47 of file driver_max31856.c.