Header file of AD74416h Driver. More...
Go to the source code of this file.
Classes | |
struct | _ad74416h_live_status |
Bitfield struct which maps on the LIVE_STATUS register. More... | |
union | ad74416h_live_status |
Used to store the live status bit fields. More... | |
struct | ad74416h_init_param |
struct | ad74416h_channel_config |
Device channel state. More... | |
struct | ad74416h_desc |
AD74416h device descriptor. More... | |
Functions | |
int | ad74416h_dac_voltage_to_code (struct ad74416h_desc *, int32_t, uint16_t *, uint32_t) |
Converts a millivolt value in the corresponding DAC 16 bit code. | |
int | ad74416h_dac_current_to_code (struct ad74416h_desc *, uint32_t, uint16_t *) |
Convers a microamp value in the corresponding DAC 16 bit code. | |
int | ad74416h_reg_write (struct ad74416h_desc *, uint32_t, uint16_t) |
Write a register's value. | |
int | ad74416h_reg_read_raw (struct ad74416h_desc *, uint32_t, uint8_t *) |
Read a raw communication frame. | |
int | ad74416h_reg_read (struct ad74416h_desc *, uint32_t, uint16_t *) |
Read a register's value. | |
int | ad74416h_reg_update (struct ad74416h_desc *, uint32_t, uint16_t, uint16_t) |
Update a register's field. | |
int | ad74416h_nb_active_channels (struct ad74416h_desc *, uint8_t *) |
Get the number of active channels. | |
int | ad74416h_set_info (struct ad74416h_desc *desc, uint16_t mode) |
int | ad74416h_set_channel_function (struct ad74416h_desc *, uint32_t, enum ad74416h_op_mode) |
Set the operation mode for a specific channel. | |
int | ad74416h_set_channel_vout_range (struct ad74416h_desc *desc, uint32_t ch, enum ad74416h_vout_range vout_range) |
Set the voltage range for a specific channel. | |
int | ad74416h_set_channel_i_limit (struct ad74416h_desc *, uint32_t, enum ad74416h_i_limit) |
Set the current limit for a specific DAC channel in vout mode. | |
int | ad74416h_get_raw_adc_result (struct ad74416h_desc *, uint32_t, uint32_t *) |
Read the raw ADC raw conversion value. | |
int | ad74416h_set_adc_channel_enable (struct ad74416h_desc *, uint32_t, bool) |
Enable/disable a specific ADC channel. | |
int | ad74416h_set_diag_channel_enable (struct ad74416h_desc *, uint32_t, bool) |
Enable conversions on a diagnostic register. | |
int | ad74416h_get_adc_range (struct ad74416h_desc *, uint32_t, uint16_t *) |
Get the ADC measurement range for a specific channel. | |
int | ad74416h_set_adc_range (struct ad74416h_desc *, uint32_t, enum ad74416h_adc_range) |
Set the ADC measurement range for a specific channel. | |
int | ad74416h_get_adc_rate (struct ad74416h_desc *, uint32_t, enum ad74416h_adc_rate *) |
Get the ADC Conversion Rate for a specific channel. | |
int | ad74416h_set_adc_rate (struct ad74416h_desc *, uint32_t, enum ad74416h_adc_rate) |
Set the ADC Conversion Rate for a specific channel. | |
int | ad74416h_get_adc_conv_mux (struct ad74416h_desc *, uint32_t, enum ad74416h_adc_conv_mux *) |
Get the ADC Input Node for conversion. | |
int | ad74416h_set_adc_conv_mux (struct ad74416h_desc *, uint32_t, enum ad74416h_adc_conv_mux) |
Set the ADC Input Node for conversion. | |
int | ad74416h_set_adc_conv_seq (struct ad74416h_desc *, enum ad74416h_conv_seq) |
Start or stop ADC conversions. | |
int | ad74416h_get_adc_single (struct ad74416h_desc *, uint32_t, uint16_t *) |
Get a single ADC raw value for a specific channel, then power down the ADC. | |
int | ad74416h_get_temp (struct ad74416h_desc *, uint32_t, uint16_t *) |
Read the die's temperature from the diagnostic register. | |
int | ad74416h_set_channel_dac_code (struct ad74416h_desc *, uint32_t, uint16_t) |
Set and load a code for the DAC on a specific channel. | |
int | ad74416h_set_diag (struct ad74416h_desc *, uint32_t, enum ad74416h_diag_mode) |
Set which diagnostic value to be loaded in the DIAG_RESULT register. | |
int | ad74416h_get_diag (struct ad74416h_desc *, uint32_t, uint16_t *) |
Get the diagnostic value for a specific channel. | |
int | ad74416h_set_debounce_mode (struct ad74416h_desc *, uint32_t, enum ad74416h_debounce_mode) |
Set the debounce mode for the IOx inputs when the ADC is running in digital input mode. | |
int | ad74416h_set_debounce_time (struct ad74416h_desc *, uint32_t, uint32_t) |
Set the debounce settle time for the IOx inputs when the ADC is running in digital input mode. | |
int | ad74416h_gpio_get (struct ad74416h_desc *, uint32_t, uint8_t *) |
Get the GPO value for a specific channel. | |
int | ad74416h_set_gpio_config (struct ad74416h_desc *, uint32_t, enum ad74416h_gpio_select) |
Set the GPIO operation mode. | |
int | ad74416h_set_threshold (struct ad74416h_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. | |
int | ad74416h_do_set (struct ad74416h_desc *, uint32_t, uint8_t) |
Set the DO value of a channel. | |
int | ad74416h_gpio_set (struct ad74416h_desc *, uint32_t, uint8_t) |
Set the logic value of a GPO pin. | |
int | ad74416h_get_live (struct ad74416h_desc *, union ad74416h_live_status *) |
Read the live status bits. | |
int | ad74416h_dac_slew_enable (struct ad74416h_desc *, uint32_t, enum ad74416h_slew_lin_step, enum ad74416h_lin_rate) |
Configure and enable slew rate control for a DAC on a specific channel. | |
int | ad74416h_dac_slew_disable (struct ad74416h_desc *, uint32_t) |
Disable the slew rate control. | |
int | ad74416h_set_therm_rst (struct ad74416h_desc *, bool) |
Enable or disable the higher thermal reset. | |
int | ad74416h_reset (struct ad74416h_desc *) |
Perform software or hardware reset and wait for device reset time. | |
int | ad74416h_init (struct ad74416h_desc **, struct ad74416h_init_param *) |
Initialize the device structure. | |
int | ad74416h_remove (struct ad74416h_desc *desc) |
Free the device descriptor. | |
Header file of AD74416h Driver.
Copyright 2023(c) Analog Devices, Inc.
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, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 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.
#define AD74116H_CONV_TIME_US 1000000 |
#define AD74414H_DAC_RESOLUTION 14 |
#define AD74416H_ADC_BUSY_MSK NO_OS_BIT(1) |
#define AD74416H_ADC_CONFIG | ( | x | ) |
#define AD74416H_ADC_CONV_CTRL 0x39 |
#define AD74416H_ADC_CONV_RANGE_MSK NO_OS_GENMASK(6, 4) |
#define AD74416H_ADC_CONV_RATE_MSK NO_OS_GENMASK(11, 8) |
#define AD74416H_ADC_DATA_RDY_MSK NO_OS_BIT(2) |
#define AD74416H_ADC_DIAG_RESULT | ( | x | ) |
#define AD74416H_ADC_ERR_MSK NO_OS_BIT(5) |
#define AD74416H_ADC_MAX_VALUE 16777215 |
16 bit ADC
#define AD74416H_ADC_RDY_CTRL_MSK NO_OS_BIT(13) |
ADC_CONV_CTRL Register
#define AD74416H_ADC_RESULT | ( | x | ) |
#define AD74416H_ADC_RESULT_UPR | ( | x | ) |
#define AD74416H_ALARM_DEG_PERIOD_MSK NO_OS_BIT(12) |
#define AD74416H_ALERT_MASK 0x5C |
#define AD74416H_ALERT_STATUS 0x3F |
#define AD74416H_ANALOG_IO_OC_MSK NO_OS_BIT(5) |
#define AD74416H_ANALOG_IO_SC_MSK NO_OS_BIT(4) |
#define AD74416H_ANALOG_IO_STATUS_A_MSK NO_OS_BIT(12) |
#define AD74416H_ANALOG_IO_STATUS_B_MSK NO_OS_BIT(13) |
#define AD74416H_ANALOG_IO_STATUS_C_MSK NO_OS_BIT(14) |
#define AD74416H_ANALOG_IO_STATUS_D_MSK NO_OS_BIT(15) |
LIVE_STATUS Register
#define AD74416H_AUTO_CLR_RST_MSK NO_OS_BIT(4) |
#define AD74416H_AVCC_ERR_MSK NO_OS_BIT(3) |
#define AD74416H_AVDD_HI_ERR_MSK NO_OS_BIT(6) |
#define AD74416H_AVDD_LO_ERR_MSK NO_OS_BIT(5) |
#define AD74416H_AVDD_SELECT_MSK NO_OS_GENMASK(15, 14) |
OUTPUT_CONFIGx Register
#define AD74416H_AVSS_ERR_MSK NO_OS_BIT(1) |
#define AD74416H_BORADCAST_CMD_KEY 0x75 |
#define AD74416H_BRN_SEN_VSENSEN_CURR_MSK NO_OS_GENMASK(6, 5) |
I_BURNOUT_CONFIG Register
#define AD74416H_BRN_SEN_VSENSEN_POL_MSK NO_OS_BIT(4) |
#define AD74416H_BRN_VIOUT_CURR_MSK NO_OS_GENAMSK(2, 1) |
#define AD74416H_BRN_VIOUT_POL_MSK NO_OS_BIT(0) |
#define AD74416H_BROADCAST_CMD_KEY_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_BURST_READ_SEL 0x6F |
#define AD74416H_BURST_READ_SEL_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_CAL_MEM_ERR_MSK NO_OS_BIT(0) |
#define AD74416H_CD_EDGE_DET_MSK NO_OS_BIT(7) |
#define AD74416H_CD_EDGE_SEL_MSK NO_OS_GENAMSK(3, 2) |
#define AD74416H_CD_EXTD_QUAL_MSK NO_OS_BIT(13) |
#define AD74416H_CD_MSK NO_OS_BIT(8) |
#define AD74416H_CH_A 0 |
#define AD74416H_CH_B 1 |
#define AD74416H_CH_C 2 |
#define AD74416H_CH_D 3 |
#define AD74416H_CH_EN_MSK | ( | x | ) |
#define AD74416H_CH_FUNC_SETUP | ( | x | ) |
#define AD74416H_CH_FUNC_SETUP_MSK NO_OS_GENMASK(3, 0) |
#define AD74416H_CHANNEL_ALERT_A_MSK NO_OS_BIT(8) |
#define AD74416H_CHANNEL_ALERT_B_MSK NO_OS_BIT(9) |
#define AD74416H_CHANNEL_ALERT_C_MSK NO_OS_BIT(10) |
#define AD74416H_CHANNEL_ALERT_D_MSK NO_OS_BIT(11) |
#define AD74416H_CHANNEL_ALERT_MASK | ( | x | ) |
#define AD74416H_CHANNEL_ALERT_STATUS | ( | x | ) |
#define AD74416H_CMD_KEY 0x74 |
#define AD74416H_CMD_KEY_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_CMD_KEY_RESET_1 0x15FA |
Software reset sequence
#define AD74416H_CMD_KEY_RESET_2 0xAF51 |
#define AD74416H_COMP_THRESH_MSK NO_OS_GENMASK(6, 0) |
#define AD74416H_COMPARATOR_EN_MSK NO_OS_BIT(13) |
#define AD74416H_CONV_MUX_MSK NO_OS_GENMASK(2, 0) |
#define AD74416H_CONV_RATE_DIAG_MSK NO_OS_GENMASK(12, 10) |
#define AD74416H_CONV_RES_MUX_MSK NO_OS_GENMASK(15, 13) |
#define AD74416H_CONV_RES_RANGE_MSK NO_OS_GENMASK(12, 10) |
#define AD74416H_CONV_RES_UPR_MSK NO_OS_GENMASK(7, 0) |
#define AD74416H_CONV_RESULT_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_CONV_SEQ_COUNT_MSK NO_OS_GENAMSK(9. 8) |
#define AD74416H_CONV_SEQ_MSK NO_OS_GENMASK(9, 8) |
#define AD74416H_COUNT_EN_MSK NO_OS_BIT(15) |
#define AD74416H_DAC_ACTIVE | ( | x | ) |
#define AD74416H_DAC_ACTIVE_MSK NO_OS_GENMASK(15, 0) |
DAC_ACTIVE Register
#define AD74416H_DAC_CODE | ( | x | ) |
#define AD74416H_DAC_CODE_MSK NO_OS_GENMASK(15, 0) |
DAC_CODE Register
#define AD74416H_DAC_CURRENT_RANGE 25000 |
#define AD74416H_DAC_RANGE 12000 |
#define AD74416H_DAC_RESOLUTION 16 |
#define AD74416H_DEBOUNCE_MODE_MSK NO_OS_BIT(6) |
#define AD74416H_DEBOUNCE_TIME_MSK NO_OS_GENMASK(4, 0) |
#define AD74416H_DIAG_ASSIGN 0x3A |
#define AD74416H_DIAG_ASSIGN_MSK | ( | x | ) |
DIAG_ASSIGN register
#define AD74416H_DIAG_EN_MSK | ( | x | ) |
#define AD74416H_DIAG_RESULT_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_DIN_CNT_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_DIN_CNT_UPR_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_DIN_COMP_OUT 0x3E |
#define AD74416H_DIN_COMP_OUT_A_MSK NO_OS_BIT(0) |
#define AD74416H_DIN_COMP_OUT_B_MSK NO_OS_BIT(1) |
#define AD74416H_DIN_COMP_OUT_C_MSK NO_OS_BIT(2) |
#define AD74416H_DIN_COMP_OUT_D_MSK NO_OS_BIT(3) |
DIN_COMP_OUT Register
#define AD74416H_DIN_CONFIG0 | ( | x | ) |
#define AD74416H_DIN_CONFIG1 | ( | x | ) |
#define AD74416H_DIN_COUNTER | ( | x | ) |
#define AD74416H_DIN_DO_MSK NO_OS_BIT(7, 6) |
GPIO_CONFIGx register
#define AD74416H_DIN_INPUT_SELECT_MSK NO_OS_BIT(10) |
#define AD74416H_DIN_INV_COMP_OUT_MSK NO_OS_BIT(14) |
#define AD74416H_DIN_OC_DET_EN_MSK NO_OS_BIT(8) |
#define AD74416H_DIN_OC_MSK NO_OS_BIT(1) |
#define AD74416H_DIN_SC_DET_EN_MSK NO_OS_BIT(9) |
#define AD74416H_DIN_SC_MSK NO_OS_BIT(0) |
#define AD74416H_DIN_SINK_MSK NO_OS_GENMASK(11, 7) |
#define AD74416H_DIN_SINK_RANGE_MSK NO_OS_BIT(12) |
#define AD74416H_DIN_STATUS_A_MSK NO_OS_BIT(4) |
#define AD74416H_DIN_STATUS_B_MSK NO_OS_BIT(5) |
#define AD74416H_DIN_STATUS_C_MSK NO_OS_BIT(6) |
#define AD74416H_DIN_STATUS_D_MSK NO_OS_BIT(7) |
#define AD74416H_DIN_THRESH_MODE_MSK NO_OS_BIT(7) |
#define AD74416H_DO_DATA_MSK NO_OS_BIT(7) |
#define AD74416H_DO_EXT_CONFIG | ( | x | ) |
#define AD74416H_DO_MODE_MSK NO_OS_BIT(0) |
#define AD74416H_DO_SC_MSK NO_OS_BIT(2) |
#define AD74416H_DO_SRC_SEL_MSK NO_OS_BIT(1) |
#define AD74416H_DO_STATUS_A_MSK NO_OS_BIT(8) |
#define AD74416H_DO_STATUS_B_MSK NO_OS_BIT(9) |
#define AD74416H_DO_STATUS_C_MSK NO_OS_BIT(10) |
#define AD74416H_DO_STATUS_D_MSK NO_OS_BIT(11) |
#define AD74416H_DO_T1_MSK NO_OS_GENMASK(6, 2) |
#define AD74416H_DO_T2_MSK NO_OS_GENMASK(12, 8) |
DO_EXT_CONFIG Register
#define AD74416H_DO_TIMEOUT_MSK NO_OS_BIT(3) |
#define AD74416H_DO_VDD_ERR_MSK NO_OS_BIT(4) |
#define AD74416H_DVCC_ERR_MSK NO_OS_BIT(2) |
#define AD74416H_EOM_MSK NO_OS_BIT(12) |
#define AD74416H_ERR_CLR_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_EVENT_DET_SEL_MSK NO_OS_GENMASK(7, 6) |
#define AD74416H_EVENT_DET_TIME_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_FET_LKG_COMP | ( | x | ) |
#define AD74416H_FET_SRC_LKG_COMP_EN_MSK NO_OS_BIT(0) |
FET_LKG_COMP Register
#define AD74416H_FIFOEN_MSK NO_OS_BIT(0) |
#define AD74416H_FRAME_ERR_MSK NO_OS_BIT(2) |
#define AD74416H_FRAME_SIZE 5 |
#define AD74416H_FRM_MON_EN_MSK NO_OS_BIT(8) |
#define AD74416H_FRM_MON_RST_CD_MSK NO_OS_BIT(10) |
#define AD74416H_FRM_MON_RST_GAP_MSK NO_OS_BIT(11) |
#define AD74416H_FRM_MON_RX_PREMX2_MSK NO_OS_BIT(12) |
#define AD74416H_FRM_MON_STATE_MSK NO_OS_GENMASK(15, 13) |
#define AD74416H_GAP_ERR_MSK NO_OS_BIT(0) |
#define AD74416H_GENERIC_ID 0x7A |
#define AD74416H_GENERIC_ID_MSK NO_OS_GENMASK(2, 0) |
#define AD74416H_GP_WK_PD_EN_MSK NO_OS_BIT(3) |
#define AD74416H_GPI_DATA_MSK NO_OS_BIT(5) |
#define AD74416H_GPIO_CONFIG | ( | x | ) |
#define AD74416H_GPIO_SELECT_MSK NO_OS_GENMASK(2, 0) |
#define AD74416H_GPO_DATA_MSK NO_OS_BIT(4) |
#define AD74416H_HART_ALERT_A_MSK NO_OS_BIT(12) |
#define AD74416H_HART_ALERT_B_MSK NO_OS_BIT(13) |
#define AD74416H_HART_ALERT_C_MSK NO_OS_BIT(14) |
#define AD74416H_HART_ALERT_D_MSK NO_OS_BIT(15) |
ALERT_STATUS Register
#define AD74416H_HART_ALERT_MASK | ( | x | ) |
#define AD74416H_HART_ALERT_STATUS | ( | x | ) |
#define AD74416H_HART_COMPL_SETTLED NO_OS_BIT(8) |
#define AD74416H_HART_CONFIG | ( | x | ) |
#define AD74416H_HART_EVDET | ( | x | ) |
#define AD74416H_HART_FCR | ( | x | ) |
#define AD74416H_HART_GPIO_IF_CH_MSK NO_OS_GENMASK(3, 2) |
#define AD74416H_HART_GPIO_IF_CONFIG 0xC0 |
#define AD74416H_HART_GPIO_IF_SEL_MSK NO_OS_GENMASK(1, 0) |
#define AD74416H_HART_GPIO_MON_CH_MSK NO_OS_GENMASK(4, 3) |
#define AD74416H_HART_GPIO_MON_CONFIG | ( | x | ) |
#define AD74416H_HART_GPIO_MON_SEL_MSK NO_OS_GENMASK(2, 0) |
#define AD74416H_HART_MCR | ( | x | ) |
#define AD74416H_HART_RFC | ( | x | ) |
#define AD74416H_HART_RX | ( | x | ) |
#define AD74416H_HART_TFC | ( | x | ) |
#define AD74416H_HART_TX | ( | x | ) |
#define AD74416H_HART_TX_GAIN | ( | x | ) |
#define AD74416H_HART_TX_PREM | ( | x | ) |
#define AD74416H_I_BURNOUT_CONFIG | ( | x | ) |
#define AD74416H_I_LIMIT_MSK NO_OS_BIT(0) |
#define AD74416H_LAST_ADC_RESULT 0x4E |
#define AD74416H_LAST_ADC_RESULT_UPR 0x4D |
#define AD74416H_LAST_CONV_CH_MSK NO_OS_GENAMSK(10 8) |
#define AD74416H_LAST_CONV_RES_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_LAST_CONV_RES_UPR_MSK NO_OS_GENMASK(7, 0) |
#define AD74416H_LIVE_STATUS 0x40 |
#define AD74416H_MODEM_DUPLEX_MSK NO_OS_BIT(1) |
#define AD74416H_MODEM_PWRUP_MSK NO_OS_BIT(0) |
#define AD74416H_N_CHANNELS 4 |
#define AD74416H_NOP 0x00 |
Register map
#define AD74416H_OUTPUT_CONFIG | ( | x | ) |
#define AD74416H_PARITY_ERR_MSK NO_OS_BIT(1) |
#define AD74416H_PWR_OPTIM_CONFIG 0x38 |
#define AD74416H_RBR_MSK NO_OS_GENMASK(7, 0) |
#define AD74416H_READ_SELECT 0x6E |
#define AD74416H_READBACK_ADDR_MSK NO_OS_GENMASK(8, 0) |
#define AD74416H_REF_EN_MSK NO_OS_BIT(13) |
PWR_OPTIM_CONFIG Register
#define AD74416H_RESET_OCCURRED_MSK NO_OS_BIT(0) |
#define AD74416H_RFBI_MSK NO_OS_BIT(8) |
#define AD74416H_RFC_MSK NO_OS_GENMASK(5, 0) |
#define AD74416H_RFCLR_MSK NO_OS_BIT(1) |
#define AD74416H_RFFE_MSK NO_OS_BIT(10) |
#define AD74416H_RFGI_MSK NO_OS_BIT(11) |
#define AD74416H_RFPE_MSK NO_OS_BIT(9) |
#define AD74416H_RFTRIG_MSK NO_OS_GENMASK(7, 3) |
#define AD74416H_RSENSE 12 |
The value of the sense resistor in ohms
#define AD74416H_RTD_ADC_REF_MSK NO_OS_BIT(3) |
RTD_CONFIG Register
#define AD74416H_RTD_CONFIG | ( | x | ) |
#define AD74416H_RTD_CURRENT_MSK NO_OS_BIT(0) |
#define AD74416H_RTD_EXC_SWAP_MSK NO_OS_BIT(1) |
#define AD74416H_RTD_MODE_SEL_MSK NO_OS_BIT(2) |
#define AD74416H_RTS_MSK NO_OS_BIT(0) |
#define AD74416H_RX_ALL_CHARS_MSK NO_OS_BIT(9) |
#define AD74416H_RX_BCNT_MSK NO_OS_BIT(11) |
#define AD74416H_RX_CMD_MSK NO_OS_BIT(10) |
#define AD74416H_RX_FIFO_ALERT_MSK NO_OS_BIT(4) |
#define AD74416H_RX_OVERFLOW_ERR_MSK NO_OS_BIT(3) |
#define AD74416H_SCRATCH | ( | x | ) |
#define AD74416H_SCRATCH_BITS_MSK NO_OS_GENMASK(15, 0) |
#define AD74416H_SENSE_AGND_OPT_MSK NO_OS_BIT(12) |
#define AD74416H_SENSE_HF_OPT_A_MSK NO_OS_BIT(8) |
#define AD74416H_SENSE_HF_OPT_B_MSK NO_OS_BIT(9) |
#define AD74416H_SENSE_HF_OPT_C_MSK NO_OS_BIT(10) |
#define AD74416H_SENSE_HF_OPT_D_MSK NO_OS_BIT(11) |
#define AD74416H_SENSE_LF_OPT_A_MSK NO_OS_BIT(4) |
#define AD74416H_SENSE_LF_OPT_B_MSK NO_OS_BIT(5) |
#define AD74416H_SENSE_LF_OPT_C_MSK NO_OS_BIT(6) |
#define AD74416H_SENSE_LF_OPT_D_MSK NO_OS_BIT(7) |
#define AD74416H_SILICON_ID0 0x7D |
#define AD74416H_SILICON_ID1 0x7E |
#define AD74416H_SILICON_REV 0x7B |
#define AD74416H_SILICON_REV_ID_MSK NO_OS_GENMASK(7, 0) |
#define AD74416H_SLEW_EN_MSK NO_OS_GENMASK(6, 5) |
#define AD74416H_SLEW_LIN_RATE_MSK NO_OS_GENMASK(2, 1) |
#define AD74416H_SLEW_LIN_STEP_MSK NO_OS_GENMASK(4, 3) |
#define AD74416H_SOM_MSK NO_OS_BIT(9) |
#define AD74416H_SPI_CRC_ERR_MSK NO_OS_BIT(13) |
#define AD74416H_SPI_ERR_MSK NO_OS_BIT(3) |
#define AD74416H_SPI_RD_RET_INFO_MSK NO_OS_BIT(8) |
#define AD74416H_SUPPLY_ALERT_MASK 0x5D |
#define AD74416H_SUPPLY_ALERT_STATUS 0x57 |
#define AD74416H_SUPPLY_ERR_MSK NO_OS_BIT(2) |
#define AD74416H_SUPPLY_STATUS_MSK NO_OS_BIT(0) |
#define AD74416H_TDR_MSK NO_OS_GENMASK(7, 0) |
#define AD74416H_TEMP_ALERT_MSK NO_OS_BIT(4) |
#define AD74416H_TEMP_ALERT_STATUS_MSK NO_OS_BIT(3) |
#define AD74416H_TEMP_OFFSET -2392 |
#define AD74416H_TEMP_SCALE 8950 |
#define AD74416H_TEMP_SCALE_DIV 1000 |
#define AD74416H_TFC_MSK NO_OS_GENMASK(5, 0) |
#define AD74416H_TFCLR_MSK NO_OS_BIT(2) |
#define AD74416H_TFTRIG_MSK NO_OS_GENMASK(12, 8) |
#define AD74416H_THERM_RST 0x73 |
#define AD74416H_THERM_RST_EN_MSK NO_OS_BIT(0) |
#define AD74416H_THRESHOLD_DAC_RANGE 98 |
#define AD74416H_THRESHOLD_RANGE 30000 |
#define AD74416H_TX_1B_AFTER_RST_MSK NO_OS_BIT(5) |
#define AD74416H_TX_COMPLETE_MSK NO_OS_BIT(6) |
#define AD74416H_TX_FIFO_ALERT_MSK NO_OS_BIT(5) |
#define AD74416H_TX_GAIN_MSK NO_OS_GENMASK(3, 0) |
#define AD74416H_TX_PREM_CNT_MSK NO_OS_GENMASK(4, 0) |
#define AD74416H_UID0_MSK NO_OS_GENMASK(6, 0) |
#define AD74416H_UID1_MSK NO_OS_GENMASK(5, 0) |
#define AD74416H_UID2_MSK NO_OS_GENMASK(11, 6) |
#define AD74416H_VIOUT_DRV_EN_DLY NO_OS_BIT(9) |
#define AD74416H_VIOUT_SHUTDOWN_MSK NO_OS_BIT(6) |
#define AD74416H_VOUT_RANGE_MSK NO_OS_BIT(7) |
#define AD74416H_VSENSEN_OPT_A_MSK NO_OS_BIT(0) |
#define AD74416H_VSENSEN_OPT_B_MSK NO_OS_BIT(1) |
#define AD74416H_VSENSEN_OPT_C_MSK NO_OS_BIT(2) |
#define AD74416H_VSENSEN_OPT_D_MSK NO_OS_BIT(3) |
#define AD74416H_WAIT_LDAC_CMD_MSK NO_OS_BIT(10) |
#define AD74416H_WDT_EN_MSK NO_OS_BIT(4) |
WDT_CONFIG Register
#define AD74416H_WDT_TIMEOUT_MSK NO_OS_GENMASK(3, 0) |
#define AD74416H_WTD_CONFIG 0x3B |
#define AD74VOUT_4W_EN_MSK NO_OS_BIT(11) |
enum ad74416h_adc_range |
enum ad74416h_adc_rate |
enum ad74416h_conv_seq |
enum ad74416h_dev_id |
enum ad74416h_diag_mode |
Possible values to be loaded in the DIAG_RESULT register.
enum ad74416h_diag_rate |
enum ad74416h_gpio_select |
enum ad74416h_i_limit |
enum ad74416h_lin_rate |
enum ad74416h_op_mode |
Operation modes of the device.
enum ad74416h_vout_range |
int ad74416h_dac_current_to_code | ( | struct ad74416h_desc * | desc, |
uint32_t | uamps, | ||
uint16_t * | code ) |
Convers a microamp value in the corresponding DAC 16 bit code.
Converts a microamp value in the corresponding DAC 16 bit code
desc | - The device structure. |
uamps | - The microamps value |
code | - The resulting DAC code |
int ad74416h_dac_slew_disable | ( | struct ad74416h_desc * | desc, |
uint32_t | ch ) |
Disable the slew rate control.
Disable the slew rate control
desc | - The device structure. |
ch | - The channel index. |
int ad74416h_dac_slew_enable | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_slew_lin_step | step, | ||
enum ad74416h_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
desc | - The device structure. |
ch | - The channel index. |
step | - Number of codes per increment. |
rate | - Number of increments per second. |
int ad74416h_dac_voltage_to_code | ( | struct ad74416h_desc * | desc, |
int32_t | mvolts, | ||
uint16_t * | code, | ||
uint32_t | ch ) |
Converts a millivolt value in the corresponding DAC 16 bit code.
Converts a millivolt value in the corresponding DAC 13 bit code
desc | - The device structure. |
mvolts | - The millivolts value. |
code | - The resulting DAC code. |
ch | - The channel index. |
int ad74416h_do_set | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
uint8_t | val ) |
Set the DO value of a channel.
Set the DO value of a channel
desc | - The device structure |
ch | - The channel index |
val | - the output logic state. 0-low 1-high |
int ad74416h_get_adc_conv_mux | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_adc_conv_mux * | val ) |
Get the ADC Input Node for conversion.
Get the ADC input node
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC input node setting. |
int ad74416h_get_adc_range | ( | struct ad74416h_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
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC range value. |
int ad74416h_get_adc_rate | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_adc_rate * | val ) |
Get the ADC Conversion Rate for a specific channel.
Get the ADC sample rate.
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC rejection setting. |
int ad74416h_get_adc_single | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
uint16_t * | val ) |
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
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC raw result. |
int ad74416h_get_diag | ( | struct ad74416h_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
desc | - The device structure. |
ch | - The channel index. |
diag_code | - The diagnostic setting. |
int ad74416h_get_live | ( | struct ad74416h_desc * | desc, |
union ad74416h_live_status * | status ) |
Read the live status bits.
Read the live status bits
desc | - The device structure. |
status | - The register's value. |
int ad74416h_get_raw_adc_result | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
uint32_t * | val ) |
Read the raw ADC raw conversion value.
Read the raw ADC raw conversion value
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC raw conversion value. |
int ad74416h_get_temp | ( | struct ad74416h_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
desc | - The device structure. |
ch | - The diagnostic channel on which the temperature reading is assigned and enabled. |
temp | - The measured temperature (in degrees Celsius). |
int ad74416h_gpio_get | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
uint8_t * | val ) |
Get the GPO value for a specific channel.
Get the GPIO value for a specific channel
desc | - The device structure. |
ch | - The channel index. |
val | - The debounce time. |
int ad74416h_gpio_set | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
uint8_t | val ) |
Set the logic value of a GPO pin.
Set the logic value of a GPO pin
desc | - The device structure. |
ch | - The channel index. |
val | - The output logic state. |
int ad74416h_init | ( | struct ad74416h_desc ** | desc, |
struct ad74416h_init_param * | init_param ) |
Initialize the device structure.
Initialize the device structure
desc | - The device structure to be initialized. |
init_param | - Initialization parameter for the device descriptor. |
int ad74416h_nb_active_channels | ( | struct ad74416h_desc * | desc, |
uint8_t * | nb_channels ) |
Get the number of active channels.
Get the number of active channels
desc | - The device structure. |
nb_channels | - The number of active channels |
int ad74416h_reg_read | ( | struct ad74416h_desc * | desc, |
uint32_t | addr, | ||
uint16_t * | val ) |
Read a register's value.
Read a register's value
desc | - The device structure. |
addr | - The register's address. |
val | - The register's read value. |
int ad74416h_reg_read_raw | ( | struct ad74416h_desc * | desc, |
uint32_t | addr, | ||
uint8_t * | val ) |
Read a raw communication frame.
Read a raw communication frame
desc | - The device structure. |
addr | - The register's address. |
val | - A raw comm frame. |
Reading a register on AD74416H requires writing the address to the READ_SELECT register first and then doing another spi read, which will contain the requested register value.
int ad74416h_reg_update | ( | struct ad74416h_desc * | desc, |
uint32_t | addr, | ||
uint16_t | mask, | ||
uint16_t | val ) |
Update a register's field.
Update a register's field
desc | - The device structure. |
addr | - The register's address. |
val | - The register's value. |
mask | - The mask for a specific register field. |
int ad74416h_reg_write | ( | struct ad74416h_desc * | desc, |
uint32_t | addr, | ||
uint16_t | val ) |
Write a register's value.
Write a register's value
desc | - The device structure. |
addr | - The register's address. |
val | - The register's value. |
int ad74416h_remove | ( | struct ad74416h_desc * | desc | ) |
Free the device descriptor.
Free the device descriptor
desc | - The device structure. |
int ad74416h_reset | ( | struct ad74416h_desc * | desc | ) |
Perform software or hardware reset and wait for device reset time.
Perform a soft reset
desc | - The device structure. |
int ad74416h_set_adc_channel_enable | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
bool | status ) |
Enable/disable a specific ADC channel.
Enable/disable a specific ADC channel
desc | - The device structure. |
ch | - The channel index. |
status | - Enabled or disabled status. |
int ad74416h_set_adc_conv_mux | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_adc_conv_mux | val ) |
Set the ADC Input Node for conversion.
Set the ADC input node
desc | - The device structure |
ch | - The channel index. |
val | - The ADC input node setting. |
int ad74416h_set_adc_conv_seq | ( | struct ad74416h_desc * | desc, |
enum ad74416h_conv_seq | status ) |
Start or stop ADC conversions.
Start or stop ADC conversions
desc | - The device structure. |
status | - The ADC conversion sequence. |
If the ADC was powered down, wait for 100us before the ADC starts doing conversions.
int ad74416h_set_adc_range | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_adc_range | val ) |
Set the ADC measurement range for a specific channel.
Set the ADC measurement range for a specific channel
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC range value. |
int ad74416h_set_adc_rate | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_adc_rate | val ) |
Set the ADC Conversion Rate for a specific channel.
Set the ADC sample rate.
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC rejection setting. |
int ad74416h_set_channel_dac_code | ( | struct ad74416h_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
desc | - The device structure. |
ch | - The channel index. |
dac_code | - The code for the DAC. |
int ad74416h_set_channel_function | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_op_mode | ch_func ) |
Set the operation mode for a specific channel.
Set the operation mode for a specific channel
desc | - The device structure. |
ch | - The channel index. |
ch_func | - The operation mode. |
int ad74416h_set_channel_i_limit | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_i_limit | i_limit ) |
Set the current limit for a specific DAC channel in vout mode.
Set the current limit for a specific DAC channel in vout mode
desc | - The devices structure |
ch | - The channel index |
i_limit | - The current limit |
int ad74416h_set_channel_vout_range | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_vout_range | vout_range ) |
Set the voltage range for a specific channel.
Set the voltage range for a specific channel
desc | - The device structure. |
ch | - The channel index. |
vout_range | - The voltage range. |
int ad74416h_set_debounce_mode | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_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.
desc | - The device structure. |
ch | - The channel index. |
mode | - The debounce mode. |
int ad74416h_set_debounce_time | ( | struct ad74416h_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
desc | - The device structure. |
ch | - The channel index. |
time | - The debounce time. |
int ad74416h_set_diag | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_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
desc | - The device structure. |
ch | - The channel index. |
diag_code | - The diagnostic setting. |
int ad74416h_set_diag_channel_enable | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
bool | status ) |
Enable conversions on a diagnostic register.
Enable conversions on a diagnostic register
desc | - The device structure. |
ch | - Diagnostic channel index. |
status | - Enabled or disabled status. |
int ad74416h_set_gpio_config | ( | struct ad74416h_desc * | desc, |
uint32_t | ch, | ||
enum ad74416h_gpio_select | config ) |
Set the GPIO operation mode.
Set the GPIO operation mode
desc | - The device structure. |
ch | - The channel index. |
config | - The configuration setting. |
int ad74416h_set_info | ( | struct ad74416h_desc * | desc, |
uint16_t | mode ) |
Select which information the device will respond with (in the readback field) when a read operation is performed
int ad74416h_set_therm_rst | ( | struct ad74416h_desc * | desc, |
bool | enable ) |
Enable or disable the higher thermal reset.
Enable or disable the higher thermal reset
desc | - The device structure. |
enable | - The thermal reset status. false: reset at 110 deg. Celsius. true: reset at 140 deg. Celsius. |
int ad74416h_set_threshold | ( | struct ad74416h_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
desc | - The device structure. |
ch | - The channel index. |
threshold | - The threshold value (in millivolts). |
Set a fixed range (0 - 16 V) for the threshold, so it would not depend on Vadd.