no-OS
Classes | Macros | Enumerations | Functions
ad74413r.h File Reference

Header file of AD74413r Driver. More...

#include "stdint.h"
#include "stdbool.h"
#include "no_os_spi.h"
#include "no_os_gpio.h"
Include dependency graph for ad74413r.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ad74413r_init_param
 Initialization parameter for the device descriptor. More...
 
struct  ad74413r_decimal
 ADC value format. More...
 
struct  ad74413r_channel_config
 Device channel state. More...
 
struct  _ad74413r_live_status
 Bitfield struct which maps on the LIVE_STATUS register. More...
 
union  ad74413r_live_status
 Used to store the live status bit fields. More...
 
struct  ad74413r_desc
 AD74413r device descriptor. More...
 

Macros

#define AD74413R_N_CHANNELS   4
 
#define AD74413R_N_DIAG_CHANNELS   4
 
#define AD74413R_CH_A   0
 
#define AD74413R_CH_B   1
 
#define AD74413R_CH_C   2
 
#define AD74413R_CH_D   3
 
#define AD74413R_RSENSE   100
 
#define AD74413R_ADC_MAX_VALUE   65535
 
#define AD74413R_NOP   0x00
 
#define AD74413R_CH_FUNC_SETUP(x)   (0x01 + x)
 
#define AD74413R_ADC_CONFIG(x)   (0x05 + x)
 
#define AD74413R_DIN_CONFIG(x)   (0x09 + x)
 
#define AD74413R_GPO_PARALLEL   0x0D
 
#define AD74413R_GPO_CONFIG(x)   (0x0E + x)
 
#define AD74413R_OUTPUT_CONFIG(x)   (0x12 + x)
 
#define AD74413R_DAC_CODE(x)   (0x16 + x)
 
#define AD74413R_DAC_CLR_CODE(x)   (0x1A + x)
 
#define AD74413R_DAC_ACTIVE(x)   (0x1E + x)
 
#define AD74413R_DIN_THRESH   0x22
 
#define AD74413R_ADC_CONV_CTRL   0x23
 
#define AD74413R_DIAG_ASSIGN   0x24
 
#define AD74413R_DIN_COMP_OUT   0x25
 
#define AD74413R_ADC_RESULT(x)   (0x26 + x)
 
#define AD74413R_DIAG_RESULT(x)   (0x2A + x)
 
#define AD74413R_ALERT_STATUS   0x2E
 
#define AD74413R_LIVE_STATUS   0x2F
 
#define AD74413R_ALERT_MASK   0x3C
 
#define AD74413R_DIN_COUNTER(x)   (0x3D + x)
 
#define AD74413R_READ_SELECT   0x41
 
#define AD74413R_THERM_RST   0x43
 
#define AD74413R_CMD_KEY   0x44
 
#define AD74413R_SCRATCH   0x45
 
#define AD74413R_SILICON_REV   0x46
 
#define AD74413R_ALERT_STATUS_RESET   NO_OS_GENMASK(15, 0)
 
#define AD74413R_CMD_KEY_RESET_1   0x15FA
 
#define AD74413R_CMD_KEY_RESET_2   0xAF51
 
#define AD74413R_CMD_KEY_LDAC   0x953A
 
#define AD74413R_CMD_KEY_DAC_CLEAR   0x73D1
 
#define AD74413R_SPI_RD_RET_INFO_MASK   NO_OS_BIT(8)
 
#define AD74413R_ERR_CLR_MASK   NO_OS_GENMASK(15, 0)
 
#define AD74413R_SPI_CRC_ERR_MASK   NO_OS_BIT(13)
 
#define AD74413R_CH_FUNC_SETUP_MASK   NO_OS_GENMASK(3, 0)
 
#define AD74413R_ADC_RANGE_MASK   NO_OS_GENMASK(7, 5)
 
#define AD74413R_ADC_REJECTION_MASK   NO_OS_GENMASK(4, 3)
 
#define AD74413R_DEBOUNCE_TIME_MASK   NO_OS_GENMASK(4, 0)
 
#define AD74413R_DEBOUNCE_MODE_MASK   NO_OS_BIT(5)
 
#define AD74413R_DIAG_RESULT_MASK   NO_OS_GENMASK(15, 0)
 
#define AD74413R_REV_ID   NO_OS_GENMASK(7, 0)
 
#define AD74413R_CH_200K_TO_GND_MASK   NO_OS_BIT(2)
 
#define AD74413R_GPO_PAR_DATA_MASK(x)   NO_OS_BIT(x)
 
#define AD74413R_GPO_SELECT_MASK   NO_OS_GENMASK(2, 0)
 
#define AD74413R_GPO_DATA_MASK   NO_OS_BIT(3)
 
#define AD74413R_SLEW_EN_MASK   NO_OS_GENMASK(7, 6)
 
#define AD74413R_SLEW_LIN_STEP_MASK   NO_OS_GENMASK(5, 4)
 
#define AD74413R_SLEW_LIN_RATE_MASK   NO_OS_GENMASK(3, 2)
 
#define AD74413R_CLR_EN_MASK   NO_OS_BIT(1)
 
#define AD74413R_I_LIMIT_MASK   NO_OS_BIT(0)
 
#define AD74413R_DAC_CODE_MASK   NO_OS_GENMASK(12, 0)
 
#define AD74413R_CLR_CODE_MASK   NO_OS_GENMASK(12, 0)
 
#define AD74413R_DAC_ACTIVE_CODE_MASK   NO_OS_GENMASK(12, 0)
 
#define AD74413R_COMP_THRESH_MASK   NO_OS_GENMASK(5, 1)
 
#define AD74413R_DIN_THRESH_MODE_MASK   NO_OS_BIT(0)
 
#define AD74413R_DIN_COMP_CH(x)   NO_OS_BIT(x)
 
#define AD74413R_EN_REJ_DIAG_MASK   NO_OS_BIT(10)
 
#define AD74413R_CONV_SEQ_MASK   NO_OS_GENMASK(9, 8)
 
#define AD74413R_DIAG_EN_MASK(x)   (NO_OS_BIT(x) << 4)
 
#define AD74413R_CH_EN_MASK(x)   NO_OS_BIT(x)
 
#define AD74413R_DIAG_ASSIGN_MASK(x)   (NO_OS_GENMASK(3, 0) << (x * 4))
 
#define AD74413R_DAC_RANGE   11000
 
#define AD74413R_DAC_RESOLUTION   13
 
#define AD74413R_DAC_CODE_MAX   8191
 
#define AD74413R_ADC_RESOLUTION   16
 
#define AD74413R_ADC_CODE_MAX   65536
 
#define AD74413R_THRESHOLD_DAC_RANGE   29
 
#define AD74413R_THRESHOLD_RANGE   16000
 
#define AD74413R_TEMP_OFFSET   -2392
 
#define AD74413R_TEMP_SCALE   8950
 
#define AD74413R_TEMP_SCALE_DIV   1000
 
#define AD74413R_RANGE_10V_SCALE   15259ULL
 
#define AD74413R_RANGE_10V_SCALE_DIV   100000ULL
 
#define AD74413R_RANGE_2V5_SCALE   38147ULL
 
#define AD74413R_RANGE_2V5_SCALE_DIV   1000000ULL
 
#define AD74413R_RANGE_5V_SCALE   76294ULL
 
#define AD74413R_RANGE_5V_SCALE_DIV   1000000ULL
 
#define AD74413R_RANGE_5V_OFFSET   -(AD74413R_ADC_MAX_VALUE / 2)
 
#define AD74413R_RTD_PULL_UP   2100000ULL
 
#define AD74413R_SENSE_RESISTOR_OHMS   100
 

Enumerations

enum  ad74413r_chip_id {
  AD74413R,
  AD74412R
}
 The chips supported by this driver. More...
 
enum  ad74413r_rejection {
  AD74413R_REJECTION_50_60,
  AD74413R_REJECTION_NONE,
  AD74413R_REJECTION_50_60_HART,
  AD74413R_REJECTION_HART
}
 Rejection config values. The HART variants are not supported by the AD74412R device. More...
 
enum  ad74413r_op_mode {
  AD74413R_HIGH_Z,
  AD74413R_VOLTAGE_OUT,
  AD74413R_CURRENT_OUT,
  AD74413R_VOLTAGE_IN,
  AD74413R_CURRENT_IN_EXT,
  AD74413R_CURRENT_IN_LOOP,
  AD74413R_RESISTANCE,
  AD74413R_DIGITAL_INPUT,
  AD74413R_DIGITAL_INPUT_LOOP,
  AD74413R_CURRENT_IN_EXT_HART,
  AD74413R_CURRENT_IN_LOOP_HART
}
 Operation modes of the device. More...
 
enum  ad74413r_adc_range {
  AD74413R_ADC_RANGE_10V,
  AD74413R_ADC_RANGE_2P5V_EXT_POW,
  AD74413R_ADC_RANGE_2P5V_INT_POW,
  AD74413R_ADC_RANGE_5V_BI_DIR
}
 ADC ranges configurations. These are dependent on the operation mode. More...
 
enum  ad74413r_conv_seq {
  AD74413R_STOP_PWR_UP,
  AD74413R_START_SINGLE,
  AD74413R_START_CONT,
  AD74413R_STOP_PWR_DOWN
}
 ADC conversion sequence commands. More...
 
enum  ad74413r_gpo_select {
  AD74413R_GPO_CONFIG_100K_PD,
  AD74413R_GPO_CONFIG_DATA,
  AD74413R_GPO_CONFIG_PAR_DATA,
  AD74413R_GPO_CONFIG_COMP,
  AD74413R_GPO_CONFIG_HIGH_Z
}
 GPO operation modes. More...
 
enum  ad74413r_diag_mode {
  AD74413R_DIAG_AGND,
  AD74413R_DIAG_TEMP,
  AD74413R_DIAG_AVDD,
  AD74413R_DIAG_AVSS,
  AD74413R_DIAG_REFOUT,
  AD74413R_DIAG_ALDO_5V,
  AD74413R_DIAG_ALDO_1V8,
  AD74413R_DIAG_DLDO_1V8,
  AD74413R_DIAG_DVCC,
  AD74413R_DIAG_IOVDD,
  AD74413R_SENSEL_A,
  AD74413R_SENSEL_B,
  AD74413R_SENSEL_C,
  AD74413R_SENSEL_D
}
 Possible values to be loaded in the DIAG_RESULT register. More...
 
enum  ad74413r_debounce_mode {
  AD74413R_DEBOUNCE_MODE_0,
  AD74413R_DEBOUNCE_MODE_1
}
 Debounce modes for the IOx inputs when using the digital input op mode. More...
 
enum  ad74413r_slew_lin_step {
  AD74413R_STEP_64,
  AD74413R_STEP_120,
  AD74413R_STEP_500,
  AD74413R_STEP_1820
}
 The number of increments per step a DAC does when slew control is enabled. More...
 
enum  ad74413r_lin_rate {
  AD74413R_LIN_RATE_4KHZ,
  AD74413R_LIN_RATE_64KHZ,
  AD74413R_LIN_RATE_150KHZ,
  AD74413R_LIN_RATE_240KHZ
}
 Possible update rates for a DAC when slew control is enabled. More...
 
enum  ad74413r_adc_sample {
  AD74413R_ADC_SAMPLE_20HZ = 20,
  AD74413R_ADC_SAMPLE_4800HZ = 4800,
  AD74413R_ADC_SAMPLE_10HZ = 10,
  AD74413R_ADC_SAMPLE_1200HZ = 1200
}
 

Functions

int ad74413r_dac_voltage_to_code (uint32_t, uint32_t *)
 Converts a millivolt value in the corresponding DAC 13 bit code. More...
 
int ad74413r_range_to_voltage_range (enum ad74413r_adc_range, uint32_t *)
 Convert the measuring range of the ADC from range enum values to millivolts. More...
 
int ad74413r_range_to_voltage_offset (enum ad74413r_adc_range, int32_t *)
 Convert the measuring range of the ADC from range enum values to millivolts. More...
 
int ad74413r_reg_write (struct ad74413r_desc *, uint32_t, uint16_t)
 Write a register's value. More...
 
