precision-converters-firmware
Macros | Enumerations | Functions
adt7xxx_support.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ADT7420_LSB_MASK   0x00FF
 
#define ADT7420_MSB_MASK   0xFF00
 
#define ADT7420_LSB_OFFSET   0
 
#define ADT7420_MSB_OFFSET   8
 
#define ADT7420_CONFIG_CT_POL   NO_OS_BIT(2)
 
#define ADT7420_CONFIG_FAULT_QUEUE(x)   ((x) & 0x3)
 
#define ADT7420_CONFIG_INT_POL   NO_OS_BIT(3)
 
#define ADT7420_CONFIG_INT_CT_MODE   NO_OS_BIT(4)
 
#define ADT7420_MASK_SET_PT_REGISTER   0x00
 
#define ADT7420_FAULT_QUEUE_1_FAULT   0
 
#define ADT7420_FAULT_QUEUE_2_FAULTS   1
 
#define ADT7420_FAULT_QUEUE_3_FAULTS   2
 
#define ADT7420_FAULT_QUEUE_4_FAULTS   3
 
#define ADT7320_DEFAULT_ID   0xC3
 
#define ADT7420_DEFAULT_ID   0xCB
 

Enumerations

enum  registers_e {
  REG_TEMP ,
  REG_STATUS ,
  REG_CONFIG ,
  REG_T_CRIT ,
  REG_HIST ,
  REG_T_HIGH ,
  REG_T_LOW ,
  REG_ID ,
  REG_RESET
}
 

Functions

int32_t adt7420_set_fault_queue (struct adt7420_dev *dev, uint8_t mode)
 Sets the Fault Queue option for ADT7420/ADT7320. More...
 
int32_t adt7420_set_ct_int_mode (struct adt7420_dev *dev, uint8_t setting)
 Sets comparator/interrupt (CT/INT) mode for ADT7420/ADT7320. More...
 
int32_t adt7420_set_ct_int_polarity (struct adt7420_dev *dev, uint8_t polarity)
 Sets output polarity for the pins CT/INT (Critical Temp - Over/Under Temp). More...
 
int32_t adt7420_wr_setpoint_reg (struct adt7420_dev *device, uint16_t register_value, uint16_t data)
 Write to a setpoint register. More...
 
uint16_t configure_write_type_registers (struct adt7420_dev *dev, uint16_t register_address)
 Configure write typev register based on communication interface. More...
 
int32_t adt7420_get_register_address_and_value (struct adt7420_dev *dev, uint16_t register_address, uint16_t *reg_val)
 Reads the value of a register SPI/I2C. More...
 

Macro Definition Documentation

◆ ADT7320_DEFAULT_ID

#define ADT7320_DEFAULT_ID   0xC3

◆ ADT7420_CONFIG_CT_POL

#define ADT7420_CONFIG_CT_POL   NO_OS_BIT(2)

◆ ADT7420_CONFIG_FAULT_QUEUE

#define ADT7420_CONFIG_FAULT_QUEUE (   x)    ((x) & 0x3)

◆ ADT7420_CONFIG_INT_CT_MODE

#define ADT7420_CONFIG_INT_CT_MODE   NO_OS_BIT(4)

◆ ADT7420_CONFIG_INT_POL

#define ADT7420_CONFIG_INT_POL   NO_OS_BIT(3)

◆ ADT7420_DEFAULT_ID

#define ADT7420_DEFAULT_ID   0xCB

◆ ADT7420_FAULT_QUEUE_1_FAULT

#define ADT7420_FAULT_QUEUE_1_FAULT   0

◆ ADT7420_FAULT_QUEUE_2_FAULTS

#define ADT7420_FAULT_QUEUE_2_FAULTS   1

◆ ADT7420_FAULT_QUEUE_3_FAULTS

#define ADT7420_FAULT_QUEUE_3_FAULTS   2

◆ ADT7420_FAULT_QUEUE_4_FAULTS

#define ADT7420_FAULT_QUEUE_4_FAULTS   3

◆ ADT7420_LSB_MASK

#define ADT7420_LSB_MASK   0x00FF

◆ ADT7420_LSB_OFFSET

#define ADT7420_LSB_OFFSET   0

◆ ADT7420_MASK_SET_PT_REGISTER

#define ADT7420_MASK_SET_PT_REGISTER   0x00

◆ ADT7420_MSB_MASK

#define ADT7420_MSB_MASK   0xFF00

◆ ADT7420_MSB_OFFSET

#define ADT7420_MSB_OFFSET   8

Enumeration Type Documentation

◆ registers_e

Enumerator
REG_TEMP 
REG_STATUS 
REG_CONFIG 
REG_T_CRIT 
REG_HIST 
REG_T_HIGH 
REG_T_LOW 
REG_ID 
REG_RESET 

Function Documentation

◆ adt7420_get_register_address_and_value()

int32_t adt7420_get_register_address_and_value ( struct adt7420_dev *  dev,
uint16_t  register_address,
uint16_t *  reg_val 
)

Reads the value of a register SPI/I2C.

Get the register address based on the register type enum- registers_e

Parameters
dev- The device structure.
register_address- Address of the register.
reg_val- Value of the concerned register
Returns
0 in case of success, negative error code otherwise

◆ adt7420_set_ct_int_mode()

int32_t adt7420_set_ct_int_mode ( struct adt7420_dev *  dev,
uint8_t  setting 
)

Sets comparator/interrupt (CT/INT) mode for ADT7420/ADT7320.

Sets comparator/interrupt (CT/INT) mode for ADT7420/ADT7320.

Parameters
dev- The device structure.
setting- Mode selection. Example: 0 - Interrupt (default). 1 - Comparator.
Returns
0 in case of success, negative error code otherwise.

◆ adt7420_set_ct_int_polarity()

int32_t adt7420_set_ct_int_polarity ( struct adt7420_dev *  dev,
uint8_t  polarity 
)

Sets output polarity for the pins CT/INT (Critical Temp - Over/Under Temp).

Sets output polarity for the pins CT/INT (Critical Temp - Over/Under Temp).

Parameters
dev- The device structure.
polarity- Polarity selection. Example: 0 - Active Low (default). 1 - Active High.
Returns
0 in case of success, negative error code otherwise.

◆ adt7420_set_fault_queue()

int32_t adt7420_set_fault_queue ( struct adt7420_dev *  dev,
uint8_t  mode 
)

Sets the Fault Queue option for ADT7420/ADT7320.

Sets the Fault Queue option for ADT7420/ADT7320.

Parameters
dev- The device structure.
mode- Fault Queue selection. Example: 1 - 1 fault (default). 2 - 2 faults. 3 - 3 faults. 4 - 4 faults.
Returns
0 in case of success, negative error code otherwise.

◆ adt7420_wr_setpoint_reg()

int32_t adt7420_wr_setpoint_reg ( struct adt7420_dev *  dev,
uint16_t  register_value,
uint16_t  data 
)

Write to a setpoint register.

Writes data to temperature registers

Parameters
dev- The device structure.
register_value- Command control bits.
data- Data to be written in input register.
Returns
0 in case of success, negative error code otherwise

◆ configure_write_type_registers()

uint16_t configure_write_type_registers ( struct adt7420_dev *  dev,
uint16_t  register_address 
)

Configure write typev register based on communication interface.

Get the register address of write type registers

Parameters
dev- The device structure.
register_address- Register type.
Returns
register_address - Register Address.
Here is the caller graph for this function: