max31855 - Driver for MAX31855 cold-junction compensated thermocouple-to-digital converter

group max31855

ESP-IDF driver for MAX31855 cold-junction compensated thermocouple-to-digital converter.

Copyright (c) 2022 Ruslan V. Uss unclerus@gmail.com

BSD Licensed as described in the file LICENSE

Defines

MAX31855_MAX_CLOCK_SPEED_HZ

Functions

esp_err_t max31855_init_desc(max31855_t *dev, spi_host_device_t host, uint32_t clock_speed_hz, gpio_num_t cs_pin)

Initialize device descriptor.

Parameters
  • dev – Device descriptor

  • host – SPI host

  • cs_pin – CS GPIO number

  • clock_speed_hz – SPI clock speed, Hz

Returns

ESP_OK on success

esp_err_t max31855_free_desc(max31855_t *dev)

Free device descriptor.

Parameters

dev – Device descriptor

Returns

ESP_OK on success

esp_err_t max31855_get_temperature(max31855_t *dev, float *tc_t, float *cj_t, bool *scv, bool *scg, bool *oc)

Read temperatures and sensor status.

Parameters
  • dev – Device descriptor

  • tc_t[out] Thermocouple temperature, degrees Celsius

  • cj_t[out] Cold junction temperature, degrees Celsius (NULL-able)

  • scv[out] true when the thermocouple is short-circuited to VCC

  • scg[out] true when the thermocouple is short-circuited to GND

  • oc[out] true when the thermocouple is open (no connections)

Returns

struct max31855_t
#include <max31855.h>

Device descriptor.

Public Members

spi_device_interface_config_t spi_cfg

SPI device configuration.

spi_device_handle_t spi_dev

SPI device handler.