no-OS
max31875.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef __MAX31875_H__
40 #define __MAX31875_H__
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 
46 #include <stdint.h>
47 #include "no_os_i2c.h"
48 #include "no_os_util.h"
49 
50 /******************************************************************************/
51 /************************** MAX31875 Definitions ******************************/
52 /******************************************************************************/
53 
55 #define MAX31875_TEMPERATURE_REG 0x0
56 #define MAX31875_CONFIGURATION_REG 0x1
57 #define MAX31875_THYST_REG 0x2
58 #define MAX31875_TOS_REG 0x3
59 
61 #define MAX31875_OVER_TEMP_STATUS_MASK NO_OS_BIT(15)
62 #define MAX31875_FAULT_QUEUE_MASK NO_OS_GENMASK(12, 11)
63 #define MAX31875_COMP_INT_MASK NO_OS_BIT(9)
64 #define MAX31875_SHUTDOWN_MASK NO_OS_BIT(8)
65 #define MAX31875_DATA_FORMAT_MASK NO_OS_BIT(7)
66 #define MAX31875_RESOLUTION_MASK NO_OS_GENMASK(6, 5)
67 #define MAX31875_TIMEOUT_MASK NO_OS_BIT(4)
68 #define MAX31875_PEC_MASK NO_OS_BIT(3)
69 #define MAX31875_CONVERSION_RATE_MASK NO_OS_GENMASK(2, 1)
70 #define MAX31875_ONESHOT_MASK NO_OS_BIT(0)
71 
72 /******************************************************************************/
73 /*************************** Types Declarations *******************************/
74 /******************************************************************************/
75 
81  MAX31875R0 = 0x48,
82  MAX31875R1 = 0x49,
83  MAX31875R2 = 0x4A,
84  MAX31875R3 = 0x4B,
85  MAX31875R4 = 0x4C,
86  MAX31875R5 = 0x4D,
87  MAX31875R6 = 0x4E,
88  MAX31875R7 = 0x4F
89 };
90 
95 struct max31875_dev {
96  /* I2C */
98 };
99 
105  /* I2C */
107 };
108 
109 /******************************************************************************/
110 /************************ Functions Declarations ******************************/
111 /******************************************************************************/
112 
114 int32_t max31875_reg_read(struct max31875_dev *dev,
115  uint32_t reg,
116  uint32_t *readval);
117 
119 int32_t max31875_reg_write(struct max31875_dev *dev,
120  uint32_t reg,
121  uint32_t writeval);
122 
124 int32_t max31875_reg_write_mask(struct max31875_dev *dev,
125  uint32_t reg,
126  uint32_t val,
127  uint32_t mask);
128 
130 int32_t max31875_init(struct max31875_dev **device,
132 
134 int32_t max31875_remove(struct max31875_dev *dev);
135 
136 #endif /* __MAX31875_H__ */
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.
Definition: max31875.c:58
no_os_i2c_write
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:85
no_os_i2c_init
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:51
no_os_i2c_remove
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:70
MAX31875R2
@ MAX31875R2
Definition: max31875.h:83
NO_OS_IS_ERR_VALUE
#define NO_OS_IS_ERR_VALUE(x)
Definition: no_os_error.h:56
max31875_remove
int32_t max31875_remove(struct max31875_dev *dev)
Free memory allocated by max31875_init().
Definition: max31875.c:173
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.
Definition: max31875.c:90
device
Definition: ad9361_util.h:75
max31875_init_param::i2c_init
struct no_os_i2c_init_param i2c_init
Definition: max31875.h:106
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
MAX31875R7
@ MAX31875R7
Definition: max31875.h:88
max31875_init
int32_t max31875_init(struct max31875_dev **device, struct max31875_init_param *init_param)
Initialize the device driver befre use.
Definition: max31875.c:141
no_os_error.h
Error codes definition.
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.
Definition: max31875.c:114
MAX31875R1
@ MAX31875R1
Definition: max31875.h:82
max31875_init_param
MAX31875 driver initailization structure.
Definition: max31875.h:104
no_os_i2c_desc
Structure holding I2C descriptor.
Definition: no_os_i2c.h:81
no_os_i2c_read
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:104
no_os_i2c.h
Header file of I2C Interface.
MAX31875R3
@ MAX31875R3
Definition: max31875.h:84
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.
Definition: max31875.c:114
max31875_remove
int32_t max31875_remove(struct max31875_dev *dev)
Free memory allocated by max31875_init().
Definition: max31875.c:173
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.
Definition: max31875.c:90
MAX31875R5
@ MAX31875R5
Definition: max31875.h:86
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
max31875_i2c_addr
max31875_i2c_addr
Defines the potential device I2C addresses.
Definition: max31875.h:80
max31875_dev::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: max31875.h:97
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.
Definition: max31875.c:58
MAX31875R4
@ MAX31875R4
Definition: max31875.h:85
max31875_dev
MAX31875 handler structure.
Definition: max31875.h:95
max31875_init
int32_t max31875_init(struct max31875_dev **device, struct max31875_init_param *init_param)
Initialize the device driver befre use.
Definition: max31875.c:141
MAX31875R6
@ MAX31875R6
Definition: max31875.h:87
no_os_util.h
Header file of utility functions.
max31875.h
Header file of MAX31875 Driver.
MAX31875R0
@ MAX31875R0
Definition: max31875.h:81