no-OS
|
Header file for AD5770R Driver. More...
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 |
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) |
Header file for AD5770R Driver.
Copyright 2018, 2020(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 AD5770R_ALARM_CONFIG 0x1C |
#define AD5770R_ALARM_CONFIG_BACKGROUND_CRC_ALARM_MASK | ( | x | ) | (((x) & 0x1) << 7) |
#define AD5770R_ALARM_CONFIG_BACKGROUND_CRC_EN | ( | x | ) | (((x) & 0x1) << 2) |
#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_OPEN_DRAIN_EN | ( | x | ) | (((x) & 0x1) << 0) |
#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_THERMAL_SHUTDOWN_EN | ( | x | ) | (((x) & 0x1) << 1) |
#define AD5770R_CH0_DAC_LSB 0x26 |
#define AD5770R_CH0_DAC_MSB 0x27 |
#define AD5770R_CH0_INPUT_LSB 0x38 |
#define AD5770R_CH0_INPUT_MSB 0x39 |
#define AD5770R_CH1_DAC_LSB 0x28 |
#define AD5770R_CH1_DAC_MSB 0x29 |
#define AD5770R_CH1_INPUT_LSB 0x3A |
#define AD5770R_CH1_INPUT_MSB 0x3B |
#define AD5770R_CH2_DAC_LSB 0x2A |
#define AD5770R_CH2_DAC_MSB 0x2B |
#define AD5770R_CH2_INPUT_LSB 0x3C |
#define AD5770R_CH2_INPUT_MSB 0x3D |
#define AD5770R_CH3_DAC_LSB 0x2C |
#define AD5770R_CH3_DAC_MSB 0x2D |
#define AD5770R_CH3_INPUT_LSB 0x3E |
#define AD5770R_CH3_INPUT_MSB 0x3F |
#define AD5770R_CH4_DAC_LSB 0x2E |
#define AD5770R_CH4_DAC_MSB 0x2F |
#define AD5770R_CH4_INPUT_LSB 0x40 |
#define AD5770R_CH4_INPUT_MSB 0x41 |
#define AD5770R_CH5_DAC_LSB 0x30 |
#define AD5770R_CH5_DAC_MSB 0x31 |
#define AD5770R_CH5_INPUT_LSB 0x42 |
#define AD5770R_CH5_INPUT_MSB 0x43 |
#define AD5770R_CH_DAC_DATA_LSB | ( | x | ) | (((x) & 0x3F) << 2) |
#define AD5770R_CH_DAC_DATA_MSB | ( | x | ) | (((x) & 0xFF) << 0) |
#define AD5770R_CH_DAC_INPUT_DATA_LSB | ( | x | ) | (((x) & 0x3F) << 2) |
#define AD5770R_CH_DAC_INPUT_DATA_MSB | ( | x | ) | (((x) & 0xFF) << 0) |
#define AD5770R_CH_SELECT 0x34 |
#define AD5770R_CH_SELECT_SEL_CH | ( | x, | |
channel | |||
) | (((x) & 0x1) << (channel)) |
#define AD5770R_CHANNEL_CONFIG 0x14 |
#define AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B | ( | x | ) | (((x) & 0x1) << 0) |
#define AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B_MSK NO_OS_BIT(0) |
#define AD5770R_CHANNEL_CONFIG_CH0_SINK_EN | ( | x | ) | (((x) & 0x1) << 7) |
#define AD5770R_CHANNEL_CONFIG_CH0_SINK_EN_MSK NO_OS_BIT(7) |
#define AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B | ( | x | ) | (((x) & 0x1) << 1) |
#define AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B_MSK NO_OS_BIT(1) |
#define AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B | ( | x | ) | (((x) & 0x1) << 2) |
#define AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B_MSK NO_OS_BIT(2) |
#define AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B | ( | x | ) | (((x) & 0x1) << 3) |
#define AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B_MSK NO_OS_BIT(3) |
#define AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B | ( | x | ) | (((x) & 0x1) << 4) |
#define AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B_MSK NO_OS_BIT(4) |
#define AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B | ( | x | ) | (((x) & 0x1) << 5) |
#define AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B_MSK NO_OS_BIT(5) |
#define AD5770R_CHIP_GRADE 0x06 |
#define AD5770R_CHIP_TYPE 0x03 |
#define AD5770R_DAC_PAGE_MASK_LSB 0x32 |
#define AD5770R_DAC_PAGE_MASK_MSB 0x33 |
#define AD5770R_HW_LDAC 0x25 |
#define AD5770R_HW_LDAC_MASK_CH | ( | x, | |
channel | |||
) | (((x) & 0x1) << (channel)) |
#define AD5770R_INPUT_PAGE_MASK_LSB 0x35 |
#define AD5770R_INPUT_PAGE_MASK_MSB 0x36 |
#define AD5770R_INTERFACE_CONFIG_A 0x00 |
#define AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB | ( | x | ) | (((x) & 0x1) << 5) |
#define AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB_MSK NO_OS_BIT(5) |
#define AD5770R_INTERFACE_CONFIG_A_SW_RESET | ( | x | ) | (((x) & 0x1) | 0x80) |
#define AD5770R_INTERFACE_CONFIG_B 0x01 |
#define AD5770R_INTERFACE_CONFIG_B_SHORT_INST | ( | x | ) | (((x) & 0x1) << 3) |
#define AD5770R_INTERFACE_CONFIG_B_SHORT_INST_MSK NO_OS_BIT(3) |
#define AD5770R_INTERFACE_CONFIG_B_SINGLE_INST | ( | x | ) | (((x) & 0x1) << 7) |
#define AD5770R_INTERFACE_CONFIG_B_SINGLE_INST_MSK NO_OS_BIT(7) |
#define AD5770R_INTERFACE_CONFIG_C 0x10 |
#define AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS | ( | x | ) | (((x) & 0x1) << 5) |
#define AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS_MSK NO_OS_BIT(5) |
#define AD5770R_INTERFACE_STATUS_A 0x11 |
#define AD5770R_MONITOR_SETUP 0x23 |
#define AD5770R_MONITOR_SETUP_IB_EXT_EN | ( | x | ) | (((x) & 0x1) << 4) |
#define AD5770R_MONITOR_SETUP_IB_EXT_EN_MSK NO_OS_BIT(4) |
#define AD5770R_MONITOR_SETUP_MON_CH | ( | x | ) | (((x) & 0x7) << 0) |
#define AD5770R_MONITOR_SETUP_MON_CH_MSK NO_OS_GENMASK(3, 0) |
#define AD5770R_MONITOR_SETUP_MON_FUNCTION | ( | x | ) | (((x) & 0x3) << 6) |
#define AD5770R_MONITOR_SETUP_MON_FUNCTION_MSK NO_OS_GENMASK(7, 6) |
#define AD5770R_MONITOR_SETUP_MUX_BUFFER | ( | x | ) | (((x) & 0x1) << 5) |
#define AD5770R_MONITOR_SETUP_MUX_BUFFER_MSK NO_OS_BIT(5) |
#define AD5770R_OUTPUT_FILTER_CH | ( | x | ) | (((x) & 0xF) << 0) |
#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_OUTPUT_FILTER_CH_MSK NO_OS_GENMASK(3, 0) |
#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_OUTPUT_RANGE_MODE | ( | x | ) | ((x) & 0x03) |
#define AD5770R_OUTPUT_RANGE_MODE_MSK NO_OS_GENMASK(1, 0) |
#define AD5770R_OUTPUT_RANGE_OUTPUT_SCALING | ( | x | ) | (((x) & 0x3F) << 2) |
#define AD5770R_OUTPUT_RANGE_OUTPUT_SCALING_MSK NO_OS_GENMASK(7, 2) |
#define AD5770R_PRODUCT_ID_H 0x05 |
#define AD5770R_PRODUCT_ID_L 0x04 |
#define AD5770R_REFERENCE 0x1B |
#define AD5770R_REFERENCE_RESISTOR_SEL | ( | x | ) | (((x) & 0x1) << 2) |
#define AD5770R_REFERENCE_RESISTOR_SEL_MSK NO_OS_BIT(2) |
#define AD5770R_REFERENCE_VOLTATE_SEL | ( | x | ) | (((x) & 0x3) << 0) |
#define AD5770R_REFERENCE_VOLTATE_SEL_MSK NO_OS_GENMASK(1, 0) |
#define AD5770R_REG_READ | ( | x | ) | (((x) & 0x7F) | 0x80) |
#define AD5770R_REG_WRITE | ( | x | ) | ((x) & 0x7F) |
#define AD5770R_SCRATCH_PAD 0x0A |
#define AD5770R_SPI_REVISION 0x0B |
#define AD5770R_STATUS 0x24 |
#define AD5770R_STATUS_BACKGROUND_CRC_STATUS_MSK NO_OS_BIT(7) |
#define AD5770R_STATUS_IREF_FAULT_MSK NO_OS_BIT(3) |
#define AD5770R_STATUS_NEGATIVE_CHANNEL0_MSK NO_OS_BIT(2) |
#define AD5770R_STATUS_OVER_TEMP_MSK NO_OS_BIT(1) |
#define AD5770R_STATUS_TEMP_WARNING_MSK NO_OS_BIT(0) |
#define AD5770R_STREAM_MODE 0x0E |
#define AD5770R_SW_LDAC 0x37 |
#define AD5770R_SW_LDAC_CH | ( | x, | |
channel | |||
) | (((x) & 0x1) << (channel)) |
#define AD5770R_VENDOR_H 0x0D |
#define AD5770R_VENDOR_L 0x0C |
#define NO_OS_BIT | ( | x | ) | (1UL << (x)) |
enum ad5770r_channels |
int32_t ad5770r_channel_config | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_channel_switches * | channel_config | ||
) |
Set the channel configuration.
dev | - The device structure. |
channel_config | - The structure that contains the channel configuration. |
int32_t ad5770r_get_interface_status | ( | struct ad5770r_dev * | dev, |
uint8_t * | status | ||
) |
Get interface status value.
dev | - The device structure. |
status | - The INTERFACE STATUS A register value. |
int32_t ad5770r_get_status | ( | struct ad5770r_dev * | dev, |
uint8_t * | status | ||
) |
Get status value.
dev | - The device structure. |
status | - The status of the device. |
int32_t ad5770r_init | ( | struct ad5770r_dev ** | device, |
const struct ad5770r_init_param * | init_param | ||
) |
Initialize the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t ad5770r_remove | ( | struct ad5770r_dev * | dev | ) |
Delete and remove the device.
dev | - The device structure. |
int32_t ad5770r_set_alarm | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_alarm_cfg *const | alarm_config | ||
) |
Set reference configuration.
dev | - The device structure. |
alarm_config | - Pointer to the array that contains the alarms that will be enabled. |
int32_t ad5770r_set_dac_input | ( | struct ad5770r_dev * | dev, |
uint16_t | dac_input, | ||
enum ad5770r_channels | channel | ||
) |
Set dac value.
dev | - The device structure. |
dac_input | - value that will be set in the register. |
channel | - the selected channel. |
int32_t ad5770r_set_dac_value | ( | struct ad5770r_dev * | dev, |
uint16_t | dac_value, | ||
enum ad5770r_channels | channel | ||
) |
Set dac value.
dev | - The device structure. |
dac_value | - value that will be set in the register. |
channel | - the selected channel. |
int32_t ad5770r_set_device_spi | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_device_spi_settings * | spi_settings | ||
) |
Set device spi settings.
dev | - The device structure. |
spi_settings | - The structure that contains the device spi parameters. |
int32_t ad5770r_set_hw_ldac | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_channel_switches * | mask_hw_ldac | ||
) |
Set the hardware ldac configuration.
dev | - The device structure. |
mask_hw_ldac | - The array contains HW LDAC channel masks. |
int32_t ad5770r_set_mask_channel | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_channel_switches * | mask_channel_sel | ||
) |
Set channel select.
dev | - The device structure. |
mask_channel_sel | - The array contains channel selection options. |
int32_t ad5770r_set_monitor_setup | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_monitor_setup * | mon_setup | ||
) |
Set the channel monitor configuration.
dev | - The device structure. |
mon_setup | - The structure that contains the monitor setup values. |
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.
dev | - The device structure. |
output_filter | - The structure that contains the channel output filter resistor values. |
channel | - The channel number. |
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.
dev | - The device structure. |
output_mode | - The structure that contains the channel output parameters. |
channel | - The channel number. |
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.
dev | - The device structure. |
page_mask | - The structure contains the page mask values. |
int32_t ad5770r_set_reference | ( | struct ad5770r_dev * | dev, |
bool | external_reference, | ||
enum ad5770r_reference_voltage | reference_selector | ||
) |
Set reference configuration.
dev | - The device structure. |
external_reference | - Enable external reference. |
reference_selector | - The reference to be selected. |
int32_t ad5770r_set_sw_ldac | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_channel_switches * | sw_ldac | ||
) |
Set software LDAC.
dev | - The device structure. |
sw_ldac | - The array contains channel selection options. |
int32_t ad5770r_spi_reg_read | ( | struct ad5770r_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data | ||
) |
Read from device.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
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.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
count | - Number of bytes to read. |
int32_t ad5770r_spi_reg_write | ( | struct ad5770r_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | reg_data | ||
) |
Write to device.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
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.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
count | - Number of bytes to read. |
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.
dev | - The device structure. |
reg_addr | - The register address. |
mask | - The mask. |
data | - The register data. |