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

Header file for AD5770R Driver. More...

#include <stdint.h>
#include <stdbool.h>
#include "no-os/spi.h"
#include "no-os/gpio.h"
Include dependency graph for ad5770r.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ad5770r_monitor_setup
 
struct  ad5770r_dac_page_mask
 
struct  ad5770r_output_range
 
struct  ad5770r_device_spi_settings
 
struct  ad5770r_channel_switches
 
struct  ad5770r_alarm_cfg
 
struct  ad5770r_dev
 
struct  ad5770r_init_param
 

Macros

#define BIT(x)   (1UL << (x))
 
#define AD5770R_INTERFACE_CONFIG_A   0x00
 
#define AD5770R_INTERFACE_CONFIG_B   0x01
 
#define AD5770R_CHIP_TYPE   0x03
 
#define AD5770R_PRODUCT_ID_L   0x04
 
#define AD5770R_PRODUCT_ID_H   0x05
 
#define AD5770R_CHIP_GRADE   0x06
 
#define AD5770R_SCRATCH_PAD   0x0A
 
#define AD5770R_SPI_REVISION   0x0B
 
#define AD5770R_VENDOR_L   0x0C
 
#define AD5770R_VENDOR_H   0x0D
 
#define AD5770R_STREAM_MODE   0x0E
 
#define AD5770R_INTERFACE_CONFIG_C   0x10
 
#define AD5770R_INTERFACE_STATUS_A   0x11
 
#define AD5770R_CHANNEL_CONFIG   0x14
 
#define AD5770R_OUTPUT_RANGE_CH0   0x15
 
#define AD5770R_OUTPUT_RANGE_CH1   0x16
 
#define AD5770R_OUTPUT_RANGE_CH2   0x17
 
#define AD5770R_OUTPUT_RANGE_CH3   0x18
 
#define AD5770R_OUTPUT_RANGE_CH4   0x19
 
#define AD5770R_OUTPUT_RANGE_CH5   0x1A
 
#define AD5770R_REFERENCE   0x1B
 
#define AD5770R_ALARM_CONFIG   0x1C
 
#define AD5770R_OUTPUT_FILTER_CH0   0x1D
 
#define AD5770R_OUTPUT_FILTER_CH1   0x1E
 
#define AD5770R_OUTPUT_FILTER_CH2   0x1F
 
#define AD5770R_OUTPUT_FILTER_CH3   0x20
 
#define AD5770R_OUTPUT_FILTER_CH4   0x21
 
#define AD5770R_OUTPUT_FILTER_CH5   0x22
 
#define AD5770R_MONITOR_SETUP   0x23
 
#define AD5770R_STATUS   0x24
 
#define AD5770R_HW_LDAC   0x25
 
#define AD5770R_CH0_DAC_LSB   0x26
 
#define AD5770R_CH0_DAC_MSB   0x27
 
#define AD5770R_CH1_DAC_LSB   0x28
 
#define AD5770R_CH1_DAC_MSB   0x29
 
#define AD5770R_CH2_DAC_LSB   0x2A
 
#define AD5770R_CH2_DAC_MSB   0x2B
 
#define AD5770R_CH3_DAC_LSB   0x2C
 
#define AD5770R_CH3_DAC_MSB   0x2D
 
#define AD5770R_CH4_DAC_LSB   0x2E
 
#define AD5770R_CH4_DAC_MSB   0x2F
 
#define AD5770R_CH5_DAC_LSB   0x30
 
#define AD5770R_CH5_DAC_MSB   0x31
 
#define AD5770R_DAC_PAGE_MASK_LSB   0x32
 
#define AD5770R_DAC_PAGE_MASK_MSB   0x33
 
#define AD5770R_CH_SELECT   0x34
 
#define AD5770R_INPUT_PAGE_MASK_LSB   0x35
 
#define AD5770R_INPUT_PAGE_MASK_MSB   0x36
 
#define AD5770R_SW_LDAC   0x37
 
#define AD5770R_CH0_INPUT_LSB   0x38
 
#define AD5770R_CH0_INPUT_MSB   0x39
 
#define AD5770R_CH1_INPUT_LSB   0x3A
 
#define AD5770R_CH1_INPUT_MSB   0x3B
 
#define AD5770R_CH2_INPUT_LSB   0x3C
 
#define AD5770R_CH2_INPUT_MSB   0x3D
 
#define AD5770R_CH3_INPUT_LSB   0x3E
 
#define AD5770R_CH3_INPUT_MSB   0x3F
 
#define AD5770R_CH4_INPUT_LSB   0x40
 
#define AD5770R_CH4_INPUT_MSB   0x41
 
#define AD5770R_CH5_INPUT_LSB   0x42
 
#define AD5770R_CH5_INPUT_MSB   0x43
 
#define AD5770R_INTERFACE_CONFIG_A_SW_RESET_MSK   BIT(7) | BIT(0)
 
#define AD5770R_INTERFACE_CONFIG_A_SW_RESET(x)   (((x) & 0x1) | 0x80)
 
#define AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB_MSK   BIT(5)
 
#define AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB(x)   (((x) & 0x1) << 5)
 
#define AD5770R_INTERFACE_CONFIG_A_SDO_ACTIVE_MSK   BIT(4) | BIT(3)
 
#define AD5770R_INTERFACE_CONFIG_B_SINGLE_INST_MSK   BIT(7)
 
#define AD5770R_INTERFACE_CONFIG_B_SINGLE_INST(x)   (((x) & 0x1) << 7)
 
#define AD5770R_INTERFACE_CONFIG_B_SHORT_INST_MSK   BIT(3)
 
#define AD5770R_INTERFACE_CONFIG_B_SHORT_INST(x)   (((x) & 0x1) << 3)
 
#define AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS_MSK   BIT(5)
 
#define AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS(x)   (((x) & 0x1) << 5)
 
#define AD5770R_CHANNEL_CONFIG_CH0_SINK_EN_MSK   BIT(7)
 
#define AD5770R_CHANNEL_CONFIG_CH0_SINK_EN(x)   (((x) & 0x1) << 7)
 
#define AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B_MSK   BIT(5)
 
#define AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B(x)   (((x) & 0x1) << 5)
 
#define AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B_MSK   BIT(4)
 
#define AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B(x)   (((x) & 0x1) << 4)
 
#define AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B_MSK   BIT(3)
 
#define AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B(x)   (((x) & 0x1) << 3)
 
#define AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B_MSK   BIT(2)
 
#define AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B(x)   (((x) & 0x1) << 2)
 
#define AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B_MSK   BIT(1)
 
#define AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B(x)   (((x) & 0x1) << 1)
 
#define AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B_MSK   BIT(0)
 
#define AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B(x)   (((x) & 0x1) << 0)
 
#define AD5770R_OUTPUT_RANGE_OUTPUT_SCALING_MSK   GENMASK(7, 2)
 
#define AD5770R_OUTPUT_RANGE_OUTPUT_SCALING(x)   (((x) & 0x3F) << 2)
 
#define AD5770R_OUTPUT_RANGE_MODE_MSK   GENMASK(1, 0)
 
#define AD5770R_OUTPUT_RANGE_MODE(x)   ((x) & 0x03)
 
#define AD5770R_REFERENCE_RESISTOR_SEL_MSK   BIT(2)
 
#define AD5770R_REFERENCE_RESISTOR_SEL(x)   (((x) & 0x1) << 2)
 
#define AD5770R_REFERENCE_VOLTATE_SEL_MSK   GENMASK(1, 0)
 
#define AD5770R_REFERENCE_VOLTATE_SEL(x)   (((x) & 0x3) << 0)
 
#define AD5770R_ALARM_CONFIG_BACKGROUND_CRC_ALARM_MASK(x)   (((x) & 0x1) << 7)
 
#define AD5770R_ALARM_CONFIG_IREF_FAULT_ALARM_MASK(x)   (((x) & 0x1) << 6)
 
#define AD5770R_ALARM_CONFIG_NEGATIVE_CHANNEL0_ALARM_MASK(x)   (((x) & 0x1) << 5)
 
#define AD5770R_ALARM_CONFIG_OVER_TEMP_ALARM_MASK(x)   (((x) & 0x1) << 4)
 
#define AD5770R_ALARM_CONFIG_TEMP_WARNING_ALARM_MASK(x)   (((x) & 0x1) << 3)
 
#define AD5770R_ALARM_CONFIG_BACKGROUND_CRC_EN(x)   (((x) & 0x1) << 2)
 
#define AD5770R_ALARM_CONFIG_THERMAL_SHUTDOWN_EN(x)   (((x) & 0x1) << 1)
 
#define AD5770R_ALARM_CONFIG_OPEN_DRAIN_EN(x)   (((x) & 0x1) << 0)
 
#define AD5770R_OUTPUT_FILTER_CH_MSK   GENMASK(3, 0)
 
#define AD5770R_OUTPUT_FILTER_CH(x)   (((x) & 0xF) << 0)
 
#define AD5770R_MONITOR_SETUP_MON_FUNCTION_MSK   GENMASK(7, 6)
 
#define AD5770R_MONITOR_SETUP_MON_FUNCTION(x)   (((x) & 0x3) << 6)
 
#define AD5770R_MONITOR_SETUP_MUX_BUFFER_MSK   BIT(5)
 
#define AD5770R_MONITOR_SETUP_MUX_BUFFER(x)   (((x) & 0x1) << 5)
 
#define AD5770R_MONITOR_SETUP_IB_EXT_EN_MSK   BIT(4)
 
#define AD5770R_MONITOR_SETUP_IB_EXT_EN(x)   (((x) & 0x1) << 4)
 
#define AD5770R_MONITOR_SETUP_MON_CH_MSK   GENMASK(3, 0)
 
#define AD5770R_MONITOR_SETUP_MON_CH(x)   (((x) & 0x7) << 0)
 
#define AD5770R_STATUS_BACKGROUND_CRC_STATUS_MSK   BIT(7)
 
#define AD5770R_STATUS_IREF_FAULT_MSK   BIT(3)
 
#define AD5770R_STATUS_NEGATIVE_CHANNEL0_MSK   BIT(2)
 
#define AD5770R_STATUS_OVER_TEMP_MSK   BIT(1)
 
#define AD5770R_STATUS_TEMP_WARNING_MSK   BIT(0)
 
#define AD5770R_HW_LDAC_MASK_CH(x, channel)   (((x) & 0x1) << (channel))
 
#define AD5770R_CH_DAC_DATA_LSB(x)   (((x) & 0x3F) << 2)
 
#define AD5770R_CH_DAC_DATA_MSB(x)   (((x) & 0xFF) << 0)
 
#define AD5770R_CH_SELECT_SEL_CH(x, channel)   (((x) & 0x1) << (channel))
 
#define AD5770R_CH_DAC_INPUT_DATA_LSB(x)   (((x) & 0x3F) << 2)
 
#define AD5770R_CH_DAC_INPUT_DATA_MSB(x)   (((x) & 0xFF) << 0)
 
#define AD5770R_SW_LDAC_CH(x, channel)   (((x) & 0x1) << (channel))
 
#define AD5770R_REG_READ(x)   (((x) & 0x7F) | 0x80)
 
#define AD5770R_REG_WRITE(x)   ((x) & 0x7F)
 

Enumerations

enum  ad5770r_output_filter_resistor {
  AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM = 0x0,
  AD5770R_OUTPUT_FILTER_RESISTOR_5_6_KOHM = 0x5,
  AD5770R_OUTPUT_FILTER_RESISTOR_11_2_KOHM,
  AD5770R_OUTPUT_FILTER_RESISTOR_22_2_KOHM,
  AD5770R_OUTPUT_FILTER_RESISTOR_44_4_KOHM,
  AD5770R_OUTPUT_FILTER_RESISTOR_104_KOHM
}
 
enum  ad5770r_monitor_function {
  AD5770R_DISABLE = 0,
  AD5770R_VOLTAGE_MONITORING,
  AD5770R_CURRENT_MONITORING,
  AD5770R_TEMPERATURE_MONITORING
}
 
enum  ad5770r_channels {
  AD5770R_CH0 = 0,
  AD5770R_CH1,
  AD5770R_CH2,
  AD5770R_CH3,
  AD5770R_CH4,
  AD5770R_CH5
}
 
enum  ad5770r_reference_voltage {
  AD5770R_EXT_REF_2_5_V = 0,
  AD5770R_INT_REF_1_25_V_OUT_ON,
  AD5770R_EXT_REF_1_25_V,
  AD5770R_INT_REF_1_25_V_OUT_OFF
}
 

Functions

int32_t ad5770r_spi_reg_read (struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
 
int32_t ad5770r_spi_reg_read_multiple (struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t *reg_data, uint16_t count)
 
int32_t ad5770r_spi_reg_write (struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t reg_data)
 
int32_t ad5770r_spi_reg_write_multiple (struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t *reg_data, uint16_t count)
 
int32_t ad5770r_spi_write_mask (struct ad5770r_dev *dev, uint8_t reg_addr, uint32_t mask, uint8_t data)
 
int32_t ad5770r_set_device_spi (struct ad5770r_dev *dev, const struct ad5770r_device_spi_settings *spi_settings)
 
int32_t ad5770r_channel_config (struct ad5770r_dev *dev, const struct ad5770r_channel_switches *channel_config)
 
int32_t ad5770r_set_output_mode (struct ad5770r_dev *dev, const struct ad5770r_output_range *output_mode, enum ad5770r_channels channel)
 
int32_t ad5770r_set_reference (struct ad5770r_dev *dev, bool external_reference, enum ad5770r_reference_voltage reference_selector)
 
int32_t ad5770r_set_alarm (struct ad5770r_dev *dev, const struct ad5770r_alarm_cfg *const alarm_config)
 
int32_t ad5770r_set_output_filter (struct ad5770r_dev *dev, enum ad5770r_output_filter_resistor output_filter, enum ad5770r_channels channel)
 
int32_t ad5770r_set_hw_ldac (struct ad5770r_dev *dev, const struct ad5770r_channel_switches *mask_hw_ldac)
 
int32_t ad5770r_set_dac_value (struct ad5770r_dev *dev, uint16_t dac_value, enum ad5770r_channels channel)
 
int32_t ad5770r_set_dac_input (struct ad5770r_dev *dev, uint16_t dac_input, enum ad5770r_channels channel)
 
int32_t ad5770r_set_page_mask (struct ad5770r_dev *dev, const struct ad5770r_dac_page_mask *page_mask)
 
int32_t ad5770r_set_mask_channel (struct ad5770r_dev *dev, const struct ad5770r_channel_switches *mask_channel_sel)
 
int32_t ad5770r_set_sw_ldac (struct ad5770r_dev *dev, const struct ad5770r_channel_switches *sw_ldac)
 
int32_t ad5770r_get_status (struct ad5770r_dev *dev, uint8_t *status)
 
int32_t ad5770r_get_interface_status (struct ad5770r_dev *dev, uint8_t *status)
 
int32_t ad5770r_set_monitor_setup (struct ad5770r_dev *dev, const struct ad5770r_monitor_setup *mon_setup)
 
int32_t ad5770r_init (struct ad5770r_dev **device, const struct ad5770r_init_param *init_param)
 
int32_t ad5770r_remove (struct ad5770r_dev *dev)
 

Detailed Description

Header file for AD5770R Driver.

Author
Mircea Caprioru (mirce.nosp@m.a.ca.nosp@m.prior.nosp@m.u@an.nosp@m.alog..nosp@m.com)

Copyright 2018, 2020(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

◆ AD5770R_ALARM_CONFIG

#define AD5770R_ALARM_CONFIG   0x1C

◆ AD5770R_ALARM_CONFIG_BACKGROUND_CRC_ALARM_MASK

#define AD5770R_ALARM_CONFIG_BACKGROUND_CRC_ALARM_MASK (   x)    (((x) & 0x1) << 7)

◆ AD5770R_ALARM_CONFIG_BACKGROUND_CRC_EN

#define AD5770R_ALARM_CONFIG_BACKGROUND_CRC_EN (   x)    (((x) & 0x1) << 2)

◆ AD5770R_ALARM_CONFIG_IREF_FAULT_ALARM_MASK

#define AD5770R_ALARM_CONFIG_IREF_FAULT_ALARM_MASK (   x)    (((x) & 0x1) << 6)

◆ AD5770R_ALARM_CONFIG_NEGATIVE_CHANNEL0_ALARM_MASK

#define AD5770R_ALARM_CONFIG_NEGATIVE_CHANNEL0_ALARM_MASK (   x)    (((x) & 0x1) << 5)

◆ AD5770R_ALARM_CONFIG_OPEN_DRAIN_EN

#define AD5770R_ALARM_CONFIG_OPEN_DRAIN_EN (   x)    (((x) & 0x1) << 0)

◆ AD5770R_ALARM_CONFIG_OVER_TEMP_ALARM_MASK

#define AD5770R_ALARM_CONFIG_OVER_TEMP_ALARM_MASK (   x)    (((x) & 0x1) << 4)

◆ AD5770R_ALARM_CONFIG_TEMP_WARNING_ALARM_MASK

#define AD5770R_ALARM_CONFIG_TEMP_WARNING_ALARM_MASK (   x)    (((x) & 0x1) << 3)

◆ AD5770R_ALARM_CONFIG_THERMAL_SHUTDOWN_EN

#define AD5770R_ALARM_CONFIG_THERMAL_SHUTDOWN_EN (   x)    (((x) & 0x1) << 1)

◆ AD5770R_CH0_DAC_LSB

#define AD5770R_CH0_DAC_LSB   0x26

◆ AD5770R_CH0_DAC_MSB

#define AD5770R_CH0_DAC_MSB   0x27

◆ AD5770R_CH0_INPUT_LSB

#define AD5770R_CH0_INPUT_LSB   0x38

◆ AD5770R_CH0_INPUT_MSB

#define AD5770R_CH0_INPUT_MSB   0x39

◆ AD5770R_CH1_DAC_LSB

#define AD5770R_CH1_DAC_LSB   0x28

◆ AD5770R_CH1_DAC_MSB

#define AD5770R_CH1_DAC_MSB   0x29

◆ AD5770R_CH1_INPUT_LSB

#define AD5770R_CH1_INPUT_LSB   0x3A

◆ AD5770R_CH1_INPUT_MSB

#define AD5770R_CH1_INPUT_MSB   0x3B

◆ AD5770R_CH2_DAC_LSB

#define AD5770R_CH2_DAC_LSB   0x2A

◆ AD5770R_CH2_DAC_MSB

#define AD5770R_CH2_DAC_MSB   0x2B

◆ AD5770R_CH2_INPUT_LSB

#define AD5770R_CH2_INPUT_LSB   0x3C

◆ AD5770R_CH2_INPUT_MSB

#define AD5770R_CH2_INPUT_MSB   0x3D

◆ AD5770R_CH3_DAC_LSB

#define AD5770R_CH3_DAC_LSB   0x2C

◆ AD5770R_CH3_DAC_MSB

#define AD5770R_CH3_DAC_MSB   0x2D

◆ AD5770R_CH3_INPUT_LSB

#define AD5770R_CH3_INPUT_LSB   0x3E

◆ AD5770R_CH3_INPUT_MSB

#define AD5770R_CH3_INPUT_MSB   0x3F

◆ AD5770R_CH4_DAC_LSB

#define AD5770R_CH4_DAC_LSB   0x2E

◆ AD5770R_CH4_DAC_MSB

#define AD5770R_CH4_DAC_MSB   0x2F

◆ AD5770R_CH4_INPUT_LSB

#define AD5770R_CH4_INPUT_LSB   0x40

◆ AD5770R_CH4_INPUT_MSB

#define AD5770R_CH4_INPUT_MSB   0x41

◆ AD5770R_CH5_DAC_LSB

#define AD5770R_CH5_DAC_LSB   0x30

◆ AD5770R_CH5_DAC_MSB

#define AD5770R_CH5_DAC_MSB   0x31

◆ AD5770R_CH5_INPUT_LSB

#define AD5770R_CH5_INPUT_LSB   0x42

◆ AD5770R_CH5_INPUT_MSB

#define AD5770R_CH5_INPUT_MSB   0x43

◆ AD5770R_CH_DAC_DATA_LSB

#define AD5770R_CH_DAC_DATA_LSB (   x)    (((x) & 0x3F) << 2)

◆ AD5770R_CH_DAC_DATA_MSB

#define AD5770R_CH_DAC_DATA_MSB (   x)    (((x) & 0xFF) << 0)

◆ AD5770R_CH_DAC_INPUT_DATA_LSB

#define AD5770R_CH_DAC_INPUT_DATA_LSB (   x)    (((x) & 0x3F) << 2)

◆ AD5770R_CH_DAC_INPUT_DATA_MSB

#define AD5770R_CH_DAC_INPUT_DATA_MSB (   x)    (((x) & 0xFF) << 0)

◆ AD5770R_CH_SELECT

#define AD5770R_CH_SELECT   0x34

◆ AD5770R_CH_SELECT_SEL_CH

#define AD5770R_CH_SELECT_SEL_CH (   x,
  channel 
)    (((x) & 0x1) << (channel))

◆ AD5770R_CHANNEL_CONFIG

#define AD5770R_CHANNEL_CONFIG   0x14

◆ AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B

#define AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B (   x)    (((x) & 0x1) << 0)

◆ AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B_MSK

#define AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B_MSK   BIT(0)

◆ AD5770R_CHANNEL_CONFIG_CH0_SINK_EN

#define AD5770R_CHANNEL_CONFIG_CH0_SINK_EN (   x)    (((x) & 0x1) << 7)

◆ AD5770R_CHANNEL_CONFIG_CH0_SINK_EN_MSK

#define AD5770R_CHANNEL_CONFIG_CH0_SINK_EN_MSK   BIT(7)

◆ AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B

#define AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B (   x)    (((x) & 0x1) << 1)

◆ AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B_MSK

#define AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B_MSK   BIT(1)

◆ AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B

#define AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B (   x)    (((x) & 0x1) << 2)

◆ AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B_MSK

#define AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B_MSK   BIT(2)

◆ AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B

#define AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B (   x)    (((x) & 0x1) << 3)

◆ AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B_MSK

#define AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B_MSK   BIT(3)

◆ AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B

#define AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B (   x)    (((x) & 0x1) << 4)

◆ AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B_MSK

#define AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B_MSK   BIT(4)

◆ AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B

#define AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B (   x)    (((x) & 0x1) << 5)

◆ AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B_MSK

#define AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B_MSK   BIT(5)

◆ AD5770R_CHIP_GRADE

#define AD5770R_CHIP_GRADE   0x06

◆ AD5770R_CHIP_TYPE

#define AD5770R_CHIP_TYPE   0x03

◆ AD5770R_DAC_PAGE_MASK_LSB

#define AD5770R_DAC_PAGE_MASK_LSB   0x32

◆ AD5770R_DAC_PAGE_MASK_MSB

#define AD5770R_DAC_PAGE_MASK_MSB   0x33

◆ AD5770R_HW_LDAC

#define AD5770R_HW_LDAC   0x25

◆ AD5770R_HW_LDAC_MASK_CH

#define AD5770R_HW_LDAC_MASK_CH (   x,
  channel 
)    (((x) & 0x1) << (channel))

◆ AD5770R_INPUT_PAGE_MASK_LSB

#define AD5770R_INPUT_PAGE_MASK_LSB   0x35

◆ AD5770R_INPUT_PAGE_MASK_MSB

#define AD5770R_INPUT_PAGE_MASK_MSB   0x36

◆ AD5770R_INTERFACE_CONFIG_A

#define AD5770R_INTERFACE_CONFIG_A   0x00

◆ AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB

#define AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB (   x)    (((x) & 0x1) << 5)

◆ AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB_MSK

#define AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB_MSK   BIT(5)

◆ AD5770R_INTERFACE_CONFIG_A_SDO_ACTIVE_MSK

#define AD5770R_INTERFACE_CONFIG_A_SDO_ACTIVE_MSK   BIT(4) | BIT(3)

◆ AD5770R_INTERFACE_CONFIG_A_SW_RESET

#define AD5770R_INTERFACE_CONFIG_A_SW_RESET (   x)    (((x) & 0x1) | 0x80)

◆ AD5770R_INTERFACE_CONFIG_A_SW_RESET_MSK

#define AD5770R_INTERFACE_CONFIG_A_SW_RESET_MSK   BIT(7) | BIT(0)

◆ AD5770R_INTERFACE_CONFIG_B

#define AD5770R_INTERFACE_CONFIG_B   0x01

◆ AD5770R_INTERFACE_CONFIG_B_SHORT_INST

#define AD5770R_INTERFACE_CONFIG_B_SHORT_INST (   x)    (((x) & 0x1) << 3)

◆ AD5770R_INTERFACE_CONFIG_B_SHORT_INST_MSK

#define AD5770R_INTERFACE_CONFIG_B_SHORT_INST_MSK   BIT(3)

◆ AD5770R_INTERFACE_CONFIG_B_SINGLE_INST

#define AD5770R_INTERFACE_CONFIG_B_SINGLE_INST (   x)    (((x) & 0x1) << 7)

◆ AD5770R_INTERFACE_CONFIG_B_SINGLE_INST_MSK

#define AD5770R_INTERFACE_CONFIG_B_SINGLE_INST_MSK   BIT(7)

◆ AD5770R_INTERFACE_CONFIG_C

#define AD5770R_INTERFACE_CONFIG_C   0x10

◆ AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS

#define AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS (   x)    (((x) & 0x1) << 5)

◆ AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS_MSK

#define AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS_MSK   BIT(5)

◆ AD5770R_INTERFACE_STATUS_A

#define AD5770R_INTERFACE_STATUS_A   0x11

◆ AD5770R_MONITOR_SETUP

#define AD5770R_MONITOR_SETUP   0x23

◆ AD5770R_MONITOR_SETUP_IB_EXT_EN

#define AD5770R_MONITOR_SETUP_IB_EXT_EN (   x)    (((x) & 0x1) << 4)

◆ AD5770R_MONITOR_SETUP_IB_EXT_EN_MSK

#define AD5770R_MONITOR_SETUP_IB_EXT_EN_MSK   BIT(4)

◆ AD5770R_MONITOR_SETUP_MON_CH

#define AD5770R_MONITOR_SETUP_MON_CH (   x)    (((x) & 0x7) << 0)

◆ AD5770R_MONITOR_SETUP_MON_CH_MSK

#define AD5770R_MONITOR_SETUP_MON_CH_MSK   GENMASK(3, 0)

◆ AD5770R_MONITOR_SETUP_MON_FUNCTION

#define AD5770R_MONITOR_SETUP_MON_FUNCTION (   x)    (((x) & 0x3) << 6)

◆ AD5770R_MONITOR_SETUP_MON_FUNCTION_MSK

#define AD5770R_MONITOR_SETUP_MON_FUNCTION_MSK   GENMASK(7, 6)

◆ AD5770R_MONITOR_SETUP_MUX_BUFFER

#define AD5770R_MONITOR_SETUP_MUX_BUFFER (   x)    (((x) & 0x1) << 5)

◆ AD5770R_MONITOR_SETUP_MUX_BUFFER_MSK

#define AD5770R_MONITOR_SETUP_MUX_BUFFER_MSK   BIT(5)

◆ AD5770R_OUTPUT_FILTER_CH

#define AD5770R_OUTPUT_FILTER_CH (   x)    (((x) & 0xF) << 0)

◆ AD5770R_OUTPUT_FILTER_CH0

#define AD5770R_OUTPUT_FILTER_CH0   0x1D

◆ AD5770R_OUTPUT_FILTER_CH1

#define AD5770R_OUTPUT_FILTER_CH1   0x1E

◆ AD5770R_OUTPUT_FILTER_CH2

#define AD5770R_OUTPUT_FILTER_CH2   0x1F

◆ AD5770R_OUTPUT_FILTER_CH3

#define AD5770R_OUTPUT_FILTER_CH3   0x20

◆ AD5770R_OUTPUT_FILTER_CH4

#define AD5770R_OUTPUT_FILTER_CH4   0x21

◆ AD5770R_OUTPUT_FILTER_CH5

#define AD5770R_OUTPUT_FILTER_CH5   0x22

◆ AD5770R_OUTPUT_FILTER_CH_MSK

#define AD5770R_OUTPUT_FILTER_CH_MSK   GENMASK(3, 0)

◆ AD5770R_OUTPUT_RANGE_CH0

#define AD5770R_OUTPUT_RANGE_CH0   0x15

◆ AD5770R_OUTPUT_RANGE_CH1

#define AD5770R_OUTPUT_RANGE_CH1   0x16

◆ AD5770R_OUTPUT_RANGE_CH2

#define AD5770R_OUTPUT_RANGE_CH2   0x17

◆ AD5770R_OUTPUT_RANGE_CH3

#define AD5770R_OUTPUT_RANGE_CH3   0x18

◆ AD5770R_OUTPUT_RANGE_CH4

#define AD5770R_OUTPUT_RANGE_CH4   0x19

◆ AD5770R_OUTPUT_RANGE_CH5

#define AD5770R_OUTPUT_RANGE_CH5   0x1A

◆ AD5770R_OUTPUT_RANGE_MODE

#define AD5770R_OUTPUT_RANGE_MODE (   x)    ((x) & 0x03)

◆ AD5770R_OUTPUT_RANGE_MODE_MSK

#define AD5770R_OUTPUT_RANGE_MODE_MSK   GENMASK(1, 0)

◆ AD5770R_OUTPUT_RANGE_OUTPUT_SCALING

#define AD5770R_OUTPUT_RANGE_OUTPUT_SCALING (   x)    (((x) & 0x3F) << 2)

◆ AD5770R_OUTPUT_RANGE_OUTPUT_SCALING_MSK

#define AD5770R_OUTPUT_RANGE_OUTPUT_SCALING_MSK   GENMASK(7, 2)

◆ AD5770R_PRODUCT_ID_H

#define AD5770R_PRODUCT_ID_H   0x05

◆ AD5770R_PRODUCT_ID_L

#define AD5770R_PRODUCT_ID_L   0x04

◆ AD5770R_REFERENCE

#define AD5770R_REFERENCE   0x1B

◆ AD5770R_REFERENCE_RESISTOR_SEL

#define AD5770R_REFERENCE_RESISTOR_SEL (   x)    (((x) & 0x1) << 2)

◆ AD5770R_REFERENCE_RESISTOR_SEL_MSK

#define AD5770R_REFERENCE_RESISTOR_SEL_MSK   BIT(2)

◆ AD5770R_REFERENCE_VOLTATE_SEL

#define AD5770R_REFERENCE_VOLTATE_SEL (   x)    (((x) & 0x3) << 0)

◆ AD5770R_REFERENCE_VOLTATE_SEL_MSK

#define AD5770R_REFERENCE_VOLTATE_SEL_MSK   GENMASK(1, 0)

◆ AD5770R_REG_READ

#define AD5770R_REG_READ (   x)    (((x) & 0x7F) | 0x80)

◆ AD5770R_REG_WRITE

#define AD5770R_REG_WRITE (   x)    ((x) & 0x7F)

◆ AD5770R_SCRATCH_PAD

#define AD5770R_SCRATCH_PAD   0x0A

◆ AD5770R_SPI_REVISION

#define AD5770R_SPI_REVISION   0x0B

◆ AD5770R_STATUS

#define AD5770R_STATUS   0x24

◆ AD5770R_STATUS_BACKGROUND_CRC_STATUS_MSK

#define AD5770R_STATUS_BACKGROUND_CRC_STATUS_MSK   BIT(7)

◆ AD5770R_STATUS_IREF_FAULT_MSK

#define AD5770R_STATUS_IREF_FAULT_MSK   BIT(3)

◆ AD5770R_STATUS_NEGATIVE_CHANNEL0_MSK

#define AD5770R_STATUS_NEGATIVE_CHANNEL0_MSK   BIT(2)

◆ AD5770R_STATUS_OVER_TEMP_MSK

#define AD5770R_STATUS_OVER_TEMP_MSK   BIT(1)

◆ AD5770R_STATUS_TEMP_WARNING_MSK

#define AD5770R_STATUS_TEMP_WARNING_MSK   BIT(0)

◆ AD5770R_STREAM_MODE

#define AD5770R_STREAM_MODE   0x0E

◆ AD5770R_SW_LDAC

#define AD5770R_SW_LDAC   0x37

◆ AD5770R_SW_LDAC_CH

#define AD5770R_SW_LDAC_CH (   x,
  channel 
)    (((x) & 0x1) << (channel))

◆ AD5770R_VENDOR_H

#define AD5770R_VENDOR_H   0x0D

◆ AD5770R_VENDOR_L

#define AD5770R_VENDOR_L   0x0C

◆ BIT

#define BIT (   x)    (1UL << (x))

Enumeration Type Documentation

◆ ad5770r_channels

Enumerator
AD5770R_CH0 
AD5770R_CH1 
AD5770R_CH2 
AD5770R_CH3 
AD5770R_CH4 
AD5770R_CH5 

◆ ad5770r_monitor_function

Enumerator
AD5770R_DISABLE 
AD5770R_VOLTAGE_MONITORING 
AD5770R_CURRENT_MONITORING 
AD5770R_TEMPERATURE_MONITORING 

◆ ad5770r_output_filter_resistor

Enumerator
AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM 
AD5770R_OUTPUT_FILTER_RESISTOR_5_6_KOHM 
AD5770R_OUTPUT_FILTER_RESISTOR_11_2_KOHM 
AD5770R_OUTPUT_FILTER_RESISTOR_22_2_KOHM 
AD5770R_OUTPUT_FILTER_RESISTOR_44_4_KOHM 
AD5770R_OUTPUT_FILTER_RESISTOR_104_KOHM 

◆ ad5770r_reference_voltage

Enumerator
AD5770R_EXT_REF_2_5_V 
AD5770R_INT_REF_1_25_V_OUT_ON 
AD5770R_EXT_REF_1_25_V 
AD5770R_INT_REF_1_25_V_OUT_OFF 

Function Documentation

◆ ad5770r_channel_config()

int32_t ad5770r_channel_config ( struct ad5770r_dev dev,
const struct ad5770r_channel_switches channel_config 
)

Set the channel configuration.

Parameters
dev- The device structure.
channel_config- The structure that contains the channel configuration.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_get_interface_status()

int32_t ad5770r_get_interface_status ( struct ad5770r_dev dev,
uint8_t *  status 
)

Get interface status value.

Parameters
dev- The device structure.
status- The INTERFACE STATUS A register value.
Returns
SUCCESS in case of success, negative error code otherwise.

◆ ad5770r_get_status()

int32_t ad5770r_get_status ( struct ad5770r_dev dev,
uint8_t *  status 
)

Get status value.

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

◆ ad5770r_init()

int32_t ad5770r_init ( struct ad5770r_dev **  device,
const struct ad5770r_init_param init_param 
)

Initialize the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
SUCCESS in case of success, negative error code otherwise.

◆ ad5770r_remove()

int32_t ad5770r_remove ( struct ad5770r_dev dev)

Delete and remove the device.

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

◆ ad5770r_set_alarm()

int32_t ad5770r_set_alarm ( struct ad5770r_dev dev,
const struct ad5770r_alarm_cfg *const  alarm_config 
)

Set reference configuration.

Parameters
dev- The device structure.
alarm_config- Pointer to the array that contains the alarms that will be enabled.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_dac_input()

int32_t ad5770r_set_dac_input ( struct ad5770r_dev dev,
uint16_t  dac_input,
enum ad5770r_channels  channel 
)

Set dac value.

Parameters
dev- The device structure.
dac_input- value that will be set in the register.
channel- the selected channel.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_dac_value()

int32_t ad5770r_set_dac_value ( struct ad5770r_dev dev,
uint16_t  dac_value,
enum ad5770r_channels  channel 
)

Set dac value.

Parameters
dev- The device structure.
dac_value- value that will be set in the register.
channel- the selected channel.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_device_spi()

int32_t ad5770r_set_device_spi ( struct ad5770r_dev dev,
const struct ad5770r_device_spi_settings spi_settings 
)

Set device spi settings.

Parameters
dev- The device structure.
spi_settings- The structure that contains the device spi parameters.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_hw_ldac()

int32_t ad5770r_set_hw_ldac ( struct ad5770r_dev dev,
const struct ad5770r_channel_switches mask_hw_ldac 
)

Set the hardware ldac configuration.

Parameters
dev- The device structure.
mask_hw_ldac- The array contains HW LDAC channel masks.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_mask_channel()

int32_t ad5770r_set_mask_channel ( struct ad5770r_dev dev,
const struct ad5770r_channel_switches mask_channel_sel 
)

Set channel select.

Parameters
dev- The device structure.
mask_channel_sel- The array contains channel selection options.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_monitor_setup()

int32_t ad5770r_set_monitor_setup ( struct ad5770r_dev dev,
const struct ad5770r_monitor_setup mon_setup 
)

Set the channel monitor configuration.

Parameters
dev- The device structure.
mon_setup- The structure that contains the monitor setup values.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_output_filter()

int32_t ad5770r_set_output_filter ( struct ad5770r_dev dev,
enum ad5770r_output_filter_resistor  output_filter,
enum ad5770r_channels  channel 
)

Set the channel output filter resistor.

Parameters
dev- The device structure.
output_filter- The structure that contains the channel output filter resistor values.
channel- The channel number.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_output_mode()

int32_t ad5770r_set_output_mode ( struct ad5770r_dev dev,
const struct ad5770r_output_range output_mode,
enum ad5770r_channels  channel 
)

Set the channel configuration.

Parameters
dev- The device structure.
output_mode- The structure that contains the channel output parameters.
channel- The channel number.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_page_mask()

int32_t ad5770r_set_page_mask ( struct ad5770r_dev dev,
const struct ad5770r_dac_page_mask page_mask 
)

Set page mask for dac value and input.

Parameters
dev- The device structure.
page_mask- The structure contains the page mask values.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_reference()

int32_t ad5770r_set_reference ( struct ad5770r_dev dev,
bool  external_reference,
enum ad5770r_reference_voltage  reference_selector 
)

Set reference configuration.

Parameters
dev- The device structure.
external_reference- Enable external reference.
reference_selector- The reference to be selected.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_set_sw_ldac()

int32_t ad5770r_set_sw_ldac ( struct ad5770r_dev dev,
const struct ad5770r_channel_switches sw_ldac 
)

Set software LDAC.

Parameters
dev- The device structure.
sw_ldac- The array contains channel selection options.
Returns
SUCCESS in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_spi_reg_read()

int32_t ad5770r_spi_reg_read ( struct ad5770r_dev dev,
uint8_t  reg_addr,
uint8_t *  reg_data 
)

Read from device.

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

◆ ad5770r_spi_reg_read_multiple()

int32_t ad5770r_spi_reg_read_multiple ( struct ad5770r_dev dev,
uint8_t  reg_addr,
uint8_t *  reg_data,
uint16_t  count 
)

Multibyte read from device. A register read begins with the address and autoincrements for each aditional byte in the transfer.

Parameters
dev- The device structure.
reg_addr- The register address.
reg_data- The register data.
count- Number of bytes to read.
Returns
0 in case of success, negative error code otherwise.

◆ ad5770r_spi_reg_write()

int32_t ad5770r_spi_reg_write ( struct ad5770r_dev dev,
uint8_t  reg_addr,
uint8_t  reg_data 
)

Write to device.

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

◆ ad5770r_spi_reg_write_multiple()

int32_t ad5770r_spi_reg_write_multiple ( struct ad5770r_dev dev,
uint8_t  reg_addr,
uint8_t *  reg_data,
uint16_t  count 
)

Multibyte write from device. A register write begins with the address and autoincrements for each additional byte in the transfer.

Parameters
dev- The device structure.
reg_addr- The register address.
reg_data- The register data.
count- Number of bytes to read.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5770r_spi_write_mask()

int32_t ad5770r_spi_write_mask ( struct ad5770r_dev dev,
uint8_t  reg_addr,
uint32_t  mask,
uint8_t  data 
)

SPI write to device using a mask.

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