no-OS
Functions | Variables
ad4170.c File Reference

Source file for the ad4170 driver. More...

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "no_os_error.h"
#include "no_os_delay.h"
#include "no_os_crc8.h"
#include "ad4170.h"
Include dependency graph for ad4170.c:

Functions

 NO_OS_DECLARE_CRC8_TABLE (ad4170_crc8)
 
int ad4170_spi_reg_read (struct ad4170_dev *dev, uint32_t reg_addr, uint32_t *reg_data)
 Read device register. More...
 
int ad4170_spi_reg_write (struct ad4170_dev *dev, uint32_t reg_addr, uint32_t reg_data)
 Write device register. More...
 
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. More...
 
int ad4170_reset_spi_interface (struct ad4170_dev *dev)
 Reset the SPI interface by sending reset sequence to device. More...
 
int ad4170_get_data16 (struct ad4170_dev *dev, uint16_t *data)
 Get data from register Data_16b. More...
 
int ad4170_get_data16s (struct ad4170_dev *dev, uint16_t *data, uint8_t *status)
 Get data and status from register Data_16b_Status. More...
 
int ad4170_get_data24 (struct ad4170_dev *dev, uint32_t *data)
 Get data from register Data_24b. More...
 
int ad4170_get_data24s (struct ad4170_dev *dev, uint32_t *data, uint8_t *status)
 Get data and status from register Data_24b_Status. More...
 
int ad4170_get_data32 (struct ad4170_dev *dev, uint32_t *data)
 Get data from register Data_32b. More...
 
int ad4170_get_ch_data (struct ad4170_dev *dev, uint8_t ch, uint32_t *data)
 Get data from register Data_Per_Channel[n]. More...
 
int ad4170_get_status (struct ad4170_dev *dev, uint16_t *status)
 Get status from register Data_Status. More...
 
int ad4170_read16 (struct ad4170_dev *dev, uint32_t *pbuf, uint16_t nb_samples)
 Read multiple samples using direct register access from Data_16b. More...
 
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. More...
 
int ad4170_read24 (struct ad4170_dev *dev, uint32_t *pbuf, uint16_t nb_samples)
 Read multiple samples using direct register access from Data_24. More...
 
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. More...
 
int ad4170_read32 (struct ad4170_dev *dev, uint32_t *pbuf, uint16_t nb_samples)
 Read multiple samples using direct register access from Data_32b. More...
 
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. More...
 
int ad4170_continuous_read_exit (struct ad4170_dev *dev)
 Exit continuous read mode. More...
 
int ad4170_continuous_transmit_exit (struct ad4170_dev *dev)
 Exit continuous transmit mode. More...
 
int ad4170_reset (struct ad4170_dev *dev)
 Perform a software reset. More...
 
int ad4170_set_spi_settings (struct ad4170_dev *dev, const struct ad4170_spi_settings *spi_settings)
 Set the AD4170 SPI settings. More...
 
int ad4170_set_pin_muxing (struct ad4170_dev *dev, struct ad4170_pin_muxing pin_muxing)
 Set the AD4170 Pin Muxing settings. More...
 
int ad4170_set_dclk_div (struct ad4170_dev *dev, enum ad4170_dclk_div div)
 Set the AD4170 DCLK configuration. More...
 
int ad4170_set_mclk_div (struct ad4170_dev *dev, enum ad4170_mclk_div div)
 Set the AD4170 MCLK configuration. More...
 
int ad4170_set_clocksel (struct ad4170_dev *dev, enum ad4170_clocksel sel)
 Set the AD4170 clock selection configuration. More...
 
int ad4170_set_standby_ctrl (struct ad4170_dev *dev, uint16_t standby_ctrl)
 Set the AD4170 Standby control settings. More...
 
int ad4170_set_powerdown_sw (struct ad4170_dev *dev, uint16_t powerdown_sw)
 Set the AD4170 Powerdown switches settings. More...
 
int ad4170_set_error_en (struct ad4170_dev *dev, uint16_t error_en)
 Set the AD4170 Error enable settings. More...
 
int ad4170_set_error (struct ad4170_dev *dev, uint16_t error)
 Set the Error register with a value to clear specific errors. More...
 
int ad4170_get_error (struct ad4170_dev *dev, uint16_t *error)
 Get the Error register. More...
 
int ad4170_set_adc_ctrl (struct ad4170_dev *dev, struct ad4170_adc_ctrl adc_ctrl)
 Set the AD4170 ADC Control. More...
 
int ad4170_set_channel_en (struct ad4170_dev *dev, uint16_t channel_en)
 Enable AD4170 channels. More...
 
int ad4170_set_channel_setup (struct ad4170_dev *dev, uint8_t ch, struct ad4170_channel_setup setup)
 Set the AD4170 Channel specific setup. More...
 
int ad4170_set_channel_map (struct ad4170_dev *dev, uint8_t ch, struct ad4170_channel_map map)
 Set the AD4170 Channel specific map. More...
 
int ad4170_set_setup (struct ad4170_dev *dev, uint8_t n, struct ad4170_setup setup)
 Configure an ADC setup. More...
 
int ad4170_set_ref_control (struct ad4170_dev *dev, bool enable)
 Set the AD4170 Ref Control. More...
 
int ad4170_set_v_bias (struct ad4170_dev *dev, uint16_t ch_mask)
 Set the AD4170 Voltage bias. More...
 
int ad4170_set_i_pullup (struct ad4170_dev *dev, uint16_t ch_mask)
 Set the AD4170 Input pullup. More...
 
int ad4170_set_current_source (struct ad4170_dev *dev, uint8_t n, struct ad4170_current_source current_source)
 Set the AD4170 Excitation Current. More...
 
int ad4170_set_fir_control (struct ad4170_dev *dev, struct ad4170_fir_control fir_control)
 Set the AD4170 FIR control settings. More...
 
int ad4170_set_dac_config (struct ad4170_dev *dev, struct ad4170_dac_config config)
 Set the AD4170 DAC settings. More...
 
int ad4170_set_dac_data (struct ad4170_dev *dev, uint16_t code)
 Set the AD4170 DAC data by directly writing the DAT_DATA register. More...
 
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. More...
 
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. More...
 
int ad4170_dac_sw_ldac (struct ad4170_dev *dev, bool polarity)
 Perform a software LDAC. More...
 
int ad4170_dac_sw_toggle (struct ad4170_dev *dev, bool polarity)
 Perform a software toggle. More...
 
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. More...
 
int ad4170_init (struct ad4170_dev **device, struct ad4170_init_param *init_param)
 Initialize an AD4170 device structure. More...
 
int ad4170_remove (struct ad4170_dev *dev)
 Remove the device and free al the resources. More...
 
int ad4170_regmap (struct ad4170_dev *dev)
 Debugging function to print the register map to console. More...
 

Variables

struct ad4170_config ad4170_config_reset
 

Detailed Description

Source file for the ad4170 driver.

Author
Darius Berghe (dariu.nosp@m.s.be.nosp@m.rghe@.nosp@m.anal.nosp@m.og.co.nosp@m.m)
Janani Sunil (janan.nosp@m.i.su.nosp@m.nil@a.nosp@m.nalo.nosp@m.g.com)
Mahesh Phalke (mahes.nosp@m.h.ph.nosp@m.alke@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

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:

  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.

Function Documentation

◆ ad4170_continuous_read()

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.

Parameters
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.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_continuous_read_exit()

int ad4170_continuous_read_exit ( struct ad4170_dev dev)

Exit continuous read mode.

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

◆ ad4170_continuous_transmit_exit()

int ad4170_continuous_transmit_exit ( struct ad4170_dev dev)

Exit continuous transmit mode.

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

◆ ad4170_dac_hw_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.

Parameters
dev- The device structure.
polarity- Polarity of the toggle operation.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_dac_sw_ldac()

int ad4170_dac_sw_ldac ( struct ad4170_dev dev,
bool  polarity 
)

Perform a software LDAC.

Parameters
dev- The device structure.
polarity- Polarity of the LDAC operation.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_dac_sw_toggle()

int ad4170_dac_sw_toggle ( struct ad4170_dev dev,
bool  polarity 
)

Perform a software toggle.

Parameters
dev- The device structure.
polarity- Polarity of the toggle operation.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_get_ch_data()

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.

Parameters
dev- The device structure.
ch- The channel number (0 to 15)
data- Output pointer where to store the data value.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_get_data16()

int ad4170_get_data16 ( struct ad4170_dev dev,
uint16_t *  data 
)

Get data from register Data_16b.

Parameters
dev- The device structure.
data- Output pointer where to store the data value.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_get_data16s()

int ad4170_get_data16s ( struct ad4170_dev dev,
uint16_t *  data,
uint8_t *  status 
)

Get data and status from register Data_16b_Status.

Parameters
dev- The device structure.
data- Output pointer where to store the data value.
status- Output pointer where to store the status value.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_get_data24()

int ad4170_get_data24 ( struct ad4170_dev dev,
uint32_t *  data 
)

Get data from register Data_24b.

Parameters
dev- The device structure.
data- Output pointer where to store the data value.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_get_data24s()

int ad4170_get_data24s ( struct ad4170_dev dev,
uint32_t *  data,
uint8_t *  status 
)

Get data and status from register Data_24b_Status.

Parameters
dev- The device structure.
data- Output pointer where to store the data value.
status- Output pointer where to store the status value.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_get_data32()

int ad4170_get_data32 ( struct ad4170_dev dev,
uint32_t *  data 
)

Get data from register Data_32b.

Parameters
dev- The device structure.
data- Output pointer where to store the data value.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_get_error()

int ad4170_get_error ( struct ad4170_dev dev,
uint16_t *  error 
)

Get the Error register.

Parameters
dev- The device structure.
error- Pointer to where Error register content should be stored.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_get_status()

int ad4170_get_status ( struct ad4170_dev dev,
uint16_t *  status 
)

Get status from register Data_Status.

Parameters
dev- The device structure.
status- Output pointer where to store the status value.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_init()

int ad4170_init ( struct ad4170_dev **  device,
struct ad4170_init_param init_param 
)

Initialize an AD4170 device structure.

Parameters
device- Pointer to the device structure (memory is allocated within this function).
init_param- Pointer to the initialization parameters.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_read16()

int ad4170_read16 ( struct ad4170_dev dev,
uint32_t *  pbuf,
uint16_t  nb_samples 
)

Read multiple samples using direct register access from Data_16b.

Parameters
dev- The device structure.
pbuf- Output pointer where to store the data values.
nb_samples- The number of samples to read.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_read16s()

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.

Parameters
dev- The device structure.
pbuf- Output pointer where to store the data values.
nb_samples- The number of samples to read.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_read24()

int ad4170_read24 ( struct ad4170_dev dev,
uint32_t *  pbuf,
uint16_t  nb_samples 
)

Read multiple samples using direct register access from Data_24.

Parameters
dev- The device structure.
pbuf- Output pointer where to store the data values.
nb_samples- The number of samples to read.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_read24s()

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.

Parameters
dev- The device structure.
pbuf- Output pointer where to store the data values.
nb_samples- The number of samples to read.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_read32()

int ad4170_read32 ( struct ad4170_dev dev,
uint32_t *  pbuf,
uint16_t  nb_samples 
)

Read multiple samples using direct register access from Data_32b.

Parameters
dev- The device structure.
pbuf- Output pointer where to store the data values.
nb_samples- The number of samples to read.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_regmap()

int ad4170_regmap ( struct ad4170_dev dev)

Debugging function to print the register map to console.

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

◆ ad4170_remove()

int ad4170_remove ( struct ad4170_dev dev)

Remove the device and free al the resources.

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

◆ ad4170_reset()

int ad4170_reset ( struct ad4170_dev dev)

Perform a software reset.

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

◆ ad4170_reset_spi_interface()

int ad4170_reset_spi_interface ( struct ad4170_dev dev)

Reset the SPI interface by sending reset sequence to device.

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

◆ ad4170_set_adc_ctrl()

int ad4170_set_adc_ctrl ( struct ad4170_dev dev,
struct ad4170_adc_ctrl  adc_ctrl 
)

Set the AD4170 ADC Control.

Parameters
dev- The device structure.
adc_ctrl- AD4170 ADC Control configuration.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_channel_en()

int ad4170_set_channel_en ( struct ad4170_dev dev,
uint16_t  channel_en 
)

Enable AD4170 channels.

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

◆ ad4170_set_channel_map()

int ad4170_set_channel_map ( struct ad4170_dev dev,
uint8_t  ch,
struct ad4170_channel_map  map 
)

Set the AD4170 Channel specific map.

Parameters
dev- The device structure.
ch- The channel number (0 to 15).
map- AD4170 Channel specific map configuration.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_channel_setup()

int ad4170_set_channel_setup ( struct ad4170_dev dev,
uint8_t  ch,
struct ad4170_channel_setup  setup 
)

Set the AD4170 Channel specific setup.

Parameters
dev- The device structure.
ch- The channel number (0 to 15).
setup- AD4170 Channel specific setup configuration.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_clocksel()

int ad4170_set_clocksel ( struct ad4170_dev dev,
enum ad4170_clocksel  sel 
)

Set the AD4170 clock selection configuration.

Parameters
dev- The device structure.
sel- AD4170 clock selection configuration.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_current_source()

int ad4170_set_current_source ( struct ad4170_dev dev,
uint8_t  n,
struct ad4170_current_source  current_source 
)

Set the AD4170 Excitation Current.

Parameters
dev- The device structure.
n- Current source number (0 to 3).
current_source- Excitation current confguration.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_dac_config()

int ad4170_set_dac_config ( struct ad4170_dev dev,
struct ad4170_dac_config  config 
)

Set the AD4170 DAC settings.

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

◆ ad4170_set_dac_data()

int ad4170_set_dac_data ( struct ad4170_dev dev,
uint16_t  code 
)

Set the AD4170 DAC data by directly writing the DAT_DATA register.

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

◆ ad4170_set_dac_inputa()

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.

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

◆ ad4170_set_dac_inputb()

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.

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

◆ ad4170_set_dclk_div()

int ad4170_set_dclk_div ( struct ad4170_dev dev,
enum ad4170_dclk_div  div 
)

Set the AD4170 DCLK configuration.

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

◆ ad4170_set_error()

int ad4170_set_error ( struct ad4170_dev dev,
uint16_t  error 
)

Set the Error register with a value to clear specific errors.

Parameters
dev- The device structure.
error- Error mask (set bits will be cleared from the Error register).
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_error_en()

int ad4170_set_error_en ( struct ad4170_dev dev,
uint16_t  error_en 
)

Set the AD4170 Error enable settings.

Parameters
dev- The device structure.
error_en- AD4170 Error enable configuration.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_fir_control()

int ad4170_set_fir_control ( struct ad4170_dev dev,
struct ad4170_fir_control  fir_control 
)

Set the AD4170 FIR control settings.

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

◆ ad4170_set_i_pullup()

int ad4170_set_i_pullup ( struct ad4170_dev dev,
uint16_t  ch_mask 
)

Set the AD4170 Input pullup.

Parameters
dev- The device structure.
ch_mask- Input pullup enable mask.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_mclk_div()

int ad4170_set_mclk_div ( struct ad4170_dev dev,
enum ad4170_mclk_div  div 
)

Set the AD4170 MCLK configuration.

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

◆ ad4170_set_pin_muxing()

int ad4170_set_pin_muxing ( struct ad4170_dev dev,
struct ad4170_pin_muxing  pin_muxing 
)

Set the AD4170 Pin Muxing settings.

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

◆ ad4170_set_powerdown_sw()

int ad4170_set_powerdown_sw ( struct ad4170_dev dev,
uint16_t  powerdown_sw 
)

Set the AD4170 Powerdown switches settings.

Parameters
dev- The device structure.
powerdown_sw- AD4170 Powerdown switches configuration.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_ref_control()

int ad4170_set_ref_control ( struct ad4170_dev dev,
bool  enable 
)

Set the AD4170 Ref Control.

Parameters
dev- The device structure.
enable- Enable/Disable Ref Control.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_setup()

int ad4170_set_setup ( struct ad4170_dev dev,
uint8_t  n,
struct ad4170_setup  setup 
)

Configure an ADC setup.

Parameters
dev- The device structure.
n- The setup number (0 to 8).
setup- AD4170 setup configuration.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_spi_settings()

int ad4170_set_spi_settings ( struct ad4170_dev dev,
const struct ad4170_spi_settings spi_settings 
)

Set the AD4170 SPI settings.

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

◆ ad4170_set_standby_ctrl()

int ad4170_set_standby_ctrl ( struct ad4170_dev dev,
uint16_t  standby_ctrl 
)

Set the AD4170 Standby control settings.

Parameters
dev- The device structure.
standby_ctrl- AD4170 Standby control configuration.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_set_v_bias()

int ad4170_set_v_bias ( struct ad4170_dev dev,
uint16_t  ch_mask 
)

Set the AD4170 Voltage bias.

Parameters
dev- The device structure.
ch_mask- Voltage bias enable mask.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_spi_reg_read()

int ad4170_spi_reg_read ( struct ad4170_dev dev,
uint32_t  reg_addr,
uint32_t *  reg_data 
)

Read device register.

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

◆ ad4170_spi_reg_write()

int ad4170_spi_reg_write ( struct ad4170_dev dev,
uint32_t  reg_addr,
uint32_t  reg_data 
)

Write device register.

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:

◆ ad4170_spi_reg_write_mask()

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.

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

◆ NO_OS_DECLARE_CRC8_TABLE()

NO_OS_DECLARE_CRC8_TABLE ( ad4170_crc8  )

Variable Documentation

◆ ad4170_config_reset

struct ad4170_config ad4170_config_reset

ad4170_config default state when the chip is hardware/software reset.