Implementation of MAX31827 Driver.
More...
#include "no_os_i2c.h"
#include "no_os_util.h"
|
| int | max31827_reg_read (struct max31827_device *dev, uint8_t addr, uint16_t *val) |
| | Read a register value.
|
| |
| int | max31827_reg_write (struct max31827_device *dev, uint8_t addr, uint16_t val) |
| | Write a register value.
|
| |
| int | max31827_reg_update_bits (struct max31827_device *dev, uint8_t addr, uint16_t mask, uint16_t val) |
| | Read-modify-write operation.
|
| |
| int | max31827_init (struct max31827_device **dev, struct max31827_init_param *init_param) |
| | Device and comm init function.
|
| |
| int | max31827_remove (struct max31827_device *dev) |
| | Free resources allocated by the init function.
|
| |
| int | max31827_init_client (struct max31827_device *dev, struct max31827_init_param *init_param) |
| | Initialize MAX31827 device setup.
|
| |
| int | max31827_read_temp (struct max31827_device *dev, uint8_t addr, int32_t *val) |
| | Read a temperature from a register.
|
| |
| int | max31827_read_temp_input (struct max31827_device *dev, int32_t *val) |
| | Read input temperature.
|
| |
| int | max31827_shutdown_write (struct max31827_device *dev, uint8_t reg, uint16_t mask, uint16_t val) |
| | Shutdown then write register value.
|
| |
| int | max31827_write_alarm_val (struct max31827_device *dev, unsigned int reg, int32_t val) |
| | Write the alarm value to the specified register.
|
| |
Implementation of MAX31827 Driver.
- Author
- John Erasmus Mari Geronimo (johne.nosp@m.rasm.nosp@m.usmar.nosp@m.i.ge.nosp@m.ronim.nosp@m.o@an.nosp@m.alog..nosp@m.com)
Copyright 2024(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ MAX31827_ALRM_POL_HIGH
| #define MAX31827_ALRM_POL_HIGH 0x1 |
◆ MAX31827_ALRM_POL_LOW
| #define MAX31827_ALRM_POL_LOW 0x0 |
◆ MAX31827_CONF_1SHOT_MASK
| #define MAX31827_CONF_1SHOT_MASK NO_OS_BIT(0) |
◆ MAX31827_CONF_ALRM_POL_MASK
| #define MAX31827_CONF_ALRM_POL_MASK NO_OS_BIT(8) |
◆ MAX31827_CONF_CNV_RATE
| #define MAX31827_CONF_CNV_RATE |
( |
| x | ) |
|
Value:
#define MAX31827_CONF_CNV_RATE_MASK
Definition max31827.h:25
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
◆ MAX31827_CONF_CNV_RATE_MASK
◆ MAX31827_CONF_COMP_INT_MASK
| #define MAX31827_CONF_COMP_INT_MASK NO_OS_BIT(9) |
◆ MAX31827_CONF_FLT_Q_MASK
◆ MAX31827_CONF_O_TEMP_STAT
| #define MAX31827_CONF_O_TEMP_STAT |
( |
| x | ) |
|
Value:
#define MAX31827_CONF_O_TEMP_STAT_MASK
Definition max31827.h:33
◆ MAX31827_CONF_O_TEMP_STAT_MASK
| #define MAX31827_CONF_O_TEMP_STAT_MASK NO_OS_BIT(15) |
◆ MAX31827_CONF_PEC_EN_MASK
| #define MAX31827_CONF_PEC_EN_MASK NO_OS_BIT(4) |
◆ MAX31827_CONF_REG
| #define MAX31827_CONF_REG 0x2 |
◆ MAX31827_CONF_RESO
| #define MAX31827_CONF_RESO |
( |
| x | ) |
|
Value:
#define MAX31827_CONF_RESO_MASK
Definition max31827.h:28
◆ MAX31827_CONF_RESO_MASK
◆ MAX31827_CONF_TIMEOUT_MASK
| #define MAX31827_CONF_TIMEOUT_MASK NO_OS_BIT(5) |
◆ MAX31827_CONF_U_TEMP_STAT
| #define MAX31827_CONF_U_TEMP_STAT |
( |
| x | ) |
|
Value:
#define MAX31827_CONF_U_TEMP_STAT_MASK
Definition max31827.h:32
◆ MAX31827_CONF_U_TEMP_STAT_MASK
| #define MAX31827_CONF_U_TEMP_STAT_MASK NO_OS_BIT(14) |
◆ MAX31827_DEVICE_ENABLE
| #define MAX31827_DEVICE_ENABLE |
( |
| x | ) |
|
◆ MAX31827_FLT_Q_1
| #define MAX31827_FLT_Q_1 0x0 |
◆ MAX31827_FLT_Q_4
| #define MAX31827_FLT_Q_4 0x2 |
◆ MAX31827_M_DGR_TO_16_BIT
| #define MAX31827_M_DGR_TO_16_BIT |
( |
| x | ) |
|
◆ MAX31827_T_REG
| #define MAX31827_T_REG 0x0 |
◆ MAX31827_TH_HYST_REG
| #define MAX31827_TH_HYST_REG 0x8 |
◆ MAX31827_TH_REG
| #define MAX31827_TH_REG 0x4 |
◆ MAX31827_TL_HYST_REG
| #define MAX31827_TL_HYST_REG 0xA |
◆ MAX31827_TL_REG
| #define MAX31827_TL_REG 0x6 |
◆ max31827_cnv
MAX31827 conversion rate.
| Enumerator |
|---|
| MAX31827_CNV_1_DIV_64_HZ | |
| MAX31827_CNV_1_DIV_32_HZ | |
| MAX31827_CNV_1_DIV_16_HZ | |
| MAX31827_CNV_1_DIV_4_HZ | |
| MAX31827_CNV_1_HZ | |
| MAX31827_CNV_4_HZ | |
| MAX31827_CNV_8_HZ | |
◆ max31827_resolution
MAX31827 temperature resolution.
| Enumerator |
|---|
| MAX31827_RES_8_BIT | |
| MAX31827_RES_9_BIT | |
| MAX31827_RES_10_BIT | |
| MAX31827_RES_12_BIT | |
◆ max31827_init()
Device and comm init function.
Device and comm init function
- Parameters
-
| dev | - MAX31827 descriptor to be initialized |
| init_param | - Init parameter for descriptor |
- Returns
- 0 in case of success, errno errors otherwise
◆ max31827_init_client()
Initialize MAX31827 device setup.
Initialize MAX31827 device setup
- Parameters
-
| dev | - MAX31827 descriptor to be initialized |
| init_param | - Init parameter for descriptor |
- Returns
- 0 in case of success, errno errors otherwise
◆ max31827_read_temp()
| int max31827_read_temp |
( |
struct max31827_device * | dev, |
|
|
uint8_t | addr, |
|
|
int32_t * | val ) |
Read a temperature from a register.
Read a temperature from a register
- Parameters
-
| dev | - MAX31827 descriptor |
| addr | - register address |
| val | - temperature value |
- Returns
- 0 in case of success, negative error code otherwise
◆ max31827_read_temp_input()
| int max31827_read_temp_input |
( |
struct max31827_device * | dev, |
|
|
int32_t * | val ) |
Read input temperature.
Read input temperature
- Parameters
-
| dev | - MAX31827 descriptor |
| val | - temperature value |
- Returns
- 0 in case of success, negative error code otherwise
For 12-bit resolution the conversion time is 140 ms, thus an additional 15 ms is needed to complete the conversion: 125 ms + 15 ms = 140 ms
◆ max31827_reg_read()
| int max31827_reg_read |
( |
struct max31827_device * | dev, |
|
|
uint8_t | addr, |
|
|
uint16_t * | val ) |
Read a register value.
Read a register value
- Parameters
-
| dev | - MAX31827 descriptor |
| addr | - register address |
| val | - register value |
- Returns
- 0 in case of success, negative error code otherwise
◆ max31827_reg_update_bits()
| int max31827_reg_update_bits |
( |
struct max31827_device * | dev, |
|
|
uint8_t | addr, |
|
|
uint16_t | mask, |
|
|
uint16_t | val ) |
Read-modify-write operation.
Read-modify-write operation
- Parameters
-
| dev | - MAX31827 descriptor |
| addr | - register address |
| mask | - Mask for specific register bits to be updated |
| val | - register value |
- Returns
- 0 in case of success, negative error code otherwise
◆ max31827_reg_write()
| int max31827_reg_write |
( |
struct max31827_device * | dev, |
|
|
uint8_t | addr, |
|
|
uint16_t | val ) |
Write a register value.
Write a register value
- Parameters
-
| dev | - MAX31827 descriptor |
| addr | - register address |
| val | - register value |
- Returns
- 0 in case of success, negative error code otherwise
◆ max31827_remove()
Free resources allocated by the init function.
Free resources allocated by the init function
- Parameters
-
- Returns
- 0 in case of success, errno errors otherwise
◆ max31827_shutdown_write()
| int max31827_shutdown_write |
( |
struct max31827_device * | dev, |
|
|
uint8_t | reg, |
|
|
uint16_t | mask, |
|
|
uint16_t | val ) |
Shutdown then write register value.
Shutdown then write register value
- Parameters
-
| dev | - MAX31827 descriptor |
| reg | - register address |
| mask | - Mask for specific register bits to be updated |
| val | - register value (requires prior bit shifting) |
- Returns
- 0 in case of success, negative error code otherwise
Before the Temperature Threshold Alarm, Alarm Hysteresis Threshold and Resolution bits from Configuration register are changed over I2C, the part must be in shutdown mode.
◆ max31827_write_alarm_val()
| int max31827_write_alarm_val |
( |
struct max31827_device * | dev, |
|
|
unsigned int | reg, |
|
|
int32_t | val ) |
Write the alarm value to the specified register.
Write the alarm value to the specified register
- Parameters
-
| dev | - MAX31827 descriptor |
| reg | - register address |
| val | - temperature value |
- Returns
- 0 in case of success, negative error code otherwise
◆ max31827_conv_times
| const int max31827_conv_times[4] |
|
extern |
MAX31827 temperature conversion times in us.
◆ max31827_conversions
| const uint16_t max31827_conversions[8] |
|
extern |
MAX31827 conversion period in ms.
◆ max31827_resolutions
| const uint16_t max31827_resolutions[4] |
|
extern |
MAX31827 temperature resolution.