Go to the documentation of this file.
56 #define ADT7420_A0_PIN(x) (((x) & 0x1) << 0) // I2C Serial Bus Address Selection Pin
57 #define ADT7420_A1_PIN(x) (((x) & 0x1) << 1) // I2C Serial Bus Address Selection Pin
58 #define ADT7420_ADDRESS(x,y) (0x48 + ADT7420_A1_PIN(x) + ADT7420_A0_PIN(y))
61 #define ADT7320_REG_STATUS 0x00 // Status
62 #define ADT7320_REG_CONFIG 0x01 // Configuration
63 #define ADT7320_REG_TEMP 0x02 // Temperature value
64 #define ADT7320_REG_ID 0x03 // ID
65 #define ADT7320_REG_T_CRIT 0x04 // Temperature CRIT setpoint (147'C)
66 #define ADT7320_REG_HIST 0x05 // Temperature HYST setpoint (5'C)
67 #define ADT7320_REG_T_HIGH 0x06 // Temperature HIGH setpoint (64'C)
68 #define ADT7320_REG_T_LOW 0x07 // Temperature LOW setpoint (10'C)
71 #define ADT7320_WRITE_MASK_CMD 0b00111000 // SPI write command
72 #define ADT7320_READ_CMD 0b01000000 // SPI read command
75 #define ADT7420_REG_TEMP_MSB 0x00 // Temperature value MSB
76 #define ADT7420_REG_TEMP_LSB 0x01 // Temperature value LSB
77 #define ADT7420_REG_STATUS 0x02 // Status
78 #define ADT7420_REG_CONFIG 0x03 // Configuration
79 #define ADT7420_REG_T_HIGH_MSB 0x04 // Temperature HIGH setpoint MSB
80 #define ADT7420_REG_T_HIGH_LSB 0x05 // Temperature HIGH setpoint LSB
81 #define ADT7420_REG_T_LOW_MSB 0x06 // Temperature LOW setpoint MSB
82 #define ADT7420_REG_T_LOW_LSB 0x07 // Temperature LOW setpoint LSB
83 #define ADT7420_REG_T_CRIT_MSB 0x08 // Temperature CRIT setpoint MSB
84 #define ADT7420_REG_T_CRIT_LSB 0x09 // Temperature CRIT setpoint LSB
85 #define ADT7420_REG_HIST 0x0A // Temperature HYST setpoint
86 #define ADT7420_REG_ID 0x0B // ID
87 #define ADT7420_REG_RESET 0x2F // Software reset
90 #define ADT7420_STATUS_T_LOW NO_OS_BIT(4)
91 #define ADT7420_STATUS_T_HIGH NO_OS_BIT(5)
92 #define ADT7420_STATUS_T_CRIT NO_OS_BIT(6)
93 #define ADT7420_STATUS_RDY NO_OS_BIT(7)
96 #define ADT7420_CONFIG_OP_MODE(x) ((x) << 5) & (NO_OS_GENMASK(6,5))
97 #define ADT7420_CONFIG_RESOLUTION NO_OS_BIT(7)
100 #define ADT7420_OP_MODE_CONT_CONV 0
101 #define ADT7420_OP_MODE_ONE_SHOT 1
102 #define ADT7420_OP_MODE_1_SPS 2
103 #define ADT7420_OP_MODE_SHUTDOWN 3
106 #define ADT7xxx_ID 0xC
166 uint8_t register_address);
169 uint8_t register_address,
174 uint8_t register_address,
175 uint8_t num_data_bytes,
176 uint8_t *data, uint8_t mask, uint8_t value);
201 uint8_t register_address);
205 uint8_t register_address);
int32_t adt7420_remove(struct adt7420_dev *dev)
Free the resources allocated by adt7420_init().
Definition: adt7420.c:208
float adt7420_get_temperature(struct adt7420_dev *dev)
Reads the temperature data and converts it to Celsius degrees.
Definition: adt7420.c:317
int32_t adt7420_init(struct adt7420_dev **device, struct adt7420_init_param init_param)
Initializes the communication peripheral and checks if the device is present.
Definition: adt7420.c:148
#define ADT7320_REG_CONFIG
Definition: adt7420.h:62
no_os_spi_desc * spi_desc
Definition: adt7420.h:137
int32_t adt7420_remove(struct adt7420_dev *dev)
Free the resources allocated by adt7420_init().
Definition: adt7420.c:208
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
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
uint16_t adt7420_get_register_value(struct adt7420_dev *dev, uint8_t register_address)
Reads the value of a register.
Definition: adt7420.c:81
#define ADT7xxx_ID
Definition: adt7420.h:106
int32_t no_os_tdm_remove(struct no_os_tdm_desc *desc)
Free the resources allocated by no_os_tdm_init().
Definition: no_os_tdm.c:70
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:82
uint16_t adt7420_i2c_get_register_value(struct adt7420_dev *dev, uint8_t register_address)
Reads the value of a register I2C interface device.
Definition: adt7420.c:418
int32_t no_os_tdm_write(struct no_os_tdm_desc *desc, void *data, uint16_t nb_samples)
Write data using the TDM interface.
Definition: no_os_tdm.c:96
Header file of SPI Interface.
@ ID_ADT7422
Definition: adt7420.h:126
#define ADT7320_REG_STATUS
Definition: adt7420.h:61
void adt7420_set_resolution(struct adt7420_dev *dev, uint8_t resolution)
Sets the resolution for ADT7420/ADT7320.
Definition: adt7420.c:261
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
uint16_t set_shift_reg(struct adt7420_dev *dev, uint8_t register_address, uint8_t *data)
Write to input shift register SPI interface.
Definition: adt7420.c:359
float adt7420_get_temperature(struct adt7420_dev *dev)
Reads the temperature data and converts it to Celsius degrees.
Definition: adt7420.c:317
@ ID_ADT7420
Definition: adt7420.h:125
Definition: adt7420.h:146
uint8_t resolution_setting
Definition: adt7420.h:141
@ ID_ADT7410
Definition: adt7420.h:124
uint8_t resolution_setting
Definition: adt7420.h:153
const struct no_os_tdm_platform_ops * platform_ops
Definition: no_os_tdm.h:83
int32_t adt7420_reset(struct adt7420_dev *dev)
Resets the SPI or I2C inteface for the ADT7420/ADT7320.
Definition: adt7420.c:287
@ ID_ADT7310
Definition: adt7420.h:127
Definition: ad9361_util.h:75
uint16_t adt7420_spi_get_register_value(struct adt7420_dev *dev, uint8_t register_address)
Reads the value of a register SPI interface device.
Definition: adt7420.c:399
#define ADT7320_READ_CMD
Definition: adt7420.h:72
int32_t set_register_value(struct adt7420_dev *dev, uint8_t register_address, uint8_t num_data_bytes, uint8_t *data, uint8_t mask, uint8_t value)
Sets the value of a register SPI/I2C.
Definition: adt7420.c:102
uint16_t set_shift_reg(struct adt7420_dev *dev, uint8_t register_address, uint8_t *data)
Write to input shift register SPI interface.
Definition: adt7420.c:359
no_os_spi_init_param spi_init
Definition: adt7420.h:150
@ ID_ADT7312
Definition: adt7420.h:129
const struct adt7420_chip_info chip_info[]
Definition: adt7420.c:50
#define ADT7320_REG_ID
Definition: adt7420.h:64
void adt7420_set_operation_mode(struct adt7420_dev *dev, uint8_t mode)
Sets the operational mode for ADT7420/ADT7320.
Definition: adt7420.c:233
#define ADT7320_REG_TEMP
Definition: adt7420.h:63
Structure holding TDM descriptor.
Definition: no_os_tdm.h:92
no_os_i2c_init_param i2c_init
Definition: adt7420.h:148
@ I2C
Definition: adt7420.h:115
@ I2C
Definition: adxl372.h:323
uint16_t adt7420_spi_get_register_value(struct adt7420_dev *dev, uint8_t register_address)
Reads the value of a register SPI interface device.
Definition: adt7420.c:399
const struct adt7420_chip_info chip_info[]
Definition: adf4106.c:62
@ SPI
Definition: adt7420.h:114
bool adt7420_is_spi(struct adt7420_dev *dev)
Check if the interface of the selected device is SPI.
Definition: adt7420.c:442
#define ADT7420_CONFIG_RESOLUTION
Definition: adt7420.h:97
#define ADT7420_OP_MODE_SHUTDOWN
Definition: adt7420.h:103
adt7420_type
Definition: adt7420.h:123
Structure holding SPI descriptor.
Definition: no_os_spi.h:132
#define ADT7420_REG_ID
Definition: adt7420.h:86
@ ID_ADT7320
Definition: adt7420.h:130
no_os_i2c_desc * i2c_desc
Definition: adt7420.h:135
dev_interface
Definition: adt7420.h:113
#define ADT7420_REG_CONFIG
Definition: adt7420.h:78
uint16_t adt7420_get_register_value(struct adt7420_dev *dev, uint8_t register_address)
Reads the value of a register.
Definition: adt7420.c:81
Structure holding I2C descriptor.
Definition: no_os_i2c.h:81
Definition: adt7420.h:145
void adt7420_set_resolution(struct adt7420_dev *dev, uint8_t resolution)
Sets the resolution for ADT7420/ADT7320.
Definition: adt7420.c:261
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
@ ID_ADT7311
Definition: adt7420.h:128
Header file of I2C Interface.
#define ADT7420_CONFIG_OP_MODE(x)
Definition: adt7420.h:96
#define ADT7420_REG_TEMP_LSB
Definition: adt7420.h:76
union adt7420_init_param::interface_type interface_init
int32_t adt7420_reset(struct adt7420_dev *dev)
Resets the SPI or I2C inteface for the ADT7420/ADT7320.
Definition: adt7420.c:287
uint8_t resolution
Definition: adt7420.h:119
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
Definition: adt7420.h:118
enum dev_interface communication
Definition: adt7420.h:120
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
int32_t set_register_value(struct adt7420_dev *dev, uint8_t register_address, uint8_t num_data_bytes, uint8_t *data, uint8_t mask, uint8_t value)
Sets the value of a register SPI/I2C.
Definition: adt7420.c:102
Definition: adt7420.h:133
enum adt7420_type active_device
Definition: adt7420.h:139
Structure holding the parameters for TDM initialization.
Definition: no_os_tdm.h:63
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:70
void adt7420_set_operation_mode(struct adt7420_dev *dev, uint8_t mode)
Sets the operational mode for ADT7420/ADT7320.
Definition: adt7420.c:233
#define ADT7320_WRITE_MASK_CMD
Definition: adt7420.h:71
#define ADT7320_REG_HIST
Definition: adt7420.h:66
int32_t no_os_tdm_read(struct no_os_tdm_desc *desc, void *data, uint16_t nb_samples)
Read data using the TDM interface.
Definition: no_os_tdm.c:82
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:51
#define ADT7420_REG_TEMP_MSB
Definition: adt7420.h:75
enum adt7420_type active_device
Definition: adt7420.h:155
Implementation of utility functions.
int32_t adt7420_init(struct adt7420_dev **device, struct adt7420_init_param init_param)
Initializes the communication peripheral and checks if the device is present.
Definition: adt7420.c:148
@ SPI
Definition: adxl372.h:322
Header file of TDM Interface.
const struct no_os_tdm_platform_ops * platform_ops
Definition: no_os_tdm.h:94
#define ADT7420_REG_RESET
Definition: adt7420.h:87
int32_t no_os_tdm_init(struct no_os_tdm_desc **desc, const struct no_os_tdm_init_param *param)
Initialize the TDM communication peripheral.
Definition: no_os_tdm.c:51
uint16_t adt7420_i2c_get_register_value(struct adt7420_dev *dev, uint8_t register_address)
Reads the value of a register I2C interface device.
Definition: adt7420.c:418
bool adt7420_is_spi(struct adt7420_dev *dev)
Check if the interface of the selected device is SPI.
Definition: adt7420.c:442
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:112
Header file of ADT7420 Driver.