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

Header file of AD5460 Driver. More...

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

Go to the source code of this file.

Classes

struct  _ad5460_live_status
 Bitfield struct which maps on the LIVE_STATUS register. More...
 
union  ad5460_live_status
 Used to store the live status bit fields. More...
 
struct  ad5460_init_param
 
struct  ad5460_channel_config
 Device channel state. More...
 
struct  ad5460_desc
 AD5460 device descriptor. More...
 

Macros

#define AD5460_NOP   0x00
 
#define AD5460_CH_FUNC_SETUP(x)   (0x01 + (x * 6))
 
#define AD5460_OUTPUT_CONFIG(x)   (0x02 + (x * 6))
 
#define AD5460_DAC_SLEW_CONFIG(x)   (0x03 + (x * 6))
 
#define AD5460_DAC_CODE(x)   (0x04 + (x * 6))
 
#define AD5460_DAC_CLR_CODE(x)   (0x05 + (x * 6))
 
#define AD5460_DAC_ACTIVE(x)   (0x06 + (x * 6))
 
#define AD5460_GPIO_CONFIG(x)   (0x19 + x)
 
#define AD5460_WTD_CONFIG   0x1D
 
#define AD5460_DIAG_CONFIG   0x1E
 
#define AD5460_PWR_CONFIG   0x1F
 
#define AD5460_LIVE_STATUS   0x20
 
#define AD5460_DIGITAL_ALERT_STATUS   0x21
 
#define AD5460_ANALOG_ALERT_STATUS   0x22
 
#define AD5460_DIGITAL_ALERT_MSK   0x23
 
#define AD5460_ANALOG_ALERT_MSK   0x24
 
#define AD5460_READ_SELECT   0x73
 
#define AD5460_THERM_RST   0x74
 
#define AD5460_CMD_KEY   0x75
 
#define AD5460_BROADCAST_CMD_KEY   0x76
 
#define AD5460_SCRATCH(x)   (0x77 + x)
 
#define AD5460_GENERIC_ID   0x7B
 
#define AD5460_SILICON_REV   0x7C
 
#define AD5460_SILICON_ID0   0x7D
 
#define AD5460_SILICON_ID1   0x7E
 
#define AD5460_SILICON_ID2   0x7F
 
#define AD5460_CMD_KEY_RESET_1   0x9A17
 
#define AD5460_CMD_KEY_RESET_2   0xE9C1
 
#define AD5460_CH_FUNC_SETUP_MSK   NO_OS_GENMASK(3, 0)
 
#define AD5460_AVDD_SELECT_MSK   NO_OS_GENMASK(13, 12)
 
#define AD5460_CLR_EN_MSK   NO_OS_BIT(11)
 
#define AD5460_WAIT_LDAC_CMD_MSK   NO_OS_BIT(10)
 
#define AD5460_IOUT_RANGE_MSK   NO_OS_GENMASK(9, 8)
 
#define AD5460_I_LIMIT_MSK   NO_OS_BIT(7)
 
#define AD5460_ALARM_DEG_PERIOD_MSK   NO_OS_BIT(6)
 
#define AD5460_VOUT_RANGE_MSK   NO_OS_BIT(5)
 
#define AD5460_VIOUT_DRV_EN_DLY_MSK   NO_OS_GENMASK(4, 3)
 
#define AD5460_VOUT_4W_EN_MSK   NO_OS_BIT(2)
 
#define AD5460_VIOUT_GLITCH_MSK   NO_OS_GENMASK(1, 0)
 
#define AD5460_SLEW_EN_MSK   NO_OS_GENMASK(5, 4)
 
#define AD5460_SLEW_LIN_STEP_MSK   NO_OS_GENMASK(3, 2)
 
#define AD5460_SLEW_LIN_RATE_MSK   NO_OS_GENMASK(1, 0)
 
#define AD5460_DAC_CODE_MSK   NO_OS_GENMASK(15, 0)
 
#define AD5460_DAC_CLR_CODE_MSK   NO_OS_GENMASK(15, 0)
 
#define AD5460_DAC_ACTIVE_MSK   NO_OS_GENMASK(15, 0)
 
#define AD5460_GPI_DATA_MSK   NO_OS_BIT(5)
 
#define AD5460_GPO_DATA_MSK   NO_OS_BIT(4)
 
#define AD5460_GP_WK_PD_EN_MSK   NO_OS_BIT(3)
 
#define AD5460_GPIO_SELECT_MSK   NO_OS_GENMASK(2, 0)
 
#define AD5460_DIAG_SELECT_MSK   NO_OS_GENMASK(4, 0)
 
#define AD5460_REF_EN_MSK   NO_OS_BIT(0)
 
#define AD5460_TEMP_ALERT_STATUS_MSK   NO_OS_BIT(9)
 
#define AD5460_SUPPLY_STATUS_MSK   NO_OS_BIT(8)
 
#define AD5460_ANALOG_IO_SC_STATUS_D_MSK   NO_OS_BIT(7)
 
#define AD5460_ANALOG_IO_SC_STATUS_C_MSK   NO_OS_BIT(6)
 
#define AD5460_ANALOG_IO_SC_STATUS_B_MSK   NO_OS_BIT(5)
 
#define AD5460_ANALOG_IO_SC_STATUS_A_MSK   NO_OS_BIT(4)
 
#define AD5460_ANALOG_IO_OC_STATUS_D_MSK   NO_OS_BIT(3)
 
#define AD5460_ANALOG_IO_OC_STATUS_C_MSK   NO_OS_BIT(2)
 
#define AD5460_ANALOG_IO_OC_STATUS_B_MSK   NO_OS_BIT(1)
 
#define AD5460_ANALOG_IO_OC_STATUS_A_MSK   NO_OS_BIT(0)
 
#define AD5460_TEMP_ALERT_MSK   NO_OS_BIT(4)
 
#define AD5460_CAL_MEM_ERR_MSK   NO_OS_BIT(3)
 
#define AD5460_SPI_ERR_MSK   NO_OS_BIT(2)
 
#define AD5460_WDT_RESET_OCCURRED_MSK   NO_OS_BIT(1)
 
#define AD5460_RESET_OCCURRED_MSK   NO_OS_BIT(0)
 
#define AD5460_AVDD_HI_ERR_MSK   NO_OS_BIT(12)
 
#define AD5460_AVDD_LO_ERR_MSK   NO_OS_BIT(11)
 
#define AD5460_AVCC_ERR_MSK   NO_OS_BIT(10)
 
#define AD5460_IODVCC_ERR_MSK   NO_OS_BIT(9)
 
#define AD5460_AVSS_ERR_MSK   NO_OS_BIT(8)
 
#define AD5460_ANALOG_IO_SC_D_MSK   NO_OS_BIT(7)
 
#define AD5460_ANALOG_IO_SC_C_MSK   NO_OS_BIT(6)
 
#define AD5460_ANALOG_IO_SC_B_MSK   NO_OS_BIT(5)
 
#define AD5460_ANALOG_IO_SC_A_MSK   NO_OS_BIT(4)
 
#define AD5460_ANALOG_IO_OC_D_MSK   NO_OS_BIT(3)
 
#define AD5460_ANALOG_IO_OC_C_MSK   NO_OS_BIT(2)
 
#define AD5460_ANALOG_IO_OC_B_MSK   NO_OS_BIT(1)
 
#define AD5460_ANALOG_IO_OC_A_MSK   NO_OS_BIT(0)
 
#define AD5460_READBACK_SELECT_MODE_MSK   NO_OS_GENMASK(8, 0)
 
#define AD5460_READBACK_ADDR_MSK   NO_OS_GENMASK(8, 0)
 
#define AD5460_THERM_RST_MSK   NO_OS_GENMASK(8, 0)
 
#define AD5460_CMD_KEY_MSK   NO_OS_GENMASK(15, 0)
 
#define AD5460_BROADCAST_CMD_KEY_MSK   NO_OS_GENMASK(15, 0)
 
#define AD5460_SCRATCH_BITS_MSK   NO_OS_GENMASK(15, 0)
 
#define AD5460_GENERIC_ID_MSK   NO_OS_GENMASK(2, 0)
 
#define AD5460_SILICON_REV_ID_MSK   NO_OS_GENMASK(7, 0)
 
#define AD5460_LOT_MSK   NO_OS_GENMASK(6, 0)
 
#define AD5460_Y_COORDS_MSK   NO_OS_GENMASK(13, 7)
 
#define AD5460_X_COORDS_MSK   NO_OS_GENMASK(6, 0)
 
#define AD5460_WAFER_NUM_MSK   NO_OS_GENMASK(4, 0)
 
#define AD5460_FRAME_SIZE   5
 
#define AD5460_N_CHANNELS   4
 
#define AD5460_CH_A   0
 
#define AD5460_CH_B   1
 
#define AD5460_CH_C   2
 
#define AD5460_CH_D   3
 
#define AD5460_DAC_RANGE   12000
 
#define AD5460_DAC_CURRENT_RANGE_25MA   25000
 
#define AD5460_DAC_CURRENT_RANGE_20MA   20000
 
#define AD5460_DAC_CURRENT_RANGE_4MA   4000
 
#define AD5460_DAC_RESOLUTION   16
 

Enumerations

enum  ad5460_op_mode {
  AD5460_HIGH_Z = 0x0,
  AD5460_VOLTAGE_OUT = 0x1,
  AD5460_CURRENT_OUT = 0x2,
  AD5460_CURRENT_OUT_HART = 0x10
}
 Operation modes of the device. More...
 
enum  ad5460_vout_range {
  AD5460_VOUT_RANGE_0_12V,
  AD5460_VOUT_RANGE_NEG12_12V
}
 Possible voltage output ranges for the DAC. More...
 
enum  ad5460_iout_range {
  AD5460_IOUT_RANGE_0_25MA,
  AD5460_IOUT_RANGE_0_20MA,
  AD5460_IOUT_RANGE_4_20MA
}
 Possible current output ranges for the DAC. More...
 
enum  ad5460_i_limit {
  AD5460_I_LIMIT0,
  AD5460_I_LIMIT1
}
 DAC Current limits in Vout mode. More...
 
enum  ad5460_slew_lin_step {
  AD5460_STEP_0_8_PERCENT,
  AD5460_STEP_1_5_PERCENT,
  AD5460_STEP_6_1_PERCENT,
  AD5460_STEP_22_2_PERCENT
}
 The voltage step size of Full Scale DAC Voltage. More...
 
enum  ad5460_lin_rate {
  AD5460_LIN_RATE_4KHZ8,
  AD5460_LIN_RATE_76KHZ8,
  AD5460_LIN_RATE_153KHZ6,
  AD5460_LIN_RATE_230KHZ4
}
 Possible update rates for a DAC when slew control is enabled. More...
 
enum  ad5460_gpio_select {
  AD5460_GPIO_SEL_HIGH_Z,
  AD5460_GPIO_SEL_GPIO,
  AD5460_GPIO_SEL_GPI
}
 GPO operation modes. More...
 
enum  ad5460_diag_mode {
  AD5460_DIAG_NO_DIAG,
  AD5460_DIAG_PTAT,
  AD5460_DIAG_REFIN,
  AD5460_DIAG_REFOUT,
  AD5460_DIAG_INT_BG_V,
  AD5460_DIAG_SENSE_P_CH_A,
  AD5460_DIAG_SENSE_CH_B,
  AD5460_DIAG_SENSE_P_CH_C,
  AD5460_DIAG_SENSE_P_CH_D,
  AD5460_DIAG_SENSE_N_CH_A,
  AD5460_DIAG_SENSE_N_CH_B,
  AD5460_DIAG_SENSE_N_CH_C,
  AD5460_DIAG_SENSE_N_CH_D,
  AD5460_DIAG_SENSE_AVCC,
  AD5460_DIAG_SENSE_LDO,
  AD5460_DIAG_SENSE_DVCC,
  AD5460_DIAG_SENSE_AGND1,
  AD5460_DIAG_SENSE_AGND2,
  AD5460_DIAG_SENSE_AGND3,
  AD5460_DIAG_SENSE_DGND,
  AD5460_DIAG_SENSE_AVDD_HI,
  AD5460_DIAG_SENSE_AVDD_LO,
  AD5460_DIAG_SENSE_AVSS,
  AD5460_DIAG_SENSE_AVDD_CH_A,
  AD5460_DIAG_SENSE_AVDD_CH_B,
  AD5460_DIAG_SENSE_AVDD_CH_C,
  AD5460_DIAG_SENSE_AVDD_CH_D
}
 Possible values to be loaded in the DIAG_RESULT register. More...
 

Functions

int ad5460_dac_voltage_to_code (struct ad5460_desc *, int32_t, uint16_t *, uint32_t)
 Converts a millivolt value in the corresponding DAC 16 bit code. More...
 
int ad5460_dac_current_to_code (struct ad5460_desc *, uint32_t, uint16_t *, uint32_t)
 Convers a microamp value in the corresponding DAC 16 bit code. More...
 
int ad5460_reg_write (struct ad5460_desc *, uint32_t, uint16_t)
 Write a register's value. More...
 
int ad5460_reg_read_raw (struct ad5460_desc *, uint32_t, uint8_t *)
 Read a raw communication frame. More...
 
int ad5460_reg_read (struct ad5460_desc *, uint32_t, uint16_t *)
 Read a register's value. More...
 
int ad5460_reg_update (struct ad5460_desc *, uint32_t, uint16_t, uint16_t)
 Update a register's field. More...
 
int ad5460_set_channel_function (struct ad5460_desc *, uint32_t, enum ad5460_op_mode)
 Set the operation mode for a specific channel. More...
 
int ad5460_set_channel_vout_range (struct ad5460_desc *, uint32_t, enum ad5460_vout_range)
 Set the voltage range for a specific channel. More...
 
int ad5460_set_channel_iout_range (struct ad5460_desc *, uint32_t, enum ad5460_iout_range)
 Set the current range for a specific channel. More...
 
int ad5460_set_channel_i_limit (struct ad5460_desc *, uint32_t, enum ad5460_i_limit)
 Set the current limit for a specific DAC channel in vout mode. More...
 
int ad5460_set_channel_dac_code (struct ad5460_desc *, uint32_t, uint16_t)
 Set and load a code for the DAC on a specific channel. More...
 
int ad5460_set_diag (struct ad5460_desc *, uint32_t, enum ad5460_diag_mode)
 Set which diagnostic value to be loaded in the DIAG_RESULT register. More...
 
int ad5460_gpio_get (struct ad5460_desc *, uint32_t, uint8_t *)
 Get the GPO value for a specific channel. More...
 
int ad5460_set_gpio_config (struct ad5460_desc *, uint32_t, enum ad5460_gpio_select)
 Set the GPIO operation mode. More...
 
int ad5460_gpio_set (struct ad5460_desc *, uint32_t, uint8_t)
 Set the logic value of a GPO pin. More...
 
int ad5460_get_live (struct ad5460_desc *, union ad5460_live_status *)
 Read the live status bits. More...
 
int ad5460_dac_slew_enable (struct ad5460_desc *, uint32_t, enum ad5460_slew_lin_step, enum ad5460_lin_rate)
 Configure and enable slew rate control for a DAC on a specific channel. More...
 
int ad5460_dac_slew_disable (struct ad5460_desc *, uint32_t)
 Disable the slew rate control. More...
 
int ad5460_set_therm_rst (struct ad5460_desc *, bool)
 Enable or disable the higher thermal reset. More...
 
int ad5460_reset (struct ad5460_desc *)
 Perform software or hardware reset and wait for device reset time. More...
 
int ad5460_init (struct ad5460_desc **, struct ad5460_init_param *)
 Initialize the device structure. More...
 
int ad5460_remove (struct ad5460_desc *desc)
 Free the device descriptor. More...
 

Detailed Description

Header file of AD5460 Driver.

Author
Antoniu Miclaus (anton.nosp@m.iu.m.nosp@m.iclau.nosp@m.s@an.nosp@m.alog..nosp@m.com)

Copyright 2024(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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Macro Definition Documentation

◆ AD5460_ALARM_DEG_PERIOD_MSK

#define AD5460_ALARM_DEG_PERIOD_MSK   NO_OS_BIT(6)

◆ AD5460_ANALOG_ALERT_MSK

#define AD5460_ANALOG_ALERT_MSK   0x24

◆ AD5460_ANALOG_ALERT_STATUS

#define AD5460_ANALOG_ALERT_STATUS   0x22

◆ AD5460_ANALOG_IO_OC_A_MSK

#define AD5460_ANALOG_IO_OC_A_MSK   NO_OS_BIT(0)

◆ AD5460_ANALOG_IO_OC_B_MSK

#define AD5460_ANALOG_IO_OC_B_MSK   NO_OS_BIT(1)

◆ AD5460_ANALOG_IO_OC_C_MSK

#define AD5460_ANALOG_IO_OC_C_MSK   NO_OS_BIT(2)

◆ AD5460_ANALOG_IO_OC_D_MSK

#define AD5460_ANALOG_IO_OC_D_MSK   NO_OS_BIT(3)

◆ AD5460_ANALOG_IO_OC_STATUS_A_MSK

#define AD5460_ANALOG_IO_OC_STATUS_A_MSK   NO_OS_BIT(0)

◆ AD5460_ANALOG_IO_OC_STATUS_B_MSK

#define AD5460_ANALOG_IO_OC_STATUS_B_MSK   NO_OS_BIT(1)

◆ AD5460_ANALOG_IO_OC_STATUS_C_MSK

#define AD5460_ANALOG_IO_OC_STATUS_C_MSK   NO_OS_BIT(2)

◆ AD5460_ANALOG_IO_OC_STATUS_D_MSK

#define AD5460_ANALOG_IO_OC_STATUS_D_MSK   NO_OS_BIT(3)

◆ AD5460_ANALOG_IO_SC_A_MSK

#define AD5460_ANALOG_IO_SC_A_MSK   NO_OS_BIT(4)

◆ AD5460_ANALOG_IO_SC_B_MSK

#define AD5460_ANALOG_IO_SC_B_MSK   NO_OS_BIT(5)

◆ AD5460_ANALOG_IO_SC_C_MSK

#define AD5460_ANALOG_IO_SC_C_MSK   NO_OS_BIT(6)

◆ AD5460_ANALOG_IO_SC_D_MSK

#define AD5460_ANALOG_IO_SC_D_MSK   NO_OS_BIT(7)

◆ AD5460_ANALOG_IO_SC_STATUS_A_MSK

#define AD5460_ANALOG_IO_SC_STATUS_A_MSK   NO_OS_BIT(4)

◆ AD5460_ANALOG_IO_SC_STATUS_B_MSK

#define AD5460_ANALOG_IO_SC_STATUS_B_MSK   NO_OS_BIT(5)

◆ AD5460_ANALOG_IO_SC_STATUS_C_MSK

#define AD5460_ANALOG_IO_SC_STATUS_C_MSK   NO_OS_BIT(6)

◆ AD5460_ANALOG_IO_SC_STATUS_D_MSK

#define AD5460_ANALOG_IO_SC_STATUS_D_MSK   NO_OS_BIT(7)

◆ AD5460_AVCC_ERR_MSK

#define AD5460_AVCC_ERR_MSK   NO_OS_BIT(10)

◆ AD5460_AVDD_HI_ERR_MSK

#define AD5460_AVDD_HI_ERR_MSK   NO_OS_BIT(12)

◆ AD5460_AVDD_LO_ERR_MSK

#define AD5460_AVDD_LO_ERR_MSK   NO_OS_BIT(11)

◆ AD5460_AVDD_SELECT_MSK

#define AD5460_AVDD_SELECT_MSK   NO_OS_GENMASK(13, 12)

OUTPUT_CONFIGx Register

◆ AD5460_AVSS_ERR_MSK

#define AD5460_AVSS_ERR_MSK   NO_OS_BIT(8)

◆ AD5460_BROADCAST_CMD_KEY

#define AD5460_BROADCAST_CMD_KEY   0x76

◆ AD5460_BROADCAST_CMD_KEY_MSK

#define AD5460_BROADCAST_CMD_KEY_MSK   NO_OS_GENMASK(15, 0)

◆ AD5460_CAL_MEM_ERR_MSK

#define AD5460_CAL_MEM_ERR_MSK   NO_OS_BIT(3)

◆ AD5460_CH_A

#define AD5460_CH_A   0

◆ AD5460_CH_B

#define AD5460_CH_B   1

◆ AD5460_CH_C

#define AD5460_CH_C   2

◆ AD5460_CH_D

#define AD5460_CH_D   3

◆ AD5460_CH_FUNC_SETUP

#define AD5460_CH_FUNC_SETUP (   x)    (0x01 + (x * 6))

◆ AD5460_CH_FUNC_SETUP_MSK

#define AD5460_CH_FUNC_SETUP_MSK   NO_OS_GENMASK(3, 0)

◆ AD5460_CLR_EN_MSK

#define AD5460_CLR_EN_MSK   NO_OS_BIT(11)

◆ AD5460_CMD_KEY

#define AD5460_CMD_KEY   0x75

◆ AD5460_CMD_KEY_MSK

#define AD5460_CMD_KEY_MSK   NO_OS_GENMASK(15, 0)

◆ AD5460_CMD_KEY_RESET_1

#define AD5460_CMD_KEY_RESET_1   0x9A17

Software reset sequence

◆ AD5460_CMD_KEY_RESET_2

#define AD5460_CMD_KEY_RESET_2   0xE9C1

◆ AD5460_DAC_ACTIVE

#define AD5460_DAC_ACTIVE (   x)    (0x06 + (x * 6))

◆ AD5460_DAC_ACTIVE_MSK

#define AD5460_DAC_ACTIVE_MSK   NO_OS_GENMASK(15, 0)

DAC_ACTIVE Register

◆ AD5460_DAC_CLR_CODE

#define AD5460_DAC_CLR_CODE (   x)    (0x05 + (x * 6))

◆ AD5460_DAC_CLR_CODE_MSK

#define AD5460_DAC_CLR_CODE_MSK   NO_OS_GENMASK(15, 0)

DAC_CLR_CODE Register

◆ AD5460_DAC_CODE

#define AD5460_DAC_CODE (   x)    (0x04 + (x * 6))

◆ AD5460_DAC_CODE_MSK

#define AD5460_DAC_CODE_MSK   NO_OS_GENMASK(15, 0)

DAC_CODE Register

◆ AD5460_DAC_CURRENT_RANGE_20MA

#define AD5460_DAC_CURRENT_RANGE_20MA   20000

◆ AD5460_DAC_CURRENT_RANGE_25MA

#define AD5460_DAC_CURRENT_RANGE_25MA   25000

◆ AD5460_DAC_CURRENT_RANGE_4MA

#define AD5460_DAC_CURRENT_RANGE_4MA   4000

◆ AD5460_DAC_RANGE

#define AD5460_DAC_RANGE   12000

◆ AD5460_DAC_RESOLUTION

#define AD5460_DAC_RESOLUTION   16

◆ AD5460_DAC_SLEW_CONFIG

#define AD5460_DAC_SLEW_CONFIG (   x)    (0x03 + (x * 6))

◆ AD5460_DIAG_CONFIG

#define AD5460_DIAG_CONFIG   0x1E

◆ AD5460_DIAG_SELECT_MSK

#define AD5460_DIAG_SELECT_MSK   NO_OS_GENMASK(4, 0)

DIAG_SELECT Register

◆ AD5460_DIGITAL_ALERT_MSK

#define AD5460_DIGITAL_ALERT_MSK   0x23

◆ AD5460_DIGITAL_ALERT_STATUS

#define AD5460_DIGITAL_ALERT_STATUS   0x21

◆ AD5460_FRAME_SIZE

#define AD5460_FRAME_SIZE   5

◆ AD5460_GENERIC_ID

#define AD5460_GENERIC_ID   0x7B

◆ AD5460_GENERIC_ID_MSK

#define AD5460_GENERIC_ID_MSK   NO_OS_GENMASK(2, 0)

◆ AD5460_GP_WK_PD_EN_MSK

#define AD5460_GP_WK_PD_EN_MSK   NO_OS_BIT(3)

◆ AD5460_GPI_DATA_MSK

#define AD5460_GPI_DATA_MSK   NO_OS_BIT(5)

GPIO_CONFIG Register

◆ AD5460_GPIO_CONFIG

#define AD5460_GPIO_CONFIG (   x)    (0x19 + x)

◆ AD5460_GPIO_SELECT_MSK

#define AD5460_GPIO_SELECT_MSK   NO_OS_GENMASK(2, 0)

◆ AD5460_GPO_DATA_MSK

#define AD5460_GPO_DATA_MSK   NO_OS_BIT(4)

◆ AD5460_I_LIMIT_MSK

#define AD5460_I_LIMIT_MSK   NO_OS_BIT(7)

◆ AD5460_IODVCC_ERR_MSK

#define AD5460_IODVCC_ERR_MSK   NO_OS_BIT(9)

◆ AD5460_IOUT_RANGE_MSK

#define AD5460_IOUT_RANGE_MSK   NO_OS_GENMASK(9, 8)

◆ AD5460_LIVE_STATUS

#define AD5460_LIVE_STATUS   0x20

◆ AD5460_LOT_MSK

#define AD5460_LOT_MSK   NO_OS_GENMASK(6, 0)

◆ AD5460_N_CHANNELS

#define AD5460_N_CHANNELS   4

◆ AD5460_NOP

#define AD5460_NOP   0x00

◆ AD5460_OUTPUT_CONFIG

#define AD5460_OUTPUT_CONFIG (   x)    (0x02 + (x * 6))

◆ AD5460_PWR_CONFIG

#define AD5460_PWR_CONFIG   0x1F

◆ AD5460_READ_SELECT

#define AD5460_READ_SELECT   0x73

◆ AD5460_READBACK_ADDR_MSK

#define AD5460_READBACK_ADDR_MSK   NO_OS_GENMASK(8, 0)

◆ AD5460_READBACK_SELECT_MODE_MSK

#define AD5460_READBACK_SELECT_MODE_MSK   NO_OS_GENMASK(8, 0)

◆ AD5460_REF_EN_MSK

#define AD5460_REF_EN_MSK   NO_OS_BIT(0)

PWR_CONFIG Register

◆ AD5460_RESET_OCCURRED_MSK

#define AD5460_RESET_OCCURRED_MSK   NO_OS_BIT(0)

◆ AD5460_SCRATCH

#define AD5460_SCRATCH (   x)    (0x77 + x)

◆ AD5460_SCRATCH_BITS_MSK

#define AD5460_SCRATCH_BITS_MSK   NO_OS_GENMASK(15, 0)

◆ AD5460_SILICON_ID0

#define AD5460_SILICON_ID0   0x7D

◆ AD5460_SILICON_ID1

#define AD5460_SILICON_ID1   0x7E

◆ AD5460_SILICON_ID2

#define AD5460_SILICON_ID2   0x7F

◆ AD5460_SILICON_REV

#define AD5460_SILICON_REV   0x7C

◆ AD5460_SILICON_REV_ID_MSK

#define AD5460_SILICON_REV_ID_MSK   NO_OS_GENMASK(7, 0)

◆ AD5460_SLEW_EN_MSK

#define AD5460_SLEW_EN_MSK   NO_OS_GENMASK(5, 4)

DAC_SLEW_CONFIG Register

◆ AD5460_SLEW_LIN_RATE_MSK

#define AD5460_SLEW_LIN_RATE_MSK   NO_OS_GENMASK(1, 0)

◆ AD5460_SLEW_LIN_STEP_MSK

#define AD5460_SLEW_LIN_STEP_MSK   NO_OS_GENMASK(3, 2)

◆ AD5460_SPI_ERR_MSK

#define AD5460_SPI_ERR_MSK   NO_OS_BIT(2)

◆ AD5460_SUPPLY_STATUS_MSK

#define AD5460_SUPPLY_STATUS_MSK   NO_OS_BIT(8)

◆ AD5460_TEMP_ALERT_MSK

#define AD5460_TEMP_ALERT_MSK   NO_OS_BIT(4)

DIGITAL_ALERT_STATUS Register

◆ AD5460_TEMP_ALERT_STATUS_MSK

#define AD5460_TEMP_ALERT_STATUS_MSK   NO_OS_BIT(9)

LIVE_STATUS Register

◆ AD5460_THERM_RST

#define AD5460_THERM_RST   0x74

◆ AD5460_THERM_RST_MSK

#define AD5460_THERM_RST_MSK   NO_OS_GENMASK(8, 0)

◆ AD5460_VIOUT_DRV_EN_DLY_MSK

#define AD5460_VIOUT_DRV_EN_DLY_MSK   NO_OS_GENMASK(4, 3)

◆ AD5460_VIOUT_GLITCH_MSK

#define AD5460_VIOUT_GLITCH_MSK   NO_OS_GENMASK(1, 0)

◆ AD5460_VOUT_4W_EN_MSK

#define AD5460_VOUT_4W_EN_MSK   NO_OS_BIT(2)

◆ AD5460_VOUT_RANGE_MSK

#define AD5460_VOUT_RANGE_MSK   NO_OS_BIT(5)

◆ AD5460_WAFER_NUM_MSK

#define AD5460_WAFER_NUM_MSK   NO_OS_GENMASK(4, 0)

◆ AD5460_WAIT_LDAC_CMD_MSK

#define AD5460_WAIT_LDAC_CMD_MSK   NO_OS_BIT(10)

◆ AD5460_WDT_RESET_OCCURRED_MSK

#define AD5460_WDT_RESET_OCCURRED_MSK   NO_OS_BIT(1)

◆ AD5460_WTD_CONFIG

#define AD5460_WTD_CONFIG   0x1D

◆ AD5460_X_COORDS_MSK

#define AD5460_X_COORDS_MSK   NO_OS_GENMASK(6, 0)

◆ AD5460_Y_COORDS_MSK

#define AD5460_Y_COORDS_MSK   NO_OS_GENMASK(13, 7)

Enumeration Type Documentation

◆ ad5460_diag_mode

Possible values to be loaded in the DIAG_RESULT register.

Enumerator
AD5460_DIAG_NO_DIAG 
AD5460_DIAG_PTAT 
AD5460_DIAG_REFIN 
AD5460_DIAG_REFOUT 
AD5460_DIAG_INT_BG_V 
AD5460_DIAG_SENSE_P_CH_A 
AD5460_DIAG_SENSE_CH_B 
AD5460_DIAG_SENSE_P_CH_C 
AD5460_DIAG_SENSE_P_CH_D 
AD5460_DIAG_SENSE_N_CH_A 
AD5460_DIAG_SENSE_N_CH_B 
AD5460_DIAG_SENSE_N_CH_C 
AD5460_DIAG_SENSE_N_CH_D 
AD5460_DIAG_SENSE_AVCC 
AD5460_DIAG_SENSE_LDO 
AD5460_DIAG_SENSE_DVCC 
AD5460_DIAG_SENSE_AGND1 
AD5460_DIAG_SENSE_AGND2 
AD5460_DIAG_SENSE_AGND3 
AD5460_DIAG_SENSE_DGND 
AD5460_DIAG_SENSE_AVDD_HI 
AD5460_DIAG_SENSE_AVDD_LO 
AD5460_DIAG_SENSE_AVSS 
AD5460_DIAG_SENSE_AVDD_CH_A 
AD5460_DIAG_SENSE_AVDD_CH_B 
AD5460_DIAG_SENSE_AVDD_CH_C 
AD5460_DIAG_SENSE_AVDD_CH_D 

◆ ad5460_gpio_select

GPO operation modes.

Enumerator
AD5460_GPIO_SEL_HIGH_Z 
AD5460_GPIO_SEL_GPIO 
AD5460_GPIO_SEL_GPI 

◆ ad5460_i_limit

DAC Current limits in Vout mode.

Enumerator
AD5460_I_LIMIT0 
AD5460_I_LIMIT1 

◆ ad5460_iout_range

Possible current output ranges for the DAC.

Enumerator
AD5460_IOUT_RANGE_0_25MA 
AD5460_IOUT_RANGE_0_20MA 
AD5460_IOUT_RANGE_4_20MA 

◆ ad5460_lin_rate

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

Enumerator
AD5460_LIN_RATE_4KHZ8 
AD5460_LIN_RATE_76KHZ8 
AD5460_LIN_RATE_153KHZ6 
AD5460_LIN_RATE_230KHZ4 

◆ ad5460_op_mode

Operation modes of the device.

Enumerator
AD5460_HIGH_Z 
AD5460_VOLTAGE_OUT 
AD5460_CURRENT_OUT 
AD5460_CURRENT_OUT_HART 

◆ ad5460_slew_lin_step

The voltage step size of Full Scale DAC Voltage.

Enumerator
AD5460_STEP_0_8_PERCENT 
AD5460_STEP_1_5_PERCENT 
AD5460_STEP_6_1_PERCENT 
AD5460_STEP_22_2_PERCENT 

◆ ad5460_vout_range

Possible voltage output ranges for the DAC.

Enumerator
AD5460_VOUT_RANGE_0_12V 
AD5460_VOUT_RANGE_NEG12_12V 

Function Documentation

◆ ad5460_dac_current_to_code()

int ad5460_dac_current_to_code ( struct ad5460_desc desc,
uint32_t  uamps,
uint16_t *  code,
uint32_t  ch 
)

Convers a microamp value in the corresponding DAC 16 bit code.

Converts a microamp value in the corresponding DAC 16 bit code

Parameters
desc- The device structure.
uamps- The microamps value
code- The resulting DAC code
ch- Channel Number
Returns
0 in case of success, -EINVAL otherwise
Here is the caller graph for this function:

◆ ad5460_dac_slew_disable()

int ad5460_dac_slew_disable ( struct ad5460_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.

◆ ad5460_dac_slew_enable()

int ad5460_dac_slew_enable ( struct ad5460_desc desc,
uint32_t  ch,
enum ad5460_slew_lin_step  step,
enum ad5460_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.
Here is the caller graph for this function:

◆ ad5460_dac_voltage_to_code()

int ad5460_dac_voltage_to_code ( struct ad5460_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

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

◆ ad5460_get_live()

int ad5460_get_live ( struct ad5460_desc desc,
union ad5460_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:

◆ ad5460_gpio_get()

int ad5460_gpio_get ( struct ad5460_desc desc,
uint32_t  ch,
uint8_t *  val 
)

Get the GPO value for a specific channel.

Get the GPIO 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:

◆ ad5460_gpio_set()

int ad5460_gpio_set ( struct ad5460_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.
Here is the caller graph for this function:

◆ ad5460_init()

int ad5460_init ( struct ad5460_desc **  desc,
struct ad5460_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:

◆ ad5460_reg_read()

int ad5460_reg_read ( struct ad5460_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:

◆ ad5460_reg_read_raw()

int ad5460_reg_read_raw ( struct ad5460_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 AD5460 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:

◆ ad5460_reg_update()

int ad5460_reg_update ( struct ad5460_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:

◆ ad5460_reg_write()

int ad5460_reg_write ( struct ad5460_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:

◆ ad5460_remove()

int ad5460_remove ( struct ad5460_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:

◆ ad5460_reset()

int ad5460_reset ( struct ad5460_desc desc)

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

Perform a soft reset

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

◆ ad5460_set_channel_dac_code()

int ad5460_set_channel_dac_code ( struct ad5460_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:

◆ ad5460_set_channel_function()

int ad5460_set_channel_function ( struct ad5460_desc desc,
uint32_t  ch,
enum ad5460_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:

◆ ad5460_set_channel_i_limit()

int ad5460_set_channel_i_limit ( struct ad5460_desc desc,
uint32_t  ch,
enum ad5460_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

Parameters
desc- The devices structure
ch- The channel index
i_limit- The current limit
Returns
0 in case of success, negative error otherwise

◆ ad5460_set_channel_iout_range()

int ad5460_set_channel_iout_range ( struct ad5460_desc desc,
uint32_t  ch,
enum ad5460_iout_range  iout_range 
)

Set the current range for a specific channel.

Set the current range for a specific channel

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

◆ ad5460_set_channel_vout_range()

int ad5460_set_channel_vout_range ( struct ad5460_desc desc,
uint32_t  ch,
enum ad5460_vout_range  vout_range 
)

Set the voltage range for a specific channel.

Set the voltage range for a specific channel

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

◆ ad5460_set_diag()

int ad5460_set_diag ( struct ad5460_desc desc,
uint32_t  ch,
enum ad5460_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:

◆ ad5460_set_gpio_config()

int ad5460_set_gpio_config ( struct ad5460_desc desc,
uint32_t  ch,
enum ad5460_gpio_select  config 
)

Set the GPIO operation mode.

Set the GPIO 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:

◆ ad5460_set_therm_rst()

int ad5460_set_therm_rst ( struct ad5460_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.
Here is the caller graph for this function: