no-OS
Classes | Macros | Enumerations | Functions
max31875.h File Reference

Header file of MAX31875 Driver. More...

#include <stdint.h>
#include "no_os_i2c.h"
#include "no_os_util.h"
Include dependency graph for max31875.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  max31875_dev
 MAX31875 handler structure. More...
 
struct  max31875_init_param
 MAX31875 driver initailization structure. More...
 

Macros

#define MAX31875_TEMPERATURE_REG   0x0
 
#define MAX31875_CONFIGURATION_REG   0x1
 
#define MAX31875_THYST_REG   0x2
 
#define MAX31875_TOS_REG   0x3
 
#define MAX31875_OVER_TEMP_STATUS_MASK   NO_OS_BIT(15)
 
#define MAX31875_FAULT_QUEUE_MASK   NO_OS_GENMASK(12, 11)
 
#define MAX31875_COMP_INT_MASK   NO_OS_BIT(9)
 
#define MAX31875_SHUTDOWN_MASK   NO_OS_BIT(8)
 
#define MAX31875_DATA_FORMAT_MASK   NO_OS_BIT(7)
 
#define MAX31875_RESOLUTION_MASK   NO_OS_GENMASK(6, 5)
 
#define MAX31875_TIMEOUT_MASK   NO_OS_BIT(4)
 
#define MAX31875_PEC_MASK   NO_OS_BIT(3)
 
#define MAX31875_CONVERSION_RATE_MASK   NO_OS_GENMASK(2, 1)
 
#define MAX31875_ONESHOT_MASK   NO_OS_BIT(0)
 

Enumerations

enum  max31875_i2c_addr {
  MAX31875R0 = 0x48,
  MAX31875R1 = 0x49,
  MAX31875R2 = 0x4A,
  MAX31875R3 = 0x4B,
  MAX31875R4 = 0x4C,
  MAX31875R5 = 0x4D,
  MAX31875R6 = 0x4E,
  MAX31875R7 = 0x4F
}
 Defines the potential device I2C addresses. More...
 

Functions

int32_t max31875_reg_read (struct max31875_dev *dev, uint32_t reg, uint32_t *readval)
 Read a device register through the I2C interface. More...
 
int32_t max31875_reg_write (struct max31875_dev *dev, uint32_t reg, uint32_t writeval)
 Write a device register through the I2C interface. More...
 
int32_t max31875_reg_write_mask (struct max31875_dev *dev, uint32_t reg, uint32_t val, uint32_t mask)
 Read-modify-write operation on a field of a register. More...
 
int32_t max31875_init (struct max31875_dev **device, struct max31875_init_param *init_param)
 Initialize the device driver befre use. More...
 
int32_t max31875_remove (struct max31875_dev *dev)
 Free memory allocated by max31875_init(). More...
 

Detailed Description

Header file of MAX31875 Driver.

Author
Andrei Drimbarean (andre.nosp@m.i.dr.nosp@m.imbar.nosp@m.ean@.nosp@m.analo.nosp@m.g.co.nosp@m.m)

Copyright 2022(c) Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ MAX31875_COMP_INT_MASK

#define MAX31875_COMP_INT_MASK   NO_OS_BIT(9)

◆ MAX31875_CONFIGURATION_REG

#define MAX31875_CONFIGURATION_REG   0x1

◆ MAX31875_CONVERSION_RATE_MASK

#define MAX31875_CONVERSION_RATE_MASK   NO_OS_GENMASK(2, 1)

◆ MAX31875_DATA_FORMAT_MASK

#define MAX31875_DATA_FORMAT_MASK   NO_OS_BIT(7)

◆ MAX31875_FAULT_QUEUE_MASK

#define MAX31875_FAULT_QUEUE_MASK   NO_OS_GENMASK(12, 11)

◆ MAX31875_ONESHOT_MASK

#define MAX31875_ONESHOT_MASK   NO_OS_BIT(0)

◆ MAX31875_OVER_TEMP_STATUS_MASK

#define MAX31875_OVER_TEMP_STATUS_MASK   NO_OS_BIT(15)

MAX31875_TEMPERATURE_REG

◆ MAX31875_PEC_MASK

#define MAX31875_PEC_MASK   NO_OS_BIT(3)

◆ MAX31875_RESOLUTION_MASK

#define MAX31875_RESOLUTION_MASK   NO_OS_GENMASK(6, 5)

◆ MAX31875_SHUTDOWN_MASK

#define MAX31875_SHUTDOWN_MASK   NO_OS_BIT(8)

◆ MAX31875_TEMPERATURE_REG

#define MAX31875_TEMPERATURE_REG   0x0

Register addresses

◆ MAX31875_THYST_REG

#define MAX31875_THYST_REG   0x2

◆ MAX31875_TIMEOUT_MASK

#define MAX31875_TIMEOUT_MASK   NO_OS_BIT(4)

◆ MAX31875_TOS_REG

#define MAX31875_TOS_REG   0x3

Enumeration Type Documentation

◆ max31875_i2c_addr

Defines the potential device I2C addresses.

Enumerator
MAX31875R0 
MAX31875R1 
MAX31875R2 
MAX31875R3 
MAX31875R4 
MAX31875R5 
MAX31875R6 
MAX31875R7 

Function Documentation

◆ max31875_init()

int32_t max31875_init ( struct max31875_dev **  device,
struct max31875_init_param init_param 
)

Initialize the device driver befre use.

Initialize the device driver befre use.

Parameters
[out]device- Driver handler pointer.
[in]init_param- Pointer to the initialization structure.
Returns
0 in case of success, error code otherwise.

◆ max31875_reg_read()

int32_t max31875_reg_read ( struct max31875_dev dev,
uint32_t  reg,
uint32_t *  readval 
)

Read a device register through the I2C interface.

Read a device register through the I2C interface.

Parameters
[in]dev- Driver handler pointer.
[in]reg- Address of the register to be read.
[out]readval- Pointer to the register value.
Returns
0 in case of success, error code otherwise.
Here is the caller graph for this function:

◆ max31875_reg_write()

int32_t max31875_reg_write ( struct max31875_dev dev,
uint32_t  reg,
uint32_t  writeval 
)

Write a device register through the I2C interface.

Write a device register through the I2C interface.

Parameters
[in]dev- Driver handler pointer.
[in]reg- Address of the register to be written.
[in]writeval- New value for the register.
Returns
0 in case of success, error code otherwise.
Here is the caller graph for this function:

◆ max31875_reg_write_mask()

int32_t max31875_reg_write_mask ( struct max31875_dev dev,
uint32_t  reg,
uint32_t  val,
uint32_t  mask 
)

Read-modify-write operation on a field of a register.

Read-modify-write operation on a field of a register.

Parameters
[in]dev- Driver handler pointer.
[in]reg- Address of the register.
[in]val- New value for the bit field.
[in]mask- Mask of the bit field.
Returns
0 in case of success, error code otherwise.

◆ max31875_remove()

int32_t max31875_remove ( struct max31875_dev dev)

Free memory allocated by max31875_init().

Free memory allocated by max31875_init().

Parameters
[in]dev- Device driver handler.
Returns
0 in case of success, error code otherwise.