Header file for the ad4170 driver. More...
#include <stdint.h>
#include <stdbool.h>
#include "no_os_util.h"
#include "no_os_gpio.h"
#include "no_os_spi.h"
Go to the source code of this file.
Classes | |
struct | ad4170_pin_muxing |
Pin_Muxing register settings. More... | |
struct | ad4170_clock_ctrl |
Clock_Ctrl register settings. More... | |
struct | ad4170_adc_ctrl |
ADC_Ctrl register settings. More... | |
struct | ad4170_channel_setup |
Channel_Setup register settings. More... | |
struct | ad4170_channel_map |
Channel_Map register settings. Selects Analog Inputs for This Sequencer Channel. More... | |
struct | ad4170_misc |
Misc register settings. More... | |
struct | ad4170_afe |
AFE register settings. More... | |
struct | ad4170_filter |
Filter register settings. More... | |
struct | ad4170_setup |
Sequencer Setup register settings. More... | |
struct | ad4170_ref_control |
Ref_Control register settings. More... | |
struct | ad4170_current_source |
Current_Source register settings. More... | |
struct | ad4170_fir_control |
FIR_Control register settings. More... | |
struct | ad4170_dac_config |
DAC Config settings (registers HW_LDAC_Mask, HW_Toggle_Mask, Channel_En and DAC_Span) More... | |
struct | ad4170_config |
AD4170 configuration. More... | |
struct | ad4170_spi_settings |
AD4170 SPI settings. More... | |
struct | ad4170_init_param |
AD4170 SPI init paraeter structure, used for initializing the ad4170_dev. More... | |
struct | ad4170_dev |
AD4170 device descriptor. More... | |
Functions | |
int | ad4170_spi_reg_read (struct ad4170_dev *dev, uint32_t reg_addr, uint32_t *reg_data) |
Read device register. | |
int | ad4170_spi_reg_write (struct ad4170_dev *dev, uint32_t reg_addr, uint32_t reg_data) |
Write device register. | |
int | ad4170_spi_reg_write_mask (struct ad4170_dev *dev, uint32_t reg_addr, uint8_t mask, uint32_t reg_data) |
SPI write device register using a mask. | |
int | ad4170_reset_spi_interface (struct ad4170_dev *dev) |
Reset the SPI interface by sending reset sequence to device. | |
int | ad4170_get_data16 (struct ad4170_dev *dev, uint16_t *data) |
Get data from register Data_16b. | |
int | ad4170_get_data16s (struct ad4170_dev *dev, uint16_t *data, uint8_t *status) |
Get data and status from register Data_16b_Status. | |
int | ad4170_get_data24 (struct ad4170_dev *dev, uint32_t *data) |
Get data from register Data_24b. | |
int | ad4170_get_data24s (struct ad4170_dev *dev, uint32_t *data, uint8_t *status) |
Get data and status from register Data_24b_Status. | |
int | ad4170_get_data32 (struct ad4170_dev *dev, uint32_t *data) |
Get data from register Data_32b. | |
int | ad4170_get_ch_data (struct ad4170_dev *dev, uint8_t ch, uint32_t *data) |
Get data from register Data_Per_Channel[n]. | |
int | ad4170_read16 (struct ad4170_dev *dev, uint32_t *pbuf, uint16_t nb_samples) |
Read multiple samples using direct register access from Data_16b. | |
int | ad4170_read16s (struct ad4170_dev *dev, uint32_t *pbuf, uint16_t nb_samples) |
Read multiple samples using direct register access from Data_16b_Status. | |
int | ad4170_read24 (struct ad4170_dev *dev, uint32_t *pbuf, uint16_t nb_samples) |
Read multiple samples using direct register access from Data_24. | |
int | ad4170_read24s (struct ad4170_dev *dev, uint32_t *pbuf, uint16_t nb_samples) |
Read multiple samples using direct register access from Data_24_Status. | |
int | ad4170_read32 (struct ad4170_dev *dev, uint32_t *pbuf, uint16_t nb_samples) |
Read multiple samples using direct register access from Data_32b. | |
int | ad4170_continuous_read (struct ad4170_dev *dev, uint32_t *data_out, uint8_t *status_out, uint16_t nb_samples) |
Read multiple samples in continuous read mode. | |
int | ad4170_continuous_read_exit (struct ad4170_dev *dev) |
Exit continuous read mode. | |
int | ad4170_continuous_transmit_exit (struct ad4170_dev *dev) |
Exit continuous transmit mode. | |
int | ad4170_reset (struct ad4170_dev *dev) |
Perform a software reset. | |
int | ad4170_get_status (struct ad4170_dev *dev, uint16_t *status) |
Get status from register Data_Status. | |
int | ad4170_set_pin_muxing (struct ad4170_dev *dev, struct ad4170_pin_muxing pin_muxing) |
Set the AD4170 Pin Muxing settings. | |
int | ad4170_set_dclk_div (struct ad4170_dev *dev, enum ad4170_dclk_div clk_div) |
Set the AD4170 DCLK configuration. | |
int | ad4170_set_mclk_div (struct ad4170_dev *dev, enum ad4170_mclk_div clk_div) |
Set the AD4170 MCLK configuration. | |
int | ad4170_set_clocksel (struct ad4170_dev *dev, enum ad4170_clocksel sel) |
Set the AD4170 clock selection configuration. | |
int | ad4170_set_standby_ctrl (struct ad4170_dev *dev, uint16_t standby_ctrl) |
Set the AD4170 Standby control settings. | |
int | ad4170_set_powerdown_sw (struct ad4170_dev *dev, uint16_t powerdown_sw) |
Set the AD4170 Powerdown switches settings. | |
int | ad4170_set_error_en (struct ad4170_dev *dev, uint16_t error_en) |
Set the AD4170 Error enable settings. | |
int | ad4170_set_error (struct ad4170_dev *dev, uint16_t error) |
Set the Error register with a value to clear specific errors. | |
int | ad4170_get_error (struct ad4170_dev *dev, uint16_t *error) |
Get the Error register. | |
int | ad4170_set_adc_ctrl (struct ad4170_dev *dev, struct ad4170_adc_ctrl adc_ctrl) |
Set the AD4170 ADC Control. | |
int | ad4170_set_channel_en (struct ad4170_dev *dev, uint16_t channel_en) |
Enable AD4170 channels. | |
int | ad4170_set_channel_setup (struct ad4170_dev *dev, uint8_t ch, struct ad4170_channel_setup setup) |
Set the AD4170 Channel specific setup. | |
int | ad4170_set_channel_map (struct ad4170_dev *dev, uint8_t ch, struct ad4170_channel_map map) |
Set the AD4170 Channel specific map. | |
int | ad4170_set_setup (struct ad4170_dev *dev, uint8_t n, struct ad4170_setup setup) |
Configure an ADC setup. | |
int | ad4170_set_ref_control (struct ad4170_dev *dev, bool enable) |
Set the AD4170 Ref Control. | |
int | ad4170_set_v_bias (struct ad4170_dev *dev, uint16_t ch_mask) |
Set the AD4170 Voltage bias. | |
int | ad4170_set_i_pullup (struct ad4170_dev *dev, uint16_t ch_mask) |
Set the AD4170 Input pullup. | |
int | ad4170_set_current_source (struct ad4170_dev *dev, uint8_t n, struct ad4170_current_source current_source) |
Set the AD4170 Excitation Current. | |
int | ad4170_set_fir_control (struct ad4170_dev *dev, struct ad4170_fir_control fir_control) |
Set the AD4170 FIR control settings. | |
int | ad4170_set_dac_config (struct ad4170_dev *dev, struct ad4170_dac_config config) |
Set the AD4170 DAC settings. | |
int | ad4170_set_dac_data (struct ad4170_dev *dev, uint16_t code) |
Set the AD4170 DAC data by directly writing the DAT_DATA register. | |
int | ad4170_set_dac_inputa (struct ad4170_dev *dev, uint16_t code) |
Set the AD4170 DAC data by writing the INPUTA register to be loaded separately by LDAC or Toggle operations. | |
int | ad4170_set_dac_inputb (struct ad4170_dev *dev, uint16_t code) |
Set the AD4170 DAC data by writing the INPUTB register to be loaded separately by LDAC or Toggle operations. | |
int | ad4170_dac_sw_ldac (struct ad4170_dev *dev, bool polarity) |
Perform a software LDAC. | |
int | ad4170_dac_sw_toggle (struct ad4170_dev *dev, bool polarity) |
Perform a software toggle. | |
int | ad4170_dac_hw_toggle (struct ad4170_dev *dev, bool polarity) |
Perform a hardware toggle using the DIG_AUX2 pin, assumed to be pre-configured for this. | |
int | ad4170_init (struct ad4170_dev **device, struct ad4170_init_param *init_param) |
Initialize an AD4170 device structure. | |
int | ad4170_remove (struct ad4170_dev *dev) |
Remove the device and free al the resources. | |
int | ad4170_regmap (struct ad4170_dev *dev) |
Debugging function to print the register map to console. | |
Variables | |
struct ad4170_config | ad4170_config_reset |
Header file for the ad4170 driver.
Copyright 2020, 2023(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AD4170_ADC_CTRL_CONT_READ_STATUS_EN_MSK NO_OS_BIT(6) |
#define AD4170_ADC_CTRL_MULTI_DATA_REG_SEL_MSK NO_OS_BIT(7) |
#define AD4170_ADC_CTRL_PARALLEL_FILT_EN_MSK NO_OS_BIT(8) |
#define AD4170_ADC_SETUPS_AFE_BIPOLAR_MSK NO_OS_BIT(4) |
#define AD4170_ADC_SETUPS_AFE_PGA_GAIN_MSK NO_OS_GENMASK(3,0) |
#define AD4170_ADC_SETUPS_AFE_REF_BUF_M_MSK NO_OS_GENMASK(11,10) |
#define AD4170_ADC_SETUPS_AFE_REF_BUF_P_MSK NO_OS_GENMASK(9,8) |
#define AD4170_ADC_SETUPS_AFE_REF_SELECT_MSK NO_OS_GENMASK(6,5) |
#define AD4170_ADC_SETUPS_FILTER_TYPE_MSK NO_OS_GENMASK(3,0) |
#define AD4170_ADC_SETUPS_MISC_BURNOUT_MSK NO_OS_GENMASK(1,0) |
#define AD4170_ADC_SETUPS_MISC_CHOP_ADC_MSK NO_OS_GENMASK(9,8) |
#define AD4170_ADC_SETUPS_MISC_CHOP_IEXC_MSK NO_OS_GENMASK(15,14) |
#define AD4170_ADC_SETUPS_POST_FILTER_SEL_MSK NO_OS_GENMASK(7,4) |
#define AD4170_ADDR | ( | x | ) |
#define AD4170_ADDR_ASCENSION_MSK NO_OS_BIT(5) |
#define AD4170_CHANNEL | ( | ch | ) |
#define AD4170_CHANNEL_MAPN_AINM_MSK NO_OS_GENMASK(4,0) |
#define AD4170_CHANNEL_MAPN_AINP_MSK NO_OS_GENMASK(12,8) |
#define AD4170_CHANNEL_SETUPN_DELAY_N_MSK NO_OS_GENMASK(6,4) |
#define AD4170_CHANNEL_SETUPN_REPEAT_N_MSK NO_OS_GENMASK(15,8) |
#define AD4170_CHANNEL_SETUPN_SETUP_N_MSK NO_OS_GENMASK(2,0) |
#define AD4170_CLOCK_CTRL_CLOCKDIV_MSK NO_OS_GENMASK(5,4) |
#define AD4170_CLOCK_CTRL_CLOCKSEL_MSK NO_OS_GENMASK(1,0) |
#define AD4170_CLOCK_CTRL_DCLK_DIVIDE_MSK NO_OS_GENMASK(7,6) |
#define AD4170_CRC8_INITIAL_VALUE 0xA5 |
#define AD4170_CRC8_POLYNOMIAL 0x7 |
#define AD4170_CURRENT_SOURCE_I_OUT_PIN_MSK NO_OS_GENMASK(12,8) |
#define AD4170_CURRENT_SOURCE_I_OUT_VAL_MSK NO_OS_GENMASK(2,0) |
#define AD4170_DATA_STATUS_CH_ACTIVE_MSK NO_OS_GENMASK(3,0) |
#define AD4170_DATA_STATUS_MASTER_ERR_S_MSK NO_OS_BIT(7) |
#define AD4170_DATA_STATUS_POR_FLAG_S_MSK NO_OS_BIT(6) |
#define AD4170_DATA_STATUS_RDYB_MSK NO_OS_BIT(5) |
#define AD4170_DATA_STATUS_SETTLED_FIR_MSK NO_OS_BIT(4) |
#define AD4170_ERROR_ADC_CONV_ERR_MSK NO_OS_BIT(3) |
#define AD4170_ERROR_AINM_OV_UV_ERR_MSK NO_OS_BIT(5) |
#define AD4170_ERROR_AINP_OV_UV_ERR_MSK NO_OS_BIT(4) |
#define AD4170_ERROR_ALDO_PSM_ERR_MSK NO_OS_BIT(12) |
#define AD4170_ERROR_DEVICE_ERROR_MSK NO_OS_BIT(15) |
#define AD4170_ERROR_DLDO_PSM_ERR_MSK NO_OS_BIT(13) |
#define AD4170_ERROR_IOUT0_COMP_ERR_MSK NO_OS_BIT(8) |
#define AD4170_ERROR_IOUT1_COMP_ERR_MSK NO_OS_BIT(9) |
#define AD4170_ERROR_IOUT2_COMP_ERR_MSK NO_OS_BIT(10) |
#define AD4170_ERROR_IOUT3_COMP_ERR_MSK NO_OS_BIT(11) |
#define AD4170_ERROR_MM_CRC_ERR_MSK NO_OS_BIT(1) |
#define AD4170_ERROR_REF_DIFF_MIN_ERR_MSK NO_OS_BIT(7) |
#define AD4170_ERROR_REF_OV_UV_ERR_MSK NO_OS_BIT(6) |
#define AD4170_ERROR_ROM_CRC_ERR_MSK NO_OS_BIT(0) |
#define AD4170_FIR_COEFF_MAX_LENGTH 72 |
#define AD4170_FIR_CONTROL_COEFF_SET_MSK NO_OS_BIT(10) |
#define AD4170_FIR_CONTROL_FIR_LENGTH_MSK NO_OS_GENMASK(6,0) |
#define AD4170_FIR_CONTROL_FIR_MODE_MSK NO_OS_GENMASK(14,12) |
#define AD4170_FIR_CONTROL_IIR_MODE_MSK NO_OS_BIT(15) |
#define AD4170_INTERFACE_CONFIG_B_SHORT_INSTRUCTION | ( | x | ) |
#define AD4170_INTERFACE_CONFIG_B_SHORT_INSTRUCTION_MSK NO_OS_BIT(3) |
#define AD4170_INTERFACE_CONFIG_B_SINGLE_INST_MSK NO_OS_BIT(7) |
#define AD4170_INTERFACE_CONFIG_C_CRC | ( | x | ) |
#define AD4170_INTERFACE_CONFIG_C_CRC_MSK (NO_OS_BIT(7) | NO_OS_BIT(6) | NO_OS_BIT(1) | NO_OS_BIT(0)) |
#define AD4170_INTERFACE_CONFIG_C_STRICT_REG_ACCESS | ( | x | ) |
#define AD4170_INTERFACE_CONFIG_C_STRICT_REG_ACCESS_MSK NO_OS_BIT(5) |
#define AD4170_INTERFACE_STATUS_A_ADDR_INVALID_ERR_MSK NO_OS_BIT(0) |
#define AD4170_INTERFACE_STATUS_A_CLOCK_COUNT_ERR_MSK NO_OS_BIT(4) |
#define AD4170_INTERFACE_STATUS_A_CRC_ERR_MSK NO_OS_BIT(3) |
#define AD4170_INTERFACE_STATUS_A_INVALID_ACCESS_ERR_MSK NO_OS_BIT(2) |
#define AD4170_INTERFACE_STATUS_A_NOT_READY_ERR_MSK NO_OS_BIT(7) |
#define AD4170_INTERFACE_STATUS_A_PARTIAL_ACCESS_ERR_MSK NO_OS_BIT(1) |
#define AD4170_NUM_CHANNELS 16 |
#define AD4170_NUM_CURRENT_SOURCE 4 |
#define AD4170_NUM_SETUPS 8 |
#define AD4170_PIN_MUXING_CHAN_TO_GPIO_MSK NO_OS_BIT(14) |
#define AD4170_PIN_MUXING_DIG_AUX1_CTRL_MSK NO_OS_GENMASK(5,4) |
#define AD4170_PIN_MUXING_DIG_AUX2_CTRL_MSK NO_OS_GENMASK(7,6) |
#define AD4170_PIN_MUXING_DIG_OUT_STR_MSK NO_OS_BIT(1) |
#define AD4170_PIN_MUXING_SDO_RDBY_DLY_MSK NO_OS_BIT(0) |
#define AD4170_PIN_MUXING_SYNC_CTRL_MSK NO_OS_GENMASK(3,2) |
#define AD4170_POWER_DOWN_SW_PDSW0_MSK NO_OS_BIT(0) |
#define AD4170_POWER_DOWN_SW_PDSW1_MSK NO_OS_BIT(1) |
#define AD4170_PRODUCT_ID_H_VALUE 0x0 |
#define AD4170_PRODUCT_ID_L_VALUE 0x40 |
#define AD4170_R1B (1ul << 16) |
#define AD4170_R2B (2ul << 16) |
#define AD4170_R3B (3ul << 16) |
#define AD4170_R4B (4ul << 16) |
#define AD4170_REF_CONTROL_REF_EN_MSK NO_OS_BIT(0) |
#define AD4170_REG_ADC_CHANNEL_MAP | ( | ch | ) |
#define AD4170_REG_ADC_CHANNEL_SETUP | ( | ch | ) |
#define AD4170_REG_ADC_CTRL (AD4170_R2B | 0x70) |
#define AD4170_REG_ADC_SETUPS_AFE | ( | n | ) |
#define AD4170_REG_ADC_SETUPS_FILTER | ( | n | ) |
#define AD4170_REG_ADC_SETUPS_FILTER_FS | ( | n | ) |
#define AD4170_REG_ADC_SETUPS_GAIN | ( | n | ) |
#define AD4170_REG_ADC_SETUPS_MISC | ( | n | ) |
#define AD4170_REG_ADC_SETUPS_OFFSET | ( | n | ) |
#define AD4170_REG_CHANNEL_EN (AD4170_R2B | 0x78) |
#define AD4170_REG_CHIP_GRADE (AD4170_R1B | 0x06) |
#define AD4170_REG_CHIP_TYPE (AD4170_R1B | 0x03) |
#define AD4170_REG_CLOCK_CTRL (AD4170_R2B | 0x6a) |
#define AD4170_REG_COEFF_ADDRESS (AD4170_R2B | 0x14b) |
#define AD4170_REG_COEFF_READ_DATA (AD4170_R4B | 0x147) |
#define AD4170_REG_COEFF_WRITE_DATA (AD4170_R4B | 0x143) |
#define AD4170_REG_COEFF_WRRD_STB (AD4170_R2B | 0x14d) |
#define AD4170_REG_CTRL_CONT_READ_MSK NO_OS_GENMASK(5,4) |
#define AD4170_REG_CTRL_MODE_MSK NO_OS_GENMASK(3,0) |
#define AD4170_REG_CURRENT_SOURCE | ( | n | ) |
#define AD4170_REG_DAC_CHANNEL_EN (AD4170_R2B | 0x152) |
#define AD4170_REG_DAC_CHANNEL_EN_DAC_EN_MSK NO_OS_BIT(0) |
#define AD4170_REG_DAC_DATA | ( | ch | ) |
#define AD4170_REG_DAC_DATA_MSK NO_OS_GENMASK(11,0) |
#define AD4170_REG_DAC_HW_LDAC_MASK (AD4170_R2B | 0x156) |
#define AD4170_REG_DAC_HW_LDAC_MASK_HW_LDAC_EN_MSK NO_OS_BIT(0) |
#define AD4170_REG_DAC_HW_TOGGLE_MASK (AD4170_R2B | 0x154) |
#define AD4170_REG_DAC_HW_TOGGLE_MASK_HW_TOGGLE_EN_MSK NO_OS_BIT(0) |
#define AD4170_REG_DAC_INPUTA | ( | ch | ) |
#define AD4170_REG_DAC_INPUTB | ( | ch | ) |
#define AD4170_REG_DAC_SPAN (AD4170_R2B | 0x150) |
#define AD4170_REG_DAC_SPAN_DAC_GAIN_MSK NO_OS_BIT(0) |
#define AD4170_REG_DAC_SW_LDAC_TRIGGERS (AD4170_R2B | 0x16a) |
#define AD4170_REG_DAC_SW_LDAC_TRIGGERS_SW_LDAC_EN_MSK NO_OS_BIT(0) |
#define AD4170_REG_DAC_SW_TOGGLE_TRIGGERS (AD4170_R2B | 0x168) |
#define AD4170_REG_DAC_SW_TOGGLE_TRIGGERS_SW_TOGGLE_MSK NO_OS_BIT(0) |
#define AD4170_REG_DATA_16b (AD4170_R2B | 0x16) |
#define AD4170_REG_DATA_16b_STATUS (AD4170_R3B | 0x18) |
#define AD4170_REG_DATA_24b (AD4170_R3B | 0x1c) |
#define AD4170_REG_DATA_24b_STATUS (AD4170_R4B | 0x20) |
#define AD4170_REG_DATA_32b (AD4170_R4B | 0x24) |
#define AD4170_REG_DATA_PER_CHANNEL | ( | ch | ) |
#define AD4170_REG_DATA_STATUS (AD4170_R2B | 0x14) |
#define AD4170_REG_DEVICE_CONFIG (AD4170_R1B | 0x02) |
#define AD4170_REG_ERROR (AD4170_R2B | 0x74) |
#define AD4170_REG_ERROR_EN (AD4170_R2B | 0x72) |
#define AD4170_REG_FIR_CONTROL (AD4170_R2B | 0x140) |
#define AD4170_REG_GPIO_MODE (AD4170_R2B | 0x190) |
#define AD4170_REG_I_PULLUP (AD4170_R2B | 0x136) |
#define AD4170_REG_INPUT_DATA (AD4170_R2B | 0x194) |
#define AD4170_REG_INTERFACE_CONFIG_A (AD4170_R1B | 0x00) |
#define AD4170_REG_INTERFACE_CONFIG_B (AD4170_R1B | 0x01) |
#define AD4170_REG_INTERFACE_CONFIG_C (AD4170_R1B | 0x10) |
#define AD4170_REG_INTERFACE_STATUS_A (AD4170_R1B | 0x11) |
#define AD4170_REG_OUTPUT_DATA (AD4170_R2B | 0x192) |
#define AD4170_REG_PIN_MUXING (AD4170_R2B | 0x68) |
#define AD4170_REG_POWER_DOWN_SW (AD4170_R2B | 0x6e) |
#define AD4170_REG_PRODUCT_ID_H (AD4170_R1B | 0x05) |
#define AD4170_REG_PRODUCT_ID_L (AD4170_R1B | 0x04) |
#define AD4170_REG_READ_14 | ( | x | ) |
#define AD4170_REG_READ_6 | ( | x | ) |
#define AD4170_REG_REF_CONTROL (AD4170_R2B | 0x130) |
#define AD4170_REG_SCRATCH_PAD (AD4170_R1B | 0x0a) |
#define AD4170_REG_SPI_REVISION (AD4170_R1B | 0x0b) |
#define AD4170_REG_STANDBY_CTRL (AD4170_R2B | 0x6c) |
#define AD4170_REG_V_BIAS (AD4170_R2B | 0x134) |
#define AD4170_REG_VENDOR_H (AD4170_R1B | 0x0d) |
#define AD4170_REG_VENDOR_L (AD4170_R1B | 0x0c) |
#define AD4170_REG_WRITE_14 | ( | x | ) |
#define AD4170_REG_WRITE_6 | ( | x | ) |
#define AD4170_SDO_ENABLE_MSK NO_OS_BIT(4) |
#define AD4170_SPI_SYNC_PATTERN 0x2645 |
#define AD4170_STANDBY_CTRL_STB_EN_CLOCK_MSK NO_OS_BIT(8) |
#define AD4170_STANDBY_CTRL_STB_EN_DAC_MSK NO_OS_BIT(5) |
#define AD4170_STANDBY_CTRL_STB_EN_DIAGNOSTICS_MSK NO_OS_BIT(6) |
#define AD4170_STANDBY_CTRL_STB_EN_IEXC_MSK NO_OS_BIT(1) |
#define AD4170_STANDBY_CTRL_STB_EN_IPULLUP_MSK NO_OS_BIT(7) |
#define AD4170_STANDBY_CTRL_STB_EN_PDSW0_MSK NO_OS_BIT(3) |
#define AD4170_STANDBY_CTRL_STB_EN_PDSW1_MSK NO_OS_BIT(4) |
#define AD4170_STANDBY_CTRL_STB_EN_REFERENCE_MSK NO_OS_BIT(0) |
#define AD4170_STANDBY_CTRL_STB_EN_VBIAS_MSK NO_OS_BIT(2) |
#define AD4170_SW_RESET_MSK NO_OS_BIT(7) |
#define AD4170_SW_RESETX_MSK NO_OS_BIT(0) |
#define AD4170_TRANSF_LEN | ( | x | ) |
#define AD4190_PRODUCT_ID_H_VALUE 0x0 |
#define AD4190_PRODUCT_ID_L_VALUE 0x48 |
#define ECOMM 70 |
enum ad4170_ain |
Multiplexer Positive/Negative Input for This Channel.
enum ad4170_burnout |
enum ad4170_chan_to_gpio |
enum ad4170_chop_adc |
enum ad4170_chop_iexc |
Excitation Current Chopping Control.
enum ad4170_clocksel |
enum ad4170_cont_read |
Configures continuous Data Register Read/Transmit.
enum ad4170_dac_gain |
enum ad4170_dclk_div |
enum ad4170_delay_n |
Delay to Add After Channel Switch.
enum ad4170_dig_aux1_ctrl |
Configures Functionality of DIG_AUX1 Pin.
enum ad4170_dig_aux2_ctrl |
Configures Functionality of DIG_AUX2 Pin.
enum ad4170_dig_out_str |
enum ad4170_filter_type |
enum ad4170_fir_coeff_set |
enum ad4170_fir_mode |
Selects FIR Type.
enum ad4170_i_out_pin |
Current Source Destination.
enum ad4170_i_out_val |
enum ad4170_id |
enum ad4170_mclk_div |
enum ad4170_mode |
ADC Operating Mode.
enum ad4170_pga_gain |
PGA Gain Selection.
enum ad4170_post_filter |
Optional Post-Filter configuration.
enum ad4170_ref_buf |
enum ad4170_ref_select |
enum ad4170_sdo_rdby_dly |
enum ad4170_sync_ctrl |
int ad4170_continuous_read | ( | struct ad4170_dev * | dev, |
uint32_t * | data_out, | ||
uint8_t * | status_out, | ||
uint16_t | nb_samples ) |
Read multiple samples in continuous read mode.
dev | - The device structure. |
data_out | - Output pointer where to store the data values. |
status_out | - Output pointer where to store the status values. |
nb_samples | - The number of samples to read. |
int ad4170_continuous_read_exit | ( | struct ad4170_dev * | dev | ) |
Exit continuous read mode.
dev | - The device structure. |
int ad4170_continuous_transmit_exit | ( | struct ad4170_dev * | dev | ) |
Exit continuous transmit mode.
dev | - The device structure. |
int ad4170_dac_hw_toggle | ( | struct ad4170_dev * | dev, |
bool | polarity ) |
Perform a hardware toggle using the DIG_AUX2 pin, assumed to be pre-configured for this.
dev | - The device structure. |
polarity | - Polarity of the toggle operation. |
int ad4170_dac_sw_ldac | ( | struct ad4170_dev * | dev, |
bool | polarity ) |
Perform a software LDAC.
dev | - The device structure. |
polarity | - Polarity of the LDAC operation. |
int ad4170_dac_sw_toggle | ( | struct ad4170_dev * | dev, |
bool | polarity ) |
Perform a software toggle.
dev | - The device structure. |
polarity | - Polarity of the toggle operation. |
int ad4170_get_ch_data | ( | struct ad4170_dev * | dev, |
uint8_t | ch, | ||
uint32_t * | data ) |
Get data from register Data_Per_Channel[n].
This function assumes Per-Channel ADC Data is enabled, otherwise the output data may contain zeroes.
dev | - The device structure. |
ch | - The channel number (0 to 15) |
data | - Output pointer where to store the data value. |
int ad4170_get_data16 | ( | struct ad4170_dev * | dev, |
uint16_t * | data ) |
Get data from register Data_16b.
dev | - The device structure. |
data | - Output pointer where to store the data value. |
int ad4170_get_data16s | ( | struct ad4170_dev * | dev, |
uint16_t * | data, | ||
uint8_t * | status ) |
Get data and status from register Data_16b_Status.
dev | - The device structure. |
data | - Output pointer where to store the data value. |
status | - Output pointer where to store the status value. |
int ad4170_get_data24 | ( | struct ad4170_dev * | dev, |
uint32_t * | data ) |
Get data from register Data_24b.
dev | - The device structure. |
data | - Output pointer where to store the data value. |
int ad4170_get_data24s | ( | struct ad4170_dev * | dev, |
uint32_t * | data, | ||
uint8_t * | status ) |
Get data and status from register Data_24b_Status.
dev | - The device structure. |
data | - Output pointer where to store the data value. |
status | - Output pointer where to store the status value. |
int ad4170_get_data32 | ( | struct ad4170_dev * | dev, |
uint32_t * | data ) |
Get data from register Data_32b.
dev | - The device structure. |
data | - Output pointer where to store the data value. |
int ad4170_get_error | ( | struct ad4170_dev * | dev, |
uint16_t * | error ) |
Get the Error register.
dev | - The device structure. |
error | - Pointer to where Error register content should be stored. |
int ad4170_get_status | ( | struct ad4170_dev * | dev, |
uint16_t * | status ) |
Get status from register Data_Status.
dev | - The device structure. |
status | - Output pointer where to store the status value. |
int ad4170_init | ( | struct ad4170_dev ** | device, |
struct ad4170_init_param * | init_param ) |
Initialize an AD4170 device structure.
device | - Pointer to the device structure (memory is allocated within this function). |
init_param | - Pointer to the initialization parameters. |
int ad4170_read16 | ( | struct ad4170_dev * | dev, |
uint32_t * | pbuf, | ||
uint16_t | nb_samples ) |
Read multiple samples using direct register access from Data_16b.
dev | - The device structure. |
pbuf | - Output pointer where to store the data values. |
nb_samples | - The number of samples to read. |
int ad4170_read16s | ( | struct ad4170_dev * | dev, |
uint32_t * | pbuf, | ||
uint16_t | nb_samples ) |
Read multiple samples using direct register access from Data_16b_Status.
dev | - The device structure. |
pbuf | - Output pointer where to store the data values. |
nb_samples | - The number of samples to read. |
int ad4170_read24 | ( | struct ad4170_dev * | dev, |
uint32_t * | pbuf, | ||
uint16_t | nb_samples ) |
Read multiple samples using direct register access from Data_24.
dev | - The device structure. |
pbuf | - Output pointer where to store the data values. |
nb_samples | - The number of samples to read. |
int ad4170_read24s | ( | struct ad4170_dev * | dev, |
uint32_t * | pbuf, | ||
uint16_t | nb_samples ) |
Read multiple samples using direct register access from Data_24_Status.
dev | - The device structure. |
pbuf | - Output pointer where to store the data values. |
nb_samples | - The number of samples to read. |
int ad4170_read32 | ( | struct ad4170_dev * | dev, |
uint32_t * | pbuf, | ||
uint16_t | nb_samples ) |
Read multiple samples using direct register access from Data_32b.
dev | - The device structure. |
pbuf | - Output pointer where to store the data values. |
nb_samples | - The number of samples to read. |
int ad4170_regmap | ( | struct ad4170_dev * | dev | ) |
Debugging function to print the register map to console.
dev | - The device structure. |
int ad4170_remove | ( | struct ad4170_dev * | dev | ) |
Remove the device and free al the resources.
dev | - The device structure. |
int ad4170_reset | ( | struct ad4170_dev * | dev | ) |
Perform a software reset.
dev | - The device structure. |
int ad4170_reset_spi_interface | ( | struct ad4170_dev * | dev | ) |
Reset the SPI interface by sending reset sequence to device.
dev | - The device structure. |
int ad4170_set_adc_ctrl | ( | struct ad4170_dev * | dev, |
struct ad4170_adc_ctrl | adc_ctrl ) |
Set the AD4170 ADC Control.
dev | - The device structure. |
adc_ctrl | - AD4170 ADC Control configuration. |
int ad4170_set_channel_en | ( | struct ad4170_dev * | dev, |
uint16_t | channel_en ) |
Enable AD4170 channels.
dev | - The device structure. |
channel_en | - Channel enable mask. |
int ad4170_set_channel_map | ( | struct ad4170_dev * | dev, |
uint8_t | ch, | ||
struct ad4170_channel_map | map ) |
Set the AD4170 Channel specific map.
dev | - The device structure. |
ch | - The channel number (0 to 15). |
map | - AD4170 Channel specific map configuration. |
int ad4170_set_channel_setup | ( | struct ad4170_dev * | dev, |
uint8_t | ch, | ||
struct ad4170_channel_setup | setup ) |
Set the AD4170 Channel specific setup.
dev | - The device structure. |
ch | - The channel number (0 to 15). |
setup | - AD4170 Channel specific setup configuration. |
int ad4170_set_clocksel | ( | struct ad4170_dev * | dev, |
enum ad4170_clocksel | sel ) |
Set the AD4170 clock selection configuration.
dev | - The device structure. |
sel | - AD4170 clock selection configuration. |
int ad4170_set_current_source | ( | struct ad4170_dev * | dev, |
uint8_t | n, | ||
struct ad4170_current_source | current_source ) |
Set the AD4170 Excitation Current.
dev | - The device structure. |
n | - Current source number (0 to 3). |
current_source | - Excitation current confguration. |
int ad4170_set_dac_config | ( | struct ad4170_dev * | dev, |
struct ad4170_dac_config | config ) |
Set the AD4170 DAC settings.
dev | - The device structure. |
config | - The DAC configuration. |
int ad4170_set_dac_data | ( | struct ad4170_dev * | dev, |
uint16_t | code ) |
Set the AD4170 DAC data by directly writing the DAT_DATA register.
dev | - The device structure. |
code | - The DAC code. |
int ad4170_set_dac_inputa | ( | struct ad4170_dev * | dev, |
uint16_t | code ) |
Set the AD4170 DAC data by writing the INPUTA register to be loaded separately by LDAC or Toggle operations.
dev | - The device structure. |
code | - The DAC code. |
int ad4170_set_dac_inputb | ( | struct ad4170_dev * | dev, |
uint16_t | code ) |
Set the AD4170 DAC data by writing the INPUTB register to be loaded separately by LDAC or Toggle operations.
dev | - The device structure. |
code | - The DAC code. |
int ad4170_set_dclk_div | ( | struct ad4170_dev * | dev, |
enum ad4170_dclk_div | div ) |
Set the AD4170 DCLK configuration.
dev | - The device structure. |
div | - AD4170 DCLK configuration. |
int ad4170_set_error | ( | struct ad4170_dev * | dev, |
uint16_t | error ) |
Set the Error register with a value to clear specific errors.
dev | - The device structure. |
error | - Error mask (set bits will be cleared from the Error register). |
int ad4170_set_error_en | ( | struct ad4170_dev * | dev, |
uint16_t | error_en ) |
Set the AD4170 Error enable settings.
dev | - The device structure. |
error_en | - AD4170 Error enable configuration. |
int ad4170_set_fir_control | ( | struct ad4170_dev * | dev, |
struct ad4170_fir_control | fir_control ) |
Set the AD4170 FIR control settings.
dev | - The device structure. |
fir_control | - FIR control configuration. |
int ad4170_set_i_pullup | ( | struct ad4170_dev * | dev, |
uint16_t | ch_mask ) |
Set the AD4170 Input pullup.
dev | - The device structure. |
ch_mask | - Input pullup enable mask. |
int ad4170_set_mclk_div | ( | struct ad4170_dev * | dev, |
enum ad4170_mclk_div | div ) |
Set the AD4170 MCLK configuration.
dev | - The device structure. |
div | - AD4170 MCLK configuration. |
int ad4170_set_pin_muxing | ( | struct ad4170_dev * | dev, |
struct ad4170_pin_muxing | pin_muxing ) |
Set the AD4170 Pin Muxing settings.
dev | - The device structure. |
pin_muxing | - AD4170 Pin Muxing configuration. |
int ad4170_set_powerdown_sw | ( | struct ad4170_dev * | dev, |
uint16_t | powerdown_sw ) |
Set the AD4170 Powerdown switches settings.
dev | - The device structure. |
powerdown_sw | - AD4170 Powerdown switches configuration. |
int ad4170_set_ref_control | ( | struct ad4170_dev * | dev, |
bool | enable ) |
Set the AD4170 Ref Control.
dev | - The device structure. |
enable | - Enable/Disable Ref Control. |
int ad4170_set_setup | ( | struct ad4170_dev * | dev, |
uint8_t | n, | ||
struct ad4170_setup | setup ) |
Configure an ADC setup.
dev | - The device structure. |
n | - The setup number (0 to 8). |
setup | - AD4170 setup configuration. |
int ad4170_set_standby_ctrl | ( | struct ad4170_dev * | dev, |
uint16_t | standby_ctrl ) |
Set the AD4170 Standby control settings.
dev | - The device structure. |
standby_ctrl | - AD4170 Standby control configuration. |
int ad4170_set_v_bias | ( | struct ad4170_dev * | dev, |
uint16_t | ch_mask ) |
Set the AD4170 Voltage bias.
dev | - The device structure. |
ch_mask | - Voltage bias enable mask. |
int ad4170_spi_reg_read | ( | struct ad4170_dev * | dev, |
uint32_t | reg_addr, | ||
uint32_t * | reg_data ) |
Read device register.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The data read from the register. |
int ad4170_spi_reg_write | ( | struct ad4170_dev * | dev, |
uint32_t | reg_addr, | ||
uint32_t | reg_data ) |
Write device register.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
int ad4170_spi_reg_write_mask | ( | struct ad4170_dev * | dev, |
uint32_t | reg_addr, | ||
uint8_t | mask, | ||
uint32_t | reg_data ) |
SPI write device register using a mask.
dev | - The device structure. |
reg_addr | - The register address. |
mask | - The mask. |
reg_data | - The register data. |
|
extern |
ad4170_config default state when the chip is hardware/software reset.