int ad74413r_reg_read_raw (struct ad74413r_desc *, uint32_t, uint8_t *)
 Read a raw communication frame. More...
 
int ad74413r_reg_read (struct ad74413r_desc *, uint32_t, uint16_t *)
 Read a register's value. More...
 
int ad74413r_reg_update (struct ad74413r_desc *, uint32_t, uint16_t, uint16_t)
 Update a register's field. More...
 
int ad74413r_nb_active_channels (struct ad74413r_desc *, uint8_t *)
 Get the number of active channels. More...
 
int ad74413r_clear_errors (struct ad74413r_desc *)
 Clear the ALERT_STATUS register. More...
 
int ad74413r_set_info (struct ad74413r_desc *desc, uint16_t mode)
 Select which information the device will respond with (in the readback field) when a read operation is performed. More...
 
int ad74413r_reset (struct ad74413r_desc *)
 Perform either a software or hardware reset and wait for device reset time. More...
 
int ad74413r_set_channel_function (struct ad74413r_desc *, uint32_t, enum ad74413r_op_mode)
 Set the operation mode for a specific channel. More...
 
int ad74413r_get_raw_adc_result (struct ad74413r_desc *, uint32_t, uint16_t *)
 Read the raw ADC raw conversion value. More...
 
int ad74413r_set_adc_channel_enable (struct ad74413r_desc *, uint32_t, bool)
 Enable/disable a specific ADC channel. More...
 
int ad74413r_set_diag_channel_enable (struct ad74413r_desc *, uint32_t, bool)
 Enable conversions on a diagnostic register. More...
 
int ad74413r_get_adc_range (struct ad74413r_desc *, uint32_t, uint16_t *)
 Get the ADC measurement range for a specific channel. More...
 
int ad74413r_get_adc_rejection (struct ad74413r_desc *, uint32_t, enum ad74413r_rejection *)
 Get the rejection setting for a specific channel. More...
 
int ad74413r_get_adc_diag_rejection (struct ad74413r_desc *, enum ad74413r_rejection *)
 Get the rejection setting for a specific channel. More...
 
int ad74413r_set_adc_rejection (struct ad74413r_desc *, uint32_t, enum ad74413r_rejection)
 Set the rejection setting for a specific channel. More...
 
int ad74413r_get_adc_rate (struct ad74413r_desc *, uint32_t, enum ad74413r_adc_sample *)
 Get the ADC sample rate. More...
 
int ad74413r_set_adc_rate (struct ad74413r_desc *, uint32_t, enum ad74413r_adc_sample)
 Set the ADC sample rate. More...
 
int ad74413r_get_adc_diag_rate (struct ad74413r_desc *, uint32_t, enum ad74413r_adc_sample *)
 Get the ADC sample rate for the diagnostics channels. More...
 
int ad74413r_set_adc_diag_rate (struct ad74413r_desc *, uint32_t, enum ad74413r_adc_sample)
 Set the ADC sample rate for the diagnostics channels. More...
 
int ad74413r_set_adc_conv_seq (struct ad74413r_desc *, enum ad74413r_conv_seq)
 Start or stop ADC conversions. More...
 
int ad74413r_get_adc_single (struct ad74413r_desc *, uint32_t, uint16_t *, bool)
 Get a single ADC raw value for a specific channel, then power down the ADC. More...
 
int ad74413r_adc_get_value (struct ad74413r_desc *, uint32_t, struct ad74413r_decimal *)
 Get the ADC real value, according to the operation mode. More...
 
int ad74413r_get_temp (struct ad74413r_desc *, uint32_t, uint16_t *)
 Read the die's temperature from the diagnostic register. More...
 
int ad74413r_set_channel_dac_code (struct ad74413r_desc *, uint32_t, uint16_t)
 Set and load a code for the DAC on a specific channel. More...
 
int ad74413r_set_diag (struct ad74413r_desc *, uint32_t, enum ad74413r_diag_mode)
 Set which diagnostic value to be loaded in the DIAG_RESULT register. More...
 
int ad74413r_get_diag (struct ad74413r_desc *, uint32_t, uint16_t *)
 Get the diagnostic value for a specific channel. More...
 
int ad74413r_set_debounce_mode (struct ad74413r_desc *, uint32_t, enum ad74413r_debounce_mode)
 Set the debounce mode for the IOx inputs when the ADC is running in digital input mode. More...
 
int ad74413r_set_debounce_time (struct ad74413r_desc *, uint32_t, uint32_t)
 Set the debounce settle time for the IOx inputs when the ADC is running in digital input mode. More...
 
int ad74413r_gpo_get (struct ad74413r_desc *, uint32_t, uint8_t *)
 Get the GPO value for a specific channel. More...
 
int ad74413r_set_gpo_config (struct ad74413r_desc *, uint32_t, enum ad74413r_gpo_select)
 Set the GPO operation mode. More...
 
int ad74413r_set_threshold (struct ad74413r_desc *, uint32_t, uint32_t)
 Set the threshold, for which a signal would be considered high, when the ADC is running in digital input mode. More...
 
int ad74413r_gpo_set (struct ad74413r_desc *, uint32_t, uint8_t)
 Set the logic value of a GPO pin. More...
 
int ad74413r_gpo_set_multiple (struct ad74413r_desc *, uint32_t)
 Set multiple GPO values at once. More...
 
int ad74413r_get_live (struct ad74413r_desc *, union ad74413r_live_status *)
 Read the live status bits. More...
 
int ad74413r_set_dac_clear_code (struct ad74413r_desc *, uint32_t, uint16_t)
 The code value will be loaded into the DACs when the CLR_EN bit in the OUTPUT_CONFIGx registers is asserted and the DAC clear key is written. More...
 
int ad74413r_clear_dac (struct ad74413r_desc *, uint32_t)
 Clear the DAC (to the code in DAC_CLR_CODE register) More...
 
int ad74413r_dac_slew_enable (struct ad74413r_desc *, uint32_t, enum ad74413r_slew_lin_step, enum ad74413r_lin_rate)
 Configure and enable slew rate control for a DAC on a specific channel. More...
 
int ad74413r_dac_slew_disable (struct ad74413r_desc *, uint32_t)
 Disable the slew rate control. More...
 
int ad74413r_set_therm_rst (struct ad74413r_desc *, bool)
 Enable or disable the higher thermal reset. More...
 
int ad74413r_init (struct ad74413r_desc **, struct ad74413r_init_param *)
 Initialize the device structure. More...
 
int ad74413r_remove (struct ad74413r_desc *desc)
 Free the device descriptor. More...
 

Detailed Description

Header file of AD74413r Driver.

Author
Ciprian Regus (cipri.nosp@m.an.r.nosp@m.egus@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2022(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ AD74413R_ADC_CODE_MAX

#define AD74413R_ADC_CODE_MAX   65536

◆ AD74413R_ADC_CONFIG

#define AD74413R_ADC_CONFIG (   x)    (0x05 + x)

◆ AD74413R_ADC_CONV_CTRL

#define AD74413R_ADC_CONV_CTRL   0x23

◆ AD74413R_ADC_MAX_VALUE

#define AD74413R_ADC_MAX_VALUE   65535

16 bit ADC

◆ AD74413R_ADC_RANGE_MASK

#define AD74413R_ADC_RANGE_MASK   NO_OS_GENMASK(7, 5)

◆ AD74413R_ADC_REJECTION_MASK

#define AD74413R_ADC_REJECTION_MASK   NO_OS_GENMASK(4, 3)

◆ AD74413R_ADC_RESOLUTION

#define AD74413R_ADC_RESOLUTION   16

◆ AD74413R_ADC_RESULT

#define AD74413R_ADC_RESULT (   x)    (0x26 + x)

◆ AD74413R_ALERT_MASK

#define AD74413R_ALERT_MASK   0x3C

◆ AD74413R_ALERT_STATUS

#define AD74413R_ALERT_STATUS   0x2E

◆ AD74413R_ALERT_STATUS_RESET

#define AD74413R_ALERT_STATUS_RESET   NO_OS_GENMASK(15, 0)

◆ AD74413R_CH_200K_TO_GND_MASK

#define AD74413R_CH_200K_TO_GND_MASK   NO_OS_BIT(2)

◆ AD74413R_CH_A

#define AD74413R_CH_A   0

◆ AD74413R_CH_B

#define AD74413R_CH_B   1

◆ AD74413R_CH_C

#define AD74413R_CH_C   2

◆ AD74413R_CH_D

#define AD74413R_CH_D   3

◆ AD74413R_CH_EN_MASK

#define AD74413R_CH_EN_MASK (   x)    NO_OS_BIT(x)

◆ AD74413R_CH_FUNC_SETUP

#define AD74413R_CH_FUNC_SETUP (   x)    (0x01 + x)

◆ AD74413R_CH_FUNC_SETUP_MASK

#define AD74413R_CH_FUNC_SETUP_MASK   NO_OS_GENMASK(3, 0)

◆ AD74413R_CLR_CODE_MASK

#define AD74413R_CLR_CODE_MASK   NO_OS_GENMASK(12, 0)

DAC_CLR_CODEx register

◆ AD74413R_CLR_EN_MASK

#define AD74413R_CLR_EN_MASK   NO_OS_BIT(1)

◆ AD74413R_CMD_KEY

#define AD74413R_CMD_KEY   0x44

◆ AD74413R_CMD_KEY_DAC_CLEAR

#define AD74413R_CMD_KEY_DAC_CLEAR   0x73D1

Command to load code into the DAC from DAC_CLR_CODEx

◆ AD74413R_CMD_KEY_LDAC

#define AD74413R_CMD_KEY_LDAC   0x953A

Command to load code into the DAC from DAC_CODEx

◆ AD74413R_CMD_KEY_RESET_1

#define AD74413R_CMD_KEY_RESET_1   0x15FA

Software reset sequence

◆ AD74413R_CMD_KEY_RESET_2

#define AD74413R_CMD_KEY_RESET_2   0xAF51

◆ AD74413R_COMP_THRESH_MASK

#define AD74413R_COMP_THRESH_MASK   NO_OS_GENMASK(5, 1)

DIN_THRESH

◆ AD74413R_CONV_SEQ_MASK

#define AD74413R_CONV_SEQ_MASK   NO_OS_GENMASK(9, 8)

◆ AD74413R_DAC_ACTIVE

#define AD74413R_DAC_ACTIVE (   x)    (0x1E + x)

◆ AD74413R_DAC_ACTIVE_CODE_MASK

#define AD74413R_DAC_ACTIVE_CODE_MASK   NO_OS_GENMASK(12, 0)

DAC_ACTIVEx register

◆ AD74413R_DAC_CLR_CODE

#define AD74413R_DAC_CLR_CODE (   x)    (0x1A + x)

◆ AD74413R_DAC_CODE

#define AD74413R_DAC_CODE (   x)    (0x16 + x)

◆ AD74413R_DAC_CODE_MASK

#define AD74413R_DAC_CODE_MASK   NO_OS_GENMASK(12, 0)

DAC_CODEx register

◆ AD74413R_DAC_CODE_MAX

#define AD74413R_DAC_CODE_MAX   8191

◆ AD74413R_DAC_RANGE

#define AD74413R_DAC_RANGE   11000

The maximum voltage output of the DAC is 11V

◆ AD74413R_DAC_RESOLUTION

#define AD74413R_DAC_RESOLUTION   13

13 bit DAC

◆ AD74413R_DEBOUNCE_MODE_MASK

#define AD74413R_DEBOUNCE_MODE_MASK   NO_OS_BIT(5)

◆ AD74413R_DEBOUNCE_TIME_MASK

#define AD74413R_DEBOUNCE_TIME_MASK   NO_OS_GENMASK(4, 0)

◆ AD74413R_DIAG_ASSIGN

#define AD74413R_DIAG_ASSIGN   0x24

◆ AD74413R_DIAG_ASSIGN_MASK

#define AD74413R_DIAG_ASSIGN_MASK (   x)    (NO_OS_GENMASK(3, 0) << (x * 4))

DIAG_ASSIGN register

◆ AD74413R_DIAG_EN_MASK

#define AD74413R_DIAG_EN_MASK (   x)    (NO_OS_BIT(x) << 4)

◆ AD74413R_DIAG_RESULT

#define AD74413R_DIAG_RESULT (   x)    (0x2A + x)

◆ AD74413R_DIAG_RESULT_MASK

#define AD74413R_DIAG_RESULT_MASK   NO_OS_GENMASK(15, 0)

◆ AD74413R_DIN_COMP_CH

#define AD74413R_DIN_COMP_CH (   x)    NO_OS_BIT(x)

DIN_COMP_OUT register

◆ AD74413R_DIN_COMP_OUT

#define AD74413R_DIN_COMP_OUT   0x25

◆ AD74413R_DIN_CONFIG

#define AD74413R_DIN_CONFIG (   x)    (0x09 + x)

◆ AD74413R_DIN_COUNTER

#define AD74413R_DIN_COUNTER (   x)    (0x3D + x)

◆ AD74413R_DIN_THRESH

#define AD74413R_DIN_THRESH   0x22

◆ AD74413R_DIN_THRESH_MODE_MASK

#define AD74413R_DIN_THRESH_MODE_MASK   NO_OS_BIT(0)

◆ AD74413R_EN_REJ_DIAG_MASK

#define AD74413R_EN_REJ_DIAG_MASK   NO_OS_BIT(10)

ADC_CONV_CTRL register

◆ AD74413R_ERR_CLR_MASK

#define AD74413R_ERR_CLR_MASK   NO_OS_GENMASK(15, 0)

◆ AD74413R_GPO_CONFIG

#define AD74413R_GPO_CONFIG (   x)    (0x0E + x)

◆ AD74413R_GPO_DATA_MASK

#define AD74413R_GPO_DATA_MASK   NO_OS_BIT(3)

◆ AD74413R_GPO_PAR_DATA_MASK

#define AD74413R_GPO_PAR_DATA_MASK (   x)    NO_OS_BIT(x)

GPO_PARALLEL register

◆ AD74413R_GPO_PARALLEL

#define AD74413R_GPO_PARALLEL   0x0D

◆ AD74413R_GPO_SELECT_MASK

#define AD74413R_GPO_SELECT_MASK   NO_OS_GENMASK(2, 0)

GPO_CONFIGx register

◆ AD74413R_I_LIMIT_MASK

#define AD74413R_I_LIMIT_MASK   NO_OS_BIT(0)

◆ AD74413R_LIVE_STATUS

#define AD74413R_LIVE_STATUS   0x2F

◆ AD74413R_N_CHANNELS

#define AD74413R_N_CHANNELS   4

◆ AD74413R_N_DIAG_CHANNELS

#define AD74413R_N_DIAG_CHANNELS   4

◆ AD74413R_NOP

#define AD74413R_NOP   0x00

Register map

◆ AD74413R_OUTPUT_CONFIG

#define AD74413R_OUTPUT_CONFIG (   x)    (0x12 + x)

◆ AD74413R_RANGE_10V_SCALE

#define AD74413R_RANGE_10V_SCALE   15259ULL

◆ AD74413R_RANGE_10V_SCALE_DIV

#define AD74413R_RANGE_10V_SCALE_DIV   100000ULL

◆ AD74413R_RANGE_2V5_SCALE

#define AD74413R_RANGE_2V5_SCALE   38147ULL

◆ AD74413R_RANGE_2V5_SCALE_DIV

#define AD74413R_RANGE_2V5_SCALE_DIV   1000000ULL

◆ AD74413R_RANGE_5V_OFFSET

#define AD74413R_RANGE_5V_OFFSET   -(AD74413R_ADC_MAX_VALUE / 2)

◆ AD74413R_RANGE_5V_SCALE

#define AD74413R_RANGE_5V_SCALE   76294ULL

◆ AD74413R_RANGE_5V_SCALE_DIV

#define AD74413R_RANGE_5V_SCALE_DIV   1000000ULL

◆ AD74413R_READ_SELECT

#define AD74413R_READ_SELECT   0x41

◆ AD74413R_REV_ID

#define AD74413R_REV_ID   NO_OS_GENMASK(7, 0)

◆ AD74413R_RSENSE

#define AD74413R_RSENSE   100

The value of the sense resistor in ohms

◆ AD74413R_RTD_PULL_UP

#define AD74413R_RTD_PULL_UP   2100000ULL

◆ AD74413R_SCRATCH

#define AD74413R_SCRATCH   0x45

◆ AD74413R_SENSE_RESISTOR_OHMS

#define AD74413R_SENSE_RESISTOR_OHMS   100

◆ AD74413R_SILICON_REV

#define AD74413R_SILICON_REV   0x46

◆ AD74413R_SLEW_EN_MASK

#define AD74413R_SLEW_EN_MASK   NO_OS_GENMASK(7, 6)

OUTPUT_CONFIGx register

◆ AD74413R_SLEW_LIN_RATE_MASK

#define AD74413R_SLEW_LIN_RATE_MASK   NO_OS_GENMASK(3, 2)

◆ AD74413R_SLEW_LIN_STEP_MASK

#define AD74413R_SLEW_LIN_STEP_MASK   NO_OS_GENMASK(5, 4)

◆ AD74413R_SPI_CRC_ERR_MASK

#define AD74413R_SPI_CRC_ERR_MASK   NO_OS_BIT(13)

◆ AD74413R_SPI_RD_RET_INFO_MASK

#define AD74413R_SPI_RD_RET_INFO_MASK   NO_OS_BIT(8)

◆ AD74413R_TEMP_OFFSET

#define AD74413R_TEMP_OFFSET   -2392

◆ AD74413R_TEMP_SCALE

#define AD74413R_TEMP_SCALE   8950

◆ AD74413R_TEMP_SCALE_DIV

#define AD74413R_TEMP_SCALE_DIV   1000

◆ AD74413R_THERM_RST

#define AD74413R_THERM_RST   0x43

◆ AD74413R_THRESHOLD_DAC_RANGE

#define AD74413R_THRESHOLD_DAC_RANGE   29

The number of possible DAC values

◆ AD74413R_THRESHOLD_RANGE

#define AD74413R_THRESHOLD_RANGE   16000

The comparator's value can be set betwen 0 - 16 V

Enumeration Type Documentation

◆ ad74413r_adc_range

ADC ranges configurations. These are dependent on the operation mode.

Enumerator
AD74413R_ADC_RANGE_10V 
AD74413R_ADC_RANGE_2P5V_EXT_POW 
AD74413R_ADC_RANGE_2P5V_INT_POW 
AD74413R_ADC_RANGE_5V_BI_DIR 

◆ ad74413r_adc_sample

Enumerator
AD74413R_ADC_SAMPLE_20HZ 
AD74413R_ADC_SAMPLE_4800HZ 
AD74413R_ADC_SAMPLE_10HZ 
AD74413R_ADC_SAMPLE_1200HZ 

◆ ad74413r_chip_id

The chips supported by this driver.

Enumerator
AD74413R 
AD74412R 

◆ ad74413r_conv_seq

ADC conversion sequence commands.

Enumerator
AD74413R_STOP_PWR_UP 
AD74413R_START_SINGLE 
AD74413R_START_CONT 
AD74413R_STOP_PWR_DOWN 

◆ ad74413r_debounce_mode

Debounce modes for the IOx inputs when using the digital input op mode.

Enumerator
AD74413R_DEBOUNCE_MODE_0 
AD74413R_DEBOUNCE_MODE_1 

◆ ad74413r_diag_mode

Possible values to be loaded in the DIAG_RESULT register.

Enumerator
AD74413R_DIAG_AGND 
AD74413R_DIAG_TEMP 
AD74413R_DIAG_AVDD 
AD74413R_DIAG_AVSS 
AD74413R_DIAG_REFOUT 
AD74413R_DIAG_ALDO_5V 
AD74413R_DIAG_ALDO_1V8 
AD74413R_DIAG_DLDO_1V8 
AD74413R_DIAG_DVCC 
AD74413R_DIAG_IOVDD 
AD74413R_SENSEL_A 
AD74413R_SENSEL_B 
AD74413R_SENSEL_C 
AD74413R_SENSEL_D 

◆ ad74413r_gpo_select

GPO operation modes.

Enumerator
AD74413R_GPO_CONFIG_100K_PD 
AD74413R_GPO_CONFIG_DATA 
AD74413R_GPO_CONFIG_PAR_DATA 
AD74413R_GPO_CONFIG_COMP 
AD74413R_GPO_CONFIG_HIGH_Z 

◆ ad74413r_lin_rate

Possible update rates for a DAC when slew control is enabled.

Enumerator
AD74413R_LIN_RATE_4KHZ 
AD74413R_LIN_RATE_64KHZ 
AD74413R_LIN_RATE_150KHZ 
AD74413R_LIN_RATE_240KHZ 

◆ ad74413r_op_mode

Operation modes of the device.

Enumerator
AD74413R_HIGH_Z 
AD74413R_VOLTAGE_OUT 
AD74413R_CURRENT_OUT 
AD74413R_VOLTAGE_IN 
AD74413R_CURRENT_IN_EXT 
AD74413R_CURRENT_IN_LOOP 
AD74413R_RESISTANCE 
AD74413R_DIGITAL_INPUT 
AD74413R_DIGITAL_INPUT_LOOP 
AD74413R_CURRENT_IN_EXT_HART 
AD74413R_CURRENT_IN_LOOP_HART 

◆ ad74413r_rejection

Rejection config values. The HART variants are not supported by the AD74412R device.

Enumerator
AD74413R_REJECTION_50_60 
AD74413R_REJECTION_NONE 
AD74413R_REJECTION_50_60_HART 
AD74413R_REJECTION_HART 

◆ ad74413r_slew_lin_step

The number of increments per step a DAC does when slew control is enabled.

Enumerator
AD74413R_STEP_64 
AD74413R_STEP_120 
AD74413R_STEP_500 
AD74413R_STEP_1820 

Function Documentation

◆ ad74413r_adc_get_value()

int ad74413r_adc_get_value ( struct ad74413r_desc desc,
uint32_t  ch,
struct ad74413r_decimal val 
)

Get the ADC real value, according to the operation mode.

Get the ADC real value, according to the operation mode

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC real measurement value (the unit depends on the operation mode).
Returns
0 in case of success, negative error code otherwise.

I_Rsense = (Vmin + (ADC_CODE/65535) * range) / Rsense

Here is the caller graph for this function:

◆ ad74413r_clear_dac()

int ad74413r_clear_dac ( struct ad74413r_desc desc,
uint32_t  ch 
)

Clear the DAC (to the code in DAC_CLR_CODE register)

Clear the DAC (to the code in DAC_CLR_CODE register)

Parameters
desc- The device structure.
ch- The channel index.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_clear_errors()

int ad74413r_clear_errors ( struct ad74413r_desc desc)

Clear the ALERT_STATUS register.

Clear the ALERT_STATUS register

Parameters
desc- The device structure.
Returns
0 in case of success, negative error otherwise.
Here is the caller graph for this function:

◆ ad74413r_dac_slew_disable()

int ad74413r_dac_slew_disable ( struct ad74413r_desc desc,
uint32_t  ch 
)

Disable the slew rate control.

Disable the slew rate control

Parameters
desc- The device structure.
ch- The channel index.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_dac_slew_enable()

int ad74413r_dac_slew_enable ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_slew_lin_step  step,
enum ad74413r_lin_rate  rate 
)

Configure and enable slew rate control for a DAC on a specific channel.

Configure and enable slew rate control for a DAC on a specific channel

Parameters
desc- The device structure.
ch- The channel index.
step- Number of codes per increment.
rate- Number of increments per second.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_dac_voltage_to_code()

int ad74413r_dac_voltage_to_code ( uint32_t  mvolts,
uint32_t *  code 
)

Converts a millivolt value in the corresponding DAC 13 bit code.

Converts a millivolt value in the corresponding DAC 13 bit code

Parameters
mvolts- The millivolts value.
code- The resulting DAC code.
Returns
0 in case of success, -EINVAL otherwise
Here is the caller graph for this function:

◆ ad74413r_get_adc_diag_rate()

int ad74413r_get_adc_diag_rate ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_adc_sample val 
)

Get the ADC sample rate for the diagnostics channels.

Get the ADC sample rate for the diagnostics channels.

Parameters
desc- The device structure.
ch- The diagnostics channel index.
val- The ADC sample rate value.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_get_adc_diag_rejection()

int ad74413r_get_adc_diag_rejection ( struct ad74413r_desc desc,
enum ad74413r_rejection val 
)

Get the rejection setting for a specific channel.

Get the rejection setting for any diagnostics channel

Parameters
desc- The device structure.
val- The ADC rejection setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_get_adc_range()

int ad74413r_get_adc_range ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t *  val 
)

Get the ADC measurement range for a specific channel.

Get the ADC measurement range for a specific channel

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC range value.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_get_adc_rate()

int ad74413r_get_adc_rate ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_adc_sample val 
)

Get the ADC sample rate.

Get the ADC sample rate.

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC sample rate value.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_get_adc_rejection()

int ad74413r_get_adc_rejection ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_rejection val 
)

Get the rejection setting for a specific channel.

Get the rejection setting for a specific channel

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC rejection setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_get_adc_single()

int ad74413r_get_adc_single ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t *  val,
bool  is_diag 
)

Get a single ADC raw value for a specific channel, then power down the ADC.

Get a single ADC raw value for a specific channel, then power down the ADC

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC raw result.
is_diag- Select which channel type does the index refer to (I/O or diagnostics).
Returns
0 in case of success, negative error code otherwise.

Wait for all channels to complete the conversion.

Here is the caller graph for this function:

◆ ad74413r_get_diag()

int ad74413r_get_diag ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t *  diag_code 
)

Get the diagnostic value for a specific channel.

Get the diagnostic value for a specific channel

Parameters
desc- The device structure.
ch- The channel index.
diag_code- The diagnostic setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_get_live()

int ad74413r_get_live ( struct ad74413r_desc desc,
union ad74413r_live_status status 
)

Read the live status bits.

Read the live status bits

Parameters
desc- The device structure.
status- The register's value.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_get_raw_adc_result()

int ad74413r_get_raw_adc_result ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t *  val 
)

Read the raw ADC raw conversion value.

Read the raw ADC raw conversion value

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC raw conversion value.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_get_temp()

int ad74413r_get_temp ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t *  temp 
)

Read the die's temperature from the diagnostic register.

Read the die's temperature from the diagnostic register

Parameters
desc- The device structure.
ch- The diagnostic channel on which the temperature reading is assigned and enabled.
temp- The measured temperature (in degrees Celsius).
Returns
0 in case of success, -EINVAL otherwise.
Here is the caller graph for this function:

◆ ad74413r_gpo_get()

int ad74413r_gpo_get ( struct ad74413r_desc desc,
uint32_t  ch,
uint8_t *  val 
)

Get the GPO value for a specific channel.

Get the GPO value for a specific channel

Parameters
desc- The device structure.
ch- The channel index.
val- The debounce time.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_gpo_set()

int ad74413r_gpo_set ( struct ad74413r_desc desc,
uint32_t  ch,
uint8_t  val 
)

Set the logic value of a GPO pin.

Set the logic value of a GPO pin

Parameters
desc- The device structure.
ch- The channel index.
val- The output logic state.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_gpo_set_multiple()

int ad74413r_gpo_set_multiple ( struct ad74413r_desc desc,
uint32_t  mask 
)

Set multiple GPO values at once.

Set multiple GPO values at once

Parameters
desc- The device structure.
mask- Active channels mask.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_init()

int ad74413r_init ( struct ad74413r_desc **  desc,
struct ad74413r_init_param init_param 
)

Initialize the device structure.

Initialize the device structure

Parameters
desc- The device structure to be initialized.
init_param- Initialization parameter for the device descriptor.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_nb_active_channels()

int ad74413r_nb_active_channels ( struct ad74413r_desc desc,
uint8_t *  nb_channels 
)

Get the number of active channels.

Get the number of active channels

Parameters
desc- The device structure.
nb_channels- The number of active channels
Returns
0 in case of success, negative error otherwise.
Here is the caller graph for this function:

◆ ad74413r_range_to_voltage_offset()

int ad74413r_range_to_voltage_offset ( enum ad74413r_adc_range  range,
int32_t *  val 
)

Convert the measuring range of the ADC from range enum values to millivolts.

Parameters
range- ADC sample rate
val- Rejection register value
Returns
0 in case of success, -EINVAL otherwise

◆ ad74413r_range_to_voltage_range()

int ad74413r_range_to_voltage_range ( enum ad74413r_adc_range  range,
uint32_t *  val 
)

Convert the measuring range of the ADC from range enum values to millivolts.

Convert a voltage range from an enum representation to a millivolt value

Parameters
range- ADC sample rate
val- Rejection register value
Returns
0 in case of success, -EINVAL otherwise

◆ ad74413r_reg_read()

int ad74413r_reg_read ( struct ad74413r_desc desc,
uint32_t  addr,
uint16_t *  val 
)

Read a register's value.

Read a register's value

Parameters
desc- The device structure.
addr- The register's address.
val- The register's read value.
Returns
0 in case of success, negative error otherwise
Here is the caller graph for this function:

◆ ad74413r_reg_read_raw()

int ad74413r_reg_read_raw ( struct ad74413r_desc desc,
uint32_t  addr,
uint8_t *  val 
)

Read a raw communication frame.

Read a raw communication frame

Parameters
desc- The device structure.
addr- The register's address.
val- A raw comm frame.
Returns
0 in case of success, negative error otherwise.

Reading a register on AD74413r requires writing the address to the READ_SELECT register first and then doing another spi read, which will contain the requested register value.

Here is the caller graph for this function:

◆ ad74413r_reg_update()

int ad74413r_reg_update ( struct ad74413r_desc desc,
uint32_t  addr,
uint16_t  mask,
uint16_t  val 
)

Update a register's field.

Update a register's field

Parameters
desc- The device structure.
addr- The register's address.
val- The register's value.
mask- The mask for a specific register field.
Returns
0 in case of success, negative error otherwise.
Here is the caller graph for this function:

◆ ad74413r_reg_write()

int ad74413r_reg_write ( struct ad74413r_desc desc,
uint32_t  addr,
uint16_t  val 
)

Write a register's value.

Write a register's value

Parameters
desc- The device structure.
addr- The register's address.
val- The register's value.
Returns
0 in case of success, negative error otherwise
Here is the caller graph for this function:

◆ ad74413r_remove()

int ad74413r_remove ( struct ad74413r_desc desc)

Free the device descriptor.

Free the device descriptor

Parameters
desc- The device structure.
Returns
0 in case of success, -EINVAL otherwise.
Here is the caller graph for this function:

◆ ad74413r_reset()

int ad74413r_reset ( struct ad74413r_desc desc)

Perform either a software or hardware reset and wait for device reset time.

Perform either a software or hardware reset and wait for device reset time.

Parameters
desc- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_adc_channel_enable()

int ad74413r_set_adc_channel_enable ( struct ad74413r_desc desc,
uint32_t  ch,
bool  status 
)

Enable/disable a specific ADC channel.

Enable/disable a specific ADC channel

Parameters
desc- The device structure.
ch- The channel index.
status- Enabled or disabled status.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_adc_conv_seq()

int ad74413r_set_adc_conv_seq ( struct ad74413r_desc desc,
enum ad74413r_conv_seq  status 
)

Start or stop ADC conversions.

Start or stop ADC conversions

Parameters
desc- The device structure.
status- The ADC conversion sequence.
Returns
0 in case of success, negative error code otherwise.

The write to CONV_SEQ powers up the ADC. If the ADC was powered down, the user must wait for 100us before the ADC starts doing conversions.

Here is the caller graph for this function:

◆ ad74413r_set_adc_diag_rate()

int ad74413r_set_adc_diag_rate ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_adc_sample  val 
)

Set the ADC sample rate for the diagnostics channels.

Set the ADC sample rate for the diagnostics channels.

Parameters
desc- The device structure.
ch- The diagnostics channel index.
val- The ADC sample rate value.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_adc_rate()

int ad74413r_set_adc_rate ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_adc_sample  val 
)

Set the ADC sample rate.

Set the ADC sample rate.

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC sample rate value.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_adc_rejection()

int ad74413r_set_adc_rejection ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_rejection  val 
)

Set the rejection setting for a specific channel.

Set the rejection setting for a specific channel

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC rejection setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_channel_dac_code()

int ad74413r_set_channel_dac_code ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t  dac_code 
)

Set and load a code for the DAC on a specific channel.

Set and load a code for the DAC on a specific channel

Parameters
desc- The device structure.
ch- The channel index.
dac_code- The code for the DAC.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_channel_function()

int ad74413r_set_channel_function ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_op_mode  ch_func 
)

Set the operation mode for a specific channel.

Set the operation mode for a specific channel

Parameters
desc- The device structure.
ch- The channel index.
ch_func- The operation mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_dac_clear_code()

int ad74413r_set_dac_clear_code ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t  code 
)

The code value will be loaded into the DACs when the CLR_EN bit in the OUTPUT_CONFIGx registers is asserted and the DAC clear key is written.

The code value will be loaded into the DACs when the CLR_EN bit in the OUTPUT_CONFIGx registers is asserted and the DAC clear key is written

Parameters
desc- The device structure.
ch- The channel index.
code- The DAC code to be loaded
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_set_debounce_mode()

int ad74413r_set_debounce_mode ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_debounce_mode  mode 
)

Set the debounce mode for the IOx inputs when the ADC is running in digital input mode.

Set the debounce mode for the IOx inputs when the ADC is running in digital input mode.

Parameters
desc- The device structure.
ch- The channel index.
mode- The debounce mode.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_set_debounce_time()

int ad74413r_set_debounce_time ( struct ad74413r_desc desc,
uint32_t  ch,
uint32_t  time 
)

Set the debounce settle time for the IOx inputs when the ADC is running in digital input mode.

Set the debounce settle time for the IOx inputs when the ADC is running in digital input mode

Parameters
desc- The device structure.
ch- The channel index.
time- The debounce time.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_set_diag()

int ad74413r_set_diag ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_diag_mode  diag_code 
)

Set which diagnostic value to be loaded in the DIAG_RESULT register.

Set which diagnostic value to be loaded in the DIAG_RESULT register

Parameters
desc- The device structure.
ch- The channel index.
diag_code- The diagnostic setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_diag_channel_enable()

int ad74413r_set_diag_channel_enable ( struct ad74413r_desc desc,
uint32_t  ch,
bool  status 
)

Enable conversions on a diagnostic register.

Enable conversions on a diagnostic register

Parameters
desc- The device structure.
ch- Diagnostic channel index.
status- Enabled or disabled status.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_gpo_config()

int ad74413r_set_gpo_config ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_gpo_select  config 
)

Set the GPO operation mode.

Set the GPO operation mode

Parameters
desc- The device structure.
ch- The channel index.
config- The configuration setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_info()

int ad74413r_set_info ( struct ad74413r_desc desc,
uint16_t  mode 
)

Select which information the device will respond with (in the readback field) when a read operation is performed.

Select which information the device will respond with (in the readback field) when a read operation is performed

Parameters
desc- The device structure.
mode- Possible values: 0 - Respond with the readback address. 1 - Respond with status bits.
Returns
0 in case of success, negative error otherwise.

◆ ad74413r_set_therm_rst()

int ad74413r_set_therm_rst ( struct ad74413r_desc desc,
bool  enable 
)

Enable or disable the higher thermal reset.

Enable or disable the higher thermal reset

Parameters
desc- The device structure.
enable- The thermal reset status. false: reset at 110 deg. Celsius. true: reset at 140 deg. Celsius.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_set_threshold()

int ad74413r_set_threshold ( struct ad74413r_desc desc,
uint32_t  ch,
uint32_t  threshold 
)

Set the threshold, for which a signal would be considered high, when the ADC is running in digital input mode.

Set the threshold, for which a signal would be considered high, when the ADC is running in digital input mode

Parameters
desc- The device structure.
ch- The channel index.
threshold- The threshold value (in millivolts). The actual threshold set might not match this value (~500mV max. error), since it's fairly low resolution (29 possible values).
Returns
0 in case of success, negative error code otherwise.

Set a fixed range (0 - 16 V) for the threshold, so it would not depend on Vadd.

Here is the caller graph for this function: