no-OS
max31875.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __MAX31875_H__
34 #define __MAX31875_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 
40 #include <stdint.h>
41 #include "no_os_i2c.h"
42 #include "no_os_util.h"
43 
44 /******************************************************************************/
45 /************************** MAX31875 Definitions ******************************/
46 /******************************************************************************/
47 
49 #define MAX31875_TEMPERATURE_REG 0x0
50 #define MAX31875_CONFIGURATION_REG 0x1
51 #define MAX31875_THYST_REG 0x2
52 #define MAX31875_TOS_REG 0x3
53 
55 #define MAX31875_OVER_TEMP_STATUS_MASK NO_OS_BIT(15)
56 #define MAX31875_FAULT_QUEUE_MASK NO_OS_GENMASK(12, 11)
57 #define MAX31875_COMP_INT_MASK NO_OS_BIT(9)
58 #define MAX31875_SHUTDOWN_MASK NO_OS_BIT(8)
59 #define MAX31875_DATA_FORMAT_MASK NO_OS_BIT(7)
60 #define MAX31875_RESOLUTION_MASK NO_OS_GENMASK(6, 5)
61 #define MAX31875_TIMEOUT_MASK NO_OS_BIT(4)
62 #define MAX31875_PEC_MASK NO_OS_BIT(3)
63 #define MAX31875_CONVERSION_RATE_MASK NO_OS_GENMASK(2, 1)
64 #define MAX31875_ONESHOT_MASK NO_OS_BIT(0)
65 
66 /******************************************************************************/
67 /*************************** Types Declarations *******************************/
68 /******************************************************************************/
69 
75  MAX31875R0 = 0x48,
76  MAX31875R1 = 0x49,
77  MAX31875R2 = 0x4A,
78  MAX31875R3 = 0x4B,
79  MAX31875R4 = 0x4C,
80  MAX31875R5 = 0x4D,
81  MAX31875R6 = 0x4E,
82  MAX31875R7 = 0x4F
83 };
84 
89 struct max31875_dev {
90  /* I2C */
92 };
93 
99  /* I2C */
101 };
102 
103 /******************************************************************************/
104 /************************ Functions Declarations ******************************/
105 /******************************************************************************/
106 
108 int32_t max31875_reg_read(struct max31875_dev *dev,
109  uint32_t reg,
110  uint32_t *readval);
111 
113 int32_t max31875_reg_write(struct max31875_dev *dev,
114  uint32_t reg,
115  uint32_t writeval);
116 
118 int32_t max31875_reg_write_mask(struct max31875_dev *dev,
119  uint32_t reg,
120  uint32_t val,
121  uint32_t mask);
122 
124 int32_t max31875_init(struct max31875_dev **device,
126 
128 int32_t max31875_remove(struct max31875_dev *dev);
129 
130 #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:53
no_os_alloc.h
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:159
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:52
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:113
MAX31875R2
@ MAX31875R2
Definition: max31875.h:77
NO_OS_IS_ERR_VALUE
#define NO_OS_IS_ERR_VALUE(x)
Definition: no_os_error.h:50
max31875_remove
int32_t max31875_remove(struct max31875_dev *dev)
Free memory allocated by max31875_init().
Definition: max31875.c:168
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:85
device
Definition: ad9361_util.h:69
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
max31875_init_param::i2c_init
struct no_os_i2c_init_param i2c_init
Definition: max31875.h:100
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
MAX31875R7
@ MAX31875R7
Definition: max31875.h:82
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:136
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:109
MAX31875R1
@ MAX31875R1
Definition: max31875.h:76
max31875_init_param
MAX31875 driver initailization structure.
Definition: max31875.h:98
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
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:190
no_os_i2c.h
Header file of I2C Interface.
MAX31875R3
@ MAX31875R3
Definition: max31875.h:78
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
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:109
max31875_remove
int32_t max31875_remove(struct max31875_dev *dev)
Free memory allocated by max31875_init().
Definition: max31875.c:168
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:85
MAX31875R5
@ MAX31875R5
Definition: max31875.h:80
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:113
max31875_i2c_addr
max31875_i2c_addr
Defines the potential device I2C addresses.
Definition: max31875.h:74
max31875_dev::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: max31875.h:91
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:53
MAX31875R4
@ MAX31875R4
Definition: max31875.h:79
max31875_dev
MAX31875 handler structure.
Definition: max31875.h:89
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:136
MAX31875R6
@ MAX31875R6
Definition: max31875.h:81
no_os_util.h
Header file of utility functions.
max31875.h
Header file of MAX31875 Driver.
MAX31875R0
@ MAX31875R0
Definition: max31875.h:75