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

Header file of AD5754R Driver. More...

#include <stdint.h>
#include "no_os_gpio.h"
#include "no_os_spi.h"
#include "no_os_util.h"
#include "no_os_error.h"
Include dependency graph for ad5754r.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ad5754r_init_param
 ad5754r Device initialization parameters. More...
 
struct  ad5754r_dev
 ad5754r Device structure. More...
 

Macros

#define AD5754R_MAX_RESOLUTION   16
 
#define AD5754R_NUM_CHANNELS   4
 
#define AD5754R_REG_DAC   0
 
#define AD5754R_REG_OUTPUT_RANGE_SEL   1
 
#define AD5754R_REG_PWR_CTRL   2
 
#define AD5754R_REG_CONTROL   3
 
#define AD5754R_DAC_CH_A_ADDR   0
 
#define AD5754R_DAC_CH_B_ADDR   1
 
#define AD5754R_DAC_CH_C_ADDR   2
 
#define AD5754R_DAC_CH_D_ADDR   3
 
#define AD5754R_DAC_CH_ALL_ADDR   4
 
#define AD5754R_ADDR_REG_MASK   NO_OS_GENMASK(5, 3)
 
#define AD5754R_ADDR_REG(x)   no_os_field_prep(AD5754R_ADDR_REG_MASK, x)
 
#define AD5754R_ADDR_DAC_CH_MASK   NO_OS_GENMASK(2, 0)
 
#define AD5754R_ADDR_DAC_CH(x)   no_os_field_prep(AD5754R_ADDR_DAC_CH_MASK, x)
 
#define AD5754R_PREP_INSTR_ADDR(reg, dac_ch)
 
#define AD5754R_OUTPUT_RANGE_SEL_MASK   NO_OS_GENMASK(2,0)
 
#define AD5754R_CTRL_NOP   0
 
#define AD5754R_CTRL_TSD_EN(x)   no_os_field_prep(NO_OS_BIT(3), x)
 
#define AD5754R_CTRL_TSD_EN_MASK   NO_OS_BIT(3)
 
#define AD5754R_CTRL_CLAMP_EN(X)   no_os_field_prep(NO_OS_BIT(2), x)
 
#define AD5754R_CTRL_CLAMP_EN_MASK   NO_OS_BIT(2)
 
#define AD5754R_CTRL_CLR_SEL(x)   no_os_field_prep(NO_OS_BIT(1), x)
 
#define AD5754R_CTRL_CLR_SEL_MASK   NO_OS_BIT(1)
 
#define AD5754R_CTRL_SDO_DISABLE(x)   (x)
 
#define AD5754R_CTRL_SDO_DISABLE_MASK   NO_OS_BIT(0)
 
#define AD5754R_CTRL_CLEAR   0
 
#define AD5754R_CTRL_LOAD   0
 
#define AD5754R_PWR_UP_DAC_CH_MASK(x)   NO_OS_BIT(x)
 
#define AD5754R_PWR_UP_INT_REF_MASK   NO_OS_BIT(4)
 
#define AD5754R_PWR_OC_ALERT_MASK   NO_OS_GENMASK(10,7)
 
#define AD5754R_PWR_OC_ALERT_CH_MASK(x)
 
#define AD5754R_PWR_TSD_ALERT_MASK   NO_OS_BIT(5)
 
#define AD5754R_BYTE_H   NO_OS_GENMASK(15, 8)
 
#define AD5754R_BYTE_L   NO_OS_GENMASK(7, 0)
 
#define AD5754R_READ   NO_OS_BIT(7)
 
#define AD5754R_WRITE   0
 
#define AD5754R_INSTR_NOP   0x18
 
#define AD5754R_INSTR_CLEAR   0x1C
 
#define AD5754R_INSTR_LOAD   0x1D
 
#define AD5754R_GAIN_SCALE   1000
 

Enumerations

enum  ad5754r_dac_channels {
  AD5754R_DAC_CH_A,
  AD5754R_DAC_CH_B,
  AD5754R_DAC_CH_C,
  AD5754R_DAC_CH_D
}
 DAC Channels. More...
 
enum  ad5754r_dac_ch_range {
  AD5754R_SPAN_0V_TO_5V,
  AD5754R_SPAN_0V_TO_10V,
  AD5754R_SPAN_0V_TO_10V8,
  AD5754R_SPAN_M5V_TO_5V,
  AD5754R_SPAN_M10V_TO_10V,
  AD5754R_SPAN_M10V8_TO_10V8
}
 DAC Channel Output Ranges. More...
 
enum  ad5754r_dac_addr_for_ctrl_settings {
  AD5754R_NOP_DAC_ADDR = 0,
  AD5754R_TSD_CLAMP_CLR_SDO_DAC_ADDR = 1,
  AD5754R_CLEAR_DAC_ADDR = 4,
  AD5754R_LOAD_DAC_ADDR = 5
}
 DAC Addresses for Control Register Settings. More...
 
enum  ad5754r_ctrl_current_clamp_en {
  AD5754R_CTRL_CLAMP_DIS,
  AD5754R_CTRL_CLAMP_EN
}
 Current Clamp EN/DIS Modes. More...
 
enum  ad5754r_ctrl_tsd_en {
  AD5754R_CTRL_TSD_DIS,
  AD5754R_CTRL_TSD_EN
}
 TSD EN/DIS Modes. More...
 
enum  ad5754r_ctrl_clear_sel {
  AD5754R_CTRL_CLEAR_0V,
  AD5754R_CTRL_CLEAR_MIDSCALE_CODE
}
 Clear Mode Options. More...
 
enum  ad5754r_ctrl_sdo_dis {
  AD5754R_CTRL_SDO_EN,
  AD5754R_CTRL_SDO_DIS
}
 SDO EN/DIS Modes. More...
 
enum  ad5754r_pwr_dac_ch_pwrup {
  AD5754R_PWR_DAC_CH_POWERDOWN,
  AD5754R_PWR_DAC_CH_POWERUP
}
 DAC Channel Powerup Modes. More...
 
enum  ad5754r_pwr_int_ref_pwrup {
  AD5754R_PWR_INT_REF_POWERDOWN,
  AD5754R_PWR_INT_REF_POWERUP
}
 Internal Reference Powerup Modes. More...
 
enum  ad5754r_pwr_tsd_alert {
  AD5754R_PWR_TSD_NOT_DETECTED,
  AD5754R_PWR_TSD_DETECTED
}
 Thermal Shutdown Alert State. More...
 
enum  ad5754r_pwr_oc_ch_alert {
  AD5754R_PWR_OC_CH_NOT_DETECTED,
  AD5754R_PWR_OC_CH_DETECTED
}
 DAC Channel Overcurrent Alert State. More...
 
enum  ad5754r_encoding_scheme {
  AD5754R_ENCODING_TWOSCOMPLEMENT,
  AD5754R_ENCODING_BINARY
}
 DAC encoding scheme: Binary/2sComplement. More...
 

Functions

int ad5754r_write (struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t reg_val)
 Write device register. More...
 
int ad5754r_read (struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t *reg_val)
 Read device register. More...
 
int ad5754r_update_bits (struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t mask, uint16_t reg_val)
 Update specific register bits. More...
 
int ad5754r_update_dac_ch_register (struct ad5754r_dev *dev, uint8_t chn, uint16_t value)
 Update DAC register value for specific channel. More...
 
int ad5754r_update_dac_all_ch_registers (struct ad5754r_dev *dev, uint16_t value)
 Update DAC register value for all channels. More...
 
int ad5754r_ldac_trigger (struct ad5754r_dev *dev)
 Trigger LDAC. More...
 
int ad5754r_clear_async (struct ad5754r_dev *dev)
 Clear DAC output for all channels. More...
 
int ad5754r_read_dac_ch_register (struct ad5754r_dev *dev, uint8_t chn, uint16_t *value)
 Read DAC register value for specific channel. More...
 
int ad5754r_dac_code_to_mvolts (struct ad5754r_dev *dev, uint8_t chn, uint16_t code, uint16_t *value)
 Convert DAC code to millivolts for specific channel. More...
 
int ad5754r_dac_mvolts_to_code (struct ad5754r_dev *dev, uint8_t chn, uint16_t mvolts, uint16_t *code)
 Convert DAC millivolts to code for specific channel. More...
 
int ad5754r_set_ch_range (struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_dac_ch_range ch_range)
 Set output range for specific channel. More...
 
int ad5754r_set_ch_pwrup (struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_pwr_dac_ch_pwrup ch_pwrup)
 Set power-up state for specific channel. More...
 
int ad5754r_set_current_clamp_en (struct ad5754r_dev *dev, enum ad5754r_ctrl_current_clamp_en clamp_en)
 Apply current clamp setting for device. More...
 
int ad5754r_set_tsd_en (struct ad5754r_dev *dev, enum ad5754r_ctrl_tsd_en tsd_en)
 Apply TSD setting for device. More...
 
int ad5754r_set_clear_mode (struct ad5754r_dev *dev, enum ad5754r_ctrl_clear_sel clear_sel)
 Set clear mode setting for device. More...
 
int ad5754r_set_sdo_disable (struct ad5754r_dev *dev, enum ad5754r_ctrl_sdo_dis sdo_dis)
 Set SDO Enable/Disable state for device. More...
 
int ad5754r_set_int_ref_pwrup (struct ad5754r_dev *dev, enum ad5754r_pwr_int_ref_pwrup int_ref_pwrup)
 Set Internal Reference Enable/Disable state for device. More...
 
int ad5754r_get_oc_ch_alert (struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_pwr_oc_ch_alert *oc_ch_alert)
 Get Over-current status bit for specific channel. More...
 
int ad5754r_get_tsd_alert (struct ad5754r_dev *dev, enum ad5754r_pwr_tsd_alert *tsd_alert)
 Get Thermal Shutdown status bit. More...
 
int ad5754r_spi_verify (struct ad5754r_dev *dev)
 Write to and read back a register to verify SPI. More...
 
int ad5754r_gpio_init (struct ad5754r_dev *dev, struct ad5754r_init_param *init_param)
 Do GPIO initialization and config for AD5754R. More...
 
int ad5754r_reg_init (struct ad5754r_dev *dev, struct ad5754r_init_param *init_param)
 Initialize registers based on init parameters. More...
 
int ad5754r_init (struct ad5754r_dev **device, struct ad5754r_init_param *init_param)
 Initialize the device. More...
 
int ad5754r_remove_gpios (struct ad5754r_dev *dev)
 Remove GPIOs and free resources. More...
 
int ad5754r_remove (struct ad5754r_dev *dev)
 Remove the device and release resources. More...
 

Variables

const unsigned int ad5754r_gain_values_scaled [AD5754R_SPAN_M10V8_TO_10V8+1]
 

Detailed Description

Header file of AD5754R Driver.

Author
Ribhu DasPurkayastha (Ribhu.nosp@m..Das.nosp@m.Purka.nosp@m.yast.nosp@m.ha@an.nosp@m.alog.nosp@m..com)

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:

  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

◆ AD5754R_ADDR_DAC_CH

#define AD5754R_ADDR_DAC_CH (   x)    no_os_field_prep(AD5754R_ADDR_DAC_CH_MASK, x)

◆ AD5754R_ADDR_DAC_CH_MASK

#define AD5754R_ADDR_DAC_CH_MASK   NO_OS_GENMASK(2, 0)

◆ AD5754R_ADDR_REG

#define AD5754R_ADDR_REG (   x)    no_os_field_prep(AD5754R_ADDR_REG_MASK, x)

◆ AD5754R_ADDR_REG_MASK

#define AD5754R_ADDR_REG_MASK   NO_OS_GENMASK(5, 3)

◆ AD5754R_BYTE_H

#define AD5754R_BYTE_H   NO_OS_GENMASK(15, 8)

◆ AD5754R_BYTE_L

#define AD5754R_BYTE_L   NO_OS_GENMASK(7, 0)

◆ AD5754R_CTRL_CLAMP_EN

#define AD5754R_CTRL_CLAMP_EN (   X)    no_os_field_prep(NO_OS_BIT(2), x)

◆ AD5754R_CTRL_CLAMP_EN_MASK

#define AD5754R_CTRL_CLAMP_EN_MASK   NO_OS_BIT(2)

◆ AD5754R_CTRL_CLEAR

#define AD5754R_CTRL_CLEAR   0

◆ AD5754R_CTRL_CLR_SEL

#define AD5754R_CTRL_CLR_SEL (   x)    no_os_field_prep(NO_OS_BIT(1), x)

◆ AD5754R_CTRL_CLR_SEL_MASK

#define AD5754R_CTRL_CLR_SEL_MASK   NO_OS_BIT(1)

◆ AD5754R_CTRL_LOAD

#define AD5754R_CTRL_LOAD   0

◆ AD5754R_CTRL_NOP

#define AD5754R_CTRL_NOP   0

◆ AD5754R_CTRL_SDO_DISABLE

#define AD5754R_CTRL_SDO_DISABLE (   x)    (x)

◆ AD5754R_CTRL_SDO_DISABLE_MASK

#define AD5754R_CTRL_SDO_DISABLE_MASK   NO_OS_BIT(0)

◆ AD5754R_CTRL_TSD_EN

#define AD5754R_CTRL_TSD_EN (   x)    no_os_field_prep(NO_OS_BIT(3), x)

◆ AD5754R_CTRL_TSD_EN_MASK

#define AD5754R_CTRL_TSD_EN_MASK   NO_OS_BIT(3)

◆ AD5754R_DAC_CH_A_ADDR

#define AD5754R_DAC_CH_A_ADDR   0

◆ AD5754R_DAC_CH_ALL_ADDR

#define AD5754R_DAC_CH_ALL_ADDR   4

◆ AD5754R_DAC_CH_B_ADDR

#define AD5754R_DAC_CH_B_ADDR   1

◆ AD5754R_DAC_CH_C_ADDR

#define AD5754R_DAC_CH_C_ADDR   2

◆ AD5754R_DAC_CH_D_ADDR

#define AD5754R_DAC_CH_D_ADDR   3

◆ AD5754R_GAIN_SCALE

#define AD5754R_GAIN_SCALE   1000

◆ AD5754R_INSTR_CLEAR

#define AD5754R_INSTR_CLEAR   0x1C

◆ AD5754R_INSTR_LOAD

#define AD5754R_INSTR_LOAD   0x1D

◆ AD5754R_INSTR_NOP

#define AD5754R_INSTR_NOP   0x18

◆ AD5754R_MAX_RESOLUTION

#define AD5754R_MAX_RESOLUTION   16

◆ AD5754R_NUM_CHANNELS

#define AD5754R_NUM_CHANNELS   4

◆ AD5754R_OUTPUT_RANGE_SEL_MASK

#define AD5754R_OUTPUT_RANGE_SEL_MASK   NO_OS_GENMASK(2,0)

◆ AD5754R_PREP_INSTR_ADDR

#define AD5754R_PREP_INSTR_ADDR (   reg,
  dac_ch 
)
Value:
(AD5754R_ADDR_REG(reg) | \
AD5754R_ADDR_DAC_CH(dac_ch))

◆ AD5754R_PWR_OC_ALERT_CH_MASK

#define AD5754R_PWR_OC_ALERT_CH_MASK (   x)

◆ AD5754R_PWR_OC_ALERT_MASK

#define AD5754R_PWR_OC_ALERT_MASK   NO_OS_GENMASK(10,7)

◆ AD5754R_PWR_TSD_ALERT_MASK

#define AD5754R_PWR_TSD_ALERT_MASK   NO_OS_BIT(5)

◆ AD5754R_PWR_UP_DAC_CH_MASK

#define AD5754R_PWR_UP_DAC_CH_MASK (   x)    NO_OS_BIT(x)

◆ AD5754R_PWR_UP_INT_REF_MASK

#define AD5754R_PWR_UP_INT_REF_MASK   NO_OS_BIT(4)

◆ AD5754R_READ

#define AD5754R_READ   NO_OS_BIT(7)

◆ AD5754R_REG_CONTROL

#define AD5754R_REG_CONTROL   3

◆ AD5754R_REG_DAC

#define AD5754R_REG_DAC   0

◆ AD5754R_REG_OUTPUT_RANGE_SEL

#define AD5754R_REG_OUTPUT_RANGE_SEL   1

◆ AD5754R_REG_PWR_CTRL

#define AD5754R_REG_PWR_CTRL   2

◆ AD5754R_WRITE

#define AD5754R_WRITE   0

Enumeration Type Documentation

◆ ad5754r_ctrl_clear_sel

Clear Mode Options.

Enumerator
AD5754R_CTRL_CLEAR_0V 
AD5754R_CTRL_CLEAR_MIDSCALE_CODE 

◆ ad5754r_ctrl_current_clamp_en

Current Clamp EN/DIS Modes.

Enumerator
AD5754R_CTRL_CLAMP_DIS 
AD5754R_CTRL_CLAMP_EN 

◆ ad5754r_ctrl_sdo_dis

SDO EN/DIS Modes.

Enumerator
AD5754R_CTRL_SDO_EN 
AD5754R_CTRL_SDO_DIS 

◆ ad5754r_ctrl_tsd_en

TSD EN/DIS Modes.

Enumerator
AD5754R_CTRL_TSD_DIS 
AD5754R_CTRL_TSD_EN 

◆ ad5754r_dac_addr_for_ctrl_settings

DAC Addresses for Control Register Settings.

Enumerator
AD5754R_NOP_DAC_ADDR 
AD5754R_TSD_CLAMP_CLR_SDO_DAC_ADDR 
AD5754R_CLEAR_DAC_ADDR 
AD5754R_LOAD_DAC_ADDR 

◆ ad5754r_dac_ch_range

DAC Channel Output Ranges.

Enumerator
AD5754R_SPAN_0V_TO_5V 
AD5754R_SPAN_0V_TO_10V 
AD5754R_SPAN_0V_TO_10V8 
AD5754R_SPAN_M5V_TO_5V 
AD5754R_SPAN_M10V_TO_10V 
AD5754R_SPAN_M10V8_TO_10V8 

◆ ad5754r_dac_channels

DAC Channels.

Enumerator
AD5754R_DAC_CH_A 
AD5754R_DAC_CH_B 
AD5754R_DAC_CH_C 
AD5754R_DAC_CH_D 

◆ ad5754r_encoding_scheme

DAC encoding scheme: Binary/2sComplement.

Enumerator
AD5754R_ENCODING_TWOSCOMPLEMENT 
AD5754R_ENCODING_BINARY 

◆ ad5754r_pwr_dac_ch_pwrup

DAC Channel Powerup Modes.

Enumerator
AD5754R_PWR_DAC_CH_POWERDOWN 
AD5754R_PWR_DAC_CH_POWERUP 

◆ ad5754r_pwr_int_ref_pwrup

Internal Reference Powerup Modes.

Enumerator
AD5754R_PWR_INT_REF_POWERDOWN 
AD5754R_PWR_INT_REF_POWERUP 

◆ ad5754r_pwr_oc_ch_alert

DAC Channel Overcurrent Alert State.

Enumerator
AD5754R_PWR_OC_CH_NOT_DETECTED 
AD5754R_PWR_OC_CH_DETECTED 

◆ ad5754r_pwr_tsd_alert

Thermal Shutdown Alert State.

Enumerator
AD5754R_PWR_TSD_NOT_DETECTED 
AD5754R_PWR_TSD_DETECTED 

Function Documentation

◆ ad5754r_clear_async()

int ad5754r_clear_async ( struct ad5754r_dev dev)

Clear DAC output for all channels.

Clear DAC output for all channels.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_dac_code_to_mvolts()

int ad5754r_dac_code_to_mvolts ( struct ad5754r_dev dev,
uint8_t  chn,
uint16_t  code,
uint16_t *  value 
)

Convert DAC code to millivolts for specific channel.

Convert DAC code to millivolts for specific channel.

Parameters
dev- The device structure.
chn- The index of channel being addressed.
code- DAC code
value- Millivolts output calculated using DAC code.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_dac_mvolts_to_code()

int ad5754r_dac_mvolts_to_code ( struct ad5754r_dev dev,
uint8_t  chn,
uint16_t  mvolts,
uint16_t *  code 
)

Convert DAC millivolts to code for specific channel.

Convert DAC millivolts to code for specific channel.

Parameters
dev- The device structure.
chn- The index of channel being addressed.
mvolts- Desired millivolts ouput for specific channel
code- DAC code for desired output voltage
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_get_oc_ch_alert()

int ad5754r_get_oc_ch_alert ( struct ad5754r_dev dev,
uint8_t  chn,
enum ad5754r_pwr_oc_ch_alert oc_ch_alert 
)

Get Over-current status bit for specific channel.

Get Over-current status bit for specific channel,

Parameters
dev- The device structure.
chn- The index of channel being addressed.
oc_ch_alert- Store channel overcurrent alert status.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_get_tsd_alert()

int ad5754r_get_tsd_alert ( struct ad5754r_dev dev,
enum ad5754r_pwr_tsd_alert tsd_alert 
)

Get Thermal Shutdown status bit.

Get Thermal Shutdown status bit.

Parameters
dev- The device structure.
tsd_alert- Store TSD alert status.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_gpio_init()

int ad5754r_gpio_init ( struct ad5754r_dev dev,
struct ad5754r_init_param init_param 
)

Do GPIO initialization and config for AD5754R.

Do GPIO initialization and config for AD5754R

Parameters
dev- The device structure.
init_param- Pointer to structure containing the device initial parameters.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5754r_init()

int ad5754r_init ( struct ad5754r_dev **  device,
struct ad5754r_init_param init_param 
)

Initialize the device.

Initializes the communication with the device.

Parameters
device- The device structure.
init_param- Pointer to structure containing the device initial parameters.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_ldac_trigger()

int ad5754r_ldac_trigger ( struct ad5754r_dev dev)

Trigger LDAC.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_read()

int ad5754r_read ( struct ad5754r_dev dev,
uint8_t  instr_addr,
uint16_t *  reg_val 
)

Read device register.

Reads data from a register.

Parameters
dev- The device structure.
instr_addr- The instruction address comprising register and dac channel address.
reg_val- The data read from the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5754r_read_dac_ch_register()

int ad5754r_read_dac_ch_register ( struct ad5754r_dev dev,
uint8_t  chn,
uint16_t *  value 
)

Read DAC register value for specific channel.

Read DAC register value for specific channel.

Parameters
dev- The device structure.
chn- The index of channel being addressed.
value- The data read from dac channel register.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_reg_init()

int ad5754r_reg_init ( struct ad5754r_dev dev,
struct ad5754r_init_param init_param 
)

Initialize registers based on init parameters.

Initialize registers based on init parameters

Parameters
dev- The device structure.
init_param- Pointer to structure containing the device initial parameters.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5754r_remove()

int ad5754r_remove ( struct ad5754r_dev dev)

Remove the device and release resources.

Free the resources allocated by ad5754r_init().

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_remove_gpios()

int ad5754r_remove_gpios ( struct ad5754r_dev dev)

Remove GPIOs and free resources.

Remove GPIOs and free resources.

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

◆ ad5754r_set_ch_pwrup()

int ad5754r_set_ch_pwrup ( struct ad5754r_dev dev,
uint8_t  chn,
enum ad5754r_pwr_dac_ch_pwrup  ch_pwrup 
)

Set power-up state for specific channel.

Set power-up state for specific channel.

Parameters
dev- The device structure.
chn- The index of channel being addressed.
ch_pwrup- Powerup setting for specified channel.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5754r_set_ch_range()

int ad5754r_set_ch_range ( struct ad5754r_dev dev,
uint8_t  chn,
enum ad5754r_dac_ch_range  ch_range 
)

Set output range for specific channel.

Set output range for specific channel.

Parameters
dev- The device structure.
chn- The index of channel being addressed.
ch_range- Range option to be set for specified channel.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5754r_set_clear_mode()

int ad5754r_set_clear_mode ( struct ad5754r_dev dev,
enum ad5754r_ctrl_clear_sel  clear_sel 
)

Set clear mode setting for device.

Set clear mode setting for device.

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

◆ ad5754r_set_current_clamp_en()

int ad5754r_set_current_clamp_en ( struct ad5754r_dev dev,
enum ad5754r_ctrl_current_clamp_en  clamp_en 
)

Apply current clamp setting for device.

Apply current clamp setting for device.

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

◆ ad5754r_set_int_ref_pwrup()

int ad5754r_set_int_ref_pwrup ( struct ad5754r_dev dev,
enum ad5754r_pwr_int_ref_pwrup  int_ref_pwrup 
)

Set Internal Reference Enable/Disable state for device.

Set Internal Reference Enable/Disable state for device.

Parameters
dev- The device structure.
int_ref_pwrup- Internal Reference Enable/Disable state for device.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5754r_set_sdo_disable()

int ad5754r_set_sdo_disable ( struct ad5754r_dev dev,
enum ad5754r_ctrl_sdo_dis  sdo_dis 
)

Set SDO Enable/Disable state for device.

Set SDO Enable/Disable state for device.

Parameters
dev- The device structure.
sdo_dis- SDO Enable/Disable state for device.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5754r_set_tsd_en()

int ad5754r_set_tsd_en ( struct ad5754r_dev dev,
enum ad5754r_ctrl_tsd_en  tsd_en 
)

Apply TSD setting for device.

Apply tsd setting for device.

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

◆ ad5754r_spi_verify()

int ad5754r_spi_verify ( struct ad5754r_dev dev)

Write to and read back a register to verify SPI.

Update and readback a register to verify SPI.

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

◆ ad5754r_update_bits()

int ad5754r_update_bits ( struct ad5754r_dev dev,
uint8_t  instr_addr,
uint16_t  mask,
uint16_t  reg_val 
)

Update specific register bits.

Update specific register bits

Parameters
dev- The device structure.
instr_addr- The instruction address comprising register and dac channel address.
mask- Specific bits mask.
reg_val- The data to be written.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5754r_update_dac_all_ch_registers()

int ad5754r_update_dac_all_ch_registers ( struct ad5754r_dev dev,
uint16_t  value 
)

Update DAC register value for all channels.

Update DAC register value for all channels.

Parameters
dev- The device structure.
value- The data to be written to the dac channel registers.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_update_dac_ch_register()

int ad5754r_update_dac_ch_register ( struct ad5754r_dev dev,
uint8_t  chn,
uint16_t  value 
)

Update DAC register value for specific channel.

Update DAC register value for specific channel.

Parameters
dev- The device structure.
chn- The index of channel being addressed.
value- The data to be written to the dac channel.
Returns
0 in case of success, negative error code otherwise.

◆ ad5754r_write()

int ad5754r_write ( struct ad5754r_dev dev,
uint8_t  instr_addr,
uint16_t  reg_val 
)

Write device register.

Writes data into a register.

Parameters
dev-The device structure.
instr_addr- The instruction address comprising register and dac channel address.
reg_val- The data to be written.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

Variable Documentation

◆ ad5754r_gain_values_scaled

const unsigned int ad5754r_gain_values_scaled[AD5754R_SPAN_M10V8_TO_10V8+1]
AD5754R_PWR_OC_ALERT_MASK
#define AD5754R_PWR_OC_ALERT_MASK
Definition: ad5754r.h:96
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:45
AD5754R_ADDR_REG
#define AD5754R_ADDR_REG(x)
Definition: ad5754r.h:71