no-OS
Classes | Macros | Functions
max31855.h File Reference
#include <stdint.h>
#include "no_os_spi.h"
#include "no_os_util.h"
Include dependency graph for max31855.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  max31855_init_param
 MAX31855 comm init param. More...
 
struct  max31855_decimal
 interger/decimal format used for temperature representation More...
 
struct  _max31855_fault_sts_mask
 
union  max31855_fault_sts
 
struct  max31855_dev
 MAX31855 descriptor. More...
 

Macros

#define MAX31855_GET_INTERNAL_TEMP(x)   (no_os_field_get(NO_OS_GENMASK(15, 4), x))
 
#define MAX31855_GET_FAULT_BIT(x)   (no_os_field_get(NO_OS_BIT(16), x))
 
#define MAX31855_GET_THERMOCOUPLE_TEMP(x)   (no_os_field_get(NO_OS_GENMASK(31, 18), x))
 
#define MAX31855_GET_FAULTS(x)   (no_os_field_get(NO_OS_GENMASK(2, 0), x))
 
#define MAX31855_THERMOCOUPLE_TEMP_DEC_DIV   4
 
#define MAX31855_INTERNAL_TEMP_DEC_DIV   16
 
#define MAX31855_THERMOCOUPLE_TEMP_SIGN_POS   13
 
#define MAX31855_INTERNAL_TEMP_SIGN_POS   11
 

Functions

int max31855_init (struct max31855_dev **, struct max31855_init_param *)
 Device and comm init function. More...
 
int max31855_remove (struct max31855_dev *)
 Remove resources allocated by the init function. More...
 
int max31855_read_raw (struct max31855_dev *, uint32_t *)
 Read raw register value. More...
 
int max31855_read_temp (struct max31855_dev *, struct max31855_decimal *, struct max31855_decimal *)
 Read thermocouple and internal temperatures (converted in deg. C) More...
 

Macro Definition Documentation

◆ MAX31855_GET_FAULT_BIT

#define MAX31855_GET_FAULT_BIT (   x)    (no_os_field_get(NO_OS_BIT(16), x))

◆ MAX31855_GET_FAULTS

#define MAX31855_GET_FAULTS (   x)    (no_os_field_get(NO_OS_GENMASK(2, 0), x))

◆ MAX31855_GET_INTERNAL_TEMP

#define MAX31855_GET_INTERNAL_TEMP (   x)    (no_os_field_get(NO_OS_GENMASK(15, 4), x))

◆ MAX31855_GET_THERMOCOUPLE_TEMP

#define MAX31855_GET_THERMOCOUPLE_TEMP (   x)    (no_os_field_get(NO_OS_GENMASK(31, 18), x))

◆ MAX31855_INTERNAL_TEMP_DEC_DIV

#define MAX31855_INTERNAL_TEMP_DEC_DIV   16

◆ MAX31855_INTERNAL_TEMP_SIGN_POS

#define MAX31855_INTERNAL_TEMP_SIGN_POS   11

◆ MAX31855_THERMOCOUPLE_TEMP_DEC_DIV

#define MAX31855_THERMOCOUPLE_TEMP_DEC_DIV   4

Decimal resolution for the 2 temperatures (0.25 C and 0.0625 C / LSB). integer_temp = raw_temp / dec_div.

◆ MAX31855_THERMOCOUPLE_TEMP_SIGN_POS

#define MAX31855_THERMOCOUPLE_TEMP_SIGN_POS   13

Sign bit position

Function Documentation

◆ max31855_init()

int max31855_init ( struct max31855_dev **  device,
struct max31855_init_param init_param 
)

Device and comm init function.

Device and comm init function

Parameters
device- MAX31855 descriptor to be initialized
init_param- Init parameter for descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ max31855_read_raw()

int max31855_read_raw ( struct max31855_dev device,
uint32_t *  val 
)

Read raw register value.

Read raw register value

Parameters
device- MAX31855 descriptor
val- register value
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ max31855_read_temp()

int max31855_read_temp ( struct max31855_dev device,
struct max31855_decimal thermocouple_temp,
struct max31855_decimal internal_temp 
)

Read thermocouple and internal temperatures (converted in deg. C)

Read thermocouple and internal temperatures (converted in deg. C)

Parameters
device- MAX31855 descriptor
thermocouple_temp- thermocouple probe temperature (deg. C)
internal_temp- board's temperature (used as reference)
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ max31855_remove()

int max31855_remove ( struct max31855_dev device)

Remove resources allocated by the init function.

Free resources allocated by the init function

Parameters
device- MAX31855 descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function: