Implementation of ad713x Driver. More...
#include <stdlib.h>
#include "ad713x.h"
#include "no_os_delay.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
Functions | |
int32_t | ad713x_spi_reg_read (struct ad713x_dev *dev, uint8_t reg_addr, uint8_t *reg_data) |
Read from device. | |
int32_t | ad713x_spi_reg_write (struct ad713x_dev *dev, uint8_t reg_addr, uint8_t reg_data) |
Write to device. | |
int32_t | ad713x_spi_write_mask (struct ad713x_dev *dev, uint8_t reg_addr, uint32_t mask, uint8_t data) |
SPI write to device using a mask. | |
int32_t | ad713x_set_power_mode (struct ad713x_dev *dev, enum ad713x_power_mode mode) |
Device power mode control. | |
int32_t | ad713x_set_out_data_frame (struct ad713x_dev *dev, enum ad713x_adc_data_len adc_data_len, enum ad713x_crc_header crc_header) |
ADC conversion data output frame control. | |
int32_t | ad713x_dout_format_config (struct ad713x_dev *dev, enum ad713x_doutx_format format) |
DOUTx output format configuration. | |
int32_t | ad713x_mag_phase_clk_delay (struct ad713x_dev *dev, bool clk_delay_en) |
Magnitude and phase matching calibration clock delay enable for all channels at 2 clock delay. This function is kept for backwards compatibility with the current application source, but it is deprecated. Use ad713x_mag_phase_clk_delay_chan(). | |
int32_t | ad713x_mag_phase_clk_delay_chan (struct ad713x_dev *dev, enum ad713x_channels chan, enum ad717x_mpc_clkdel mode) |
Change magnitude and phase calibration clock delay mode for a specific channel. | |
int32_t | ad713x_channel_sync (struct ad713x_dev *dev) |
Multidevice synchronization between channels on different devices. | |
int32_t | ad713x_dig_filter_sel_ch (struct ad713x_dev *dev, enum ad713x_dig_filter_sel filter, enum ad713x_channels ch) |
Digital filter type selection for each channel. | |
int32_t | ad713x_clkout_output_en (struct ad713x_dev *dev, bool enable) |
Enable/Disable CLKOUT output. | |
int32_t | ad713x_ref_gain_correction_en (struct ad713x_dev *dev, bool enable) |
Enable/Disable reference gain correction. | |
int32_t | ad713x_wideband_bw_sel (struct ad713x_dev *dev, enum ad713x_channels ch, uint8_t wb_opt) |
Select the wideband filter bandwidth for a channel. The option is relative to ODR, so it's a fraction of it. | |
int32_t | ad713x_init (struct ad713x_dev **device, struct ad713x_init_param *init_param) |
Initialize the device. | |
int32_t | ad713x_remove (struct ad713x_dev *dev) |
Free the resources allocated by ad713x_init(). | |
int32_t | ad713x_spi_reg_dump (struct ad713x_dev *dev) |
Print all registers values for the AD4134 device. Register map has gaps, reg dump function specific for AD4134 dev. | |
Implementation of ad713x Driver.
Copyright 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.
int32_t ad713x_channel_sync | ( | struct ad713x_dev * | dev | ) |
Multidevice synchronization between channels on different devices.
dev | - The device structure. |
int32_t ad713x_clkout_output_en | ( | struct ad713x_dev * | dev, |
bool | enable ) |
Enable/Disable CLKOUT output.
[in] | dev | - The device structure. |
[in] | enable | - true to enable the clkout output; false to disable the clkout output. |
int32_t ad713x_dig_filter_sel_ch | ( | struct ad713x_dev * | dev, |
enum ad713x_dig_filter_sel | filter, | ||
enum ad713x_channels | ch ) |
Digital filter type selection for each channel.
dev | - The device structure. |
filter | - Type of filter: Wideband, Sinc6, Sinc3, Sinc3 filter with simultaneous 50Hz and 60Hz rejection. Accepted values: FIR SINC6 SINC3 SINC3_50_60_REJ |
ch | - Channel to apply the filter to Accepted values: CH0 CH1 CH2 CH3 |
int32_t ad713x_dout_format_config | ( | struct ad713x_dev * | dev, |
enum ad713x_doutx_format | format ) |
DOUTx output format configuration.
dev | - The device structure. |
format | - Single channel daisy chain mode. Dual channel daisy chain mode. Quad channel parallel output mode. Channel data averaging mode. Accepted values: SINGLE_CH_DC DUAL_CH_DC QUAD_CH_PO CH_AVG_MODE |
int32_t ad713x_init | ( | struct ad713x_dev ** | device, |
struct ad713x_init_param * | init_param ) |
Initialize the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t ad713x_mag_phase_clk_delay | ( | struct ad713x_dev * | dev, |
bool | clk_delay_en ) |
Magnitude and phase matching calibration clock delay enable for all channels at 2 clock delay. This function is kept for backwards compatibility with the current application source, but it is deprecated. Use ad713x_mag_phase_clk_delay_chan().
dev | - The device structure. |
clk_delay_en | - Enable or disable Mag/Phase clock delay. Accepted values: true false |
int32_t ad713x_mag_phase_clk_delay_chan | ( | struct ad713x_dev * | dev, |
enum ad713x_channels | chan, | ||
enum ad717x_mpc_clkdel | mode ) |
Change magnitude and phase calibration clock delay mode for a specific channel.
dev | - The device structure. |
chan | - ID of the channel to be changed. Accepted values: CH0, CH1, CH2, CH3 |
mode | - Delay in clock periods. Accepted values: DELAY_NONE, DELAY_1_CLOCKS, DELAY_2_CLOCKS |
int32_t ad713x_ref_gain_correction_en | ( | struct ad713x_dev * | dev, |
bool | enable ) |
Enable/Disable reference gain correction.
[in] | dev | - The device structure. |
[in] | enable | - true to enable the reference gain correction; false to disable the reference gain correction. |
int32_t ad713x_remove | ( | struct ad713x_dev * | dev | ) |
Free the resources allocated by ad713x_init().
dev | - The device structure. |
int32_t ad713x_set_out_data_frame | ( | struct ad713x_dev * | dev, |
enum ad713x_adc_data_len | adc_data_len, | ||
enum ad713x_crc_header | crc_header ) |
ADC conversion data output frame control.
dev | - The device structure. |
adc_data_len | - Data conversion length Accepted values: ADC_16_BIT_DATA ADC_24_BIT_DATA ADC_32_BIT_DATA |
crc_header | - CRC header Accepted values: NO_CRC CRC_6 CRC_8 |
int32_t ad713x_set_power_mode | ( | struct ad713x_dev * | dev, |
enum ad713x_power_mode | mode ) |
Device power mode control.
dev | - The device structure. |
mode | - Type of power mode Accepted values: LOW_POWER HIGH_POWER |
int32_t ad713x_spi_reg_dump | ( | struct ad713x_dev * | dev | ) |
Print all registers values for the AD4134 device. Register map has gaps, reg dump function specific for AD4134 dev.
[in] | dev | - AD713X device handler. |
int32_t ad713x_spi_reg_read | ( | struct ad713x_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 ad713x_spi_reg_write | ( | struct ad713x_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 ad713x_spi_write_mask | ( | struct ad713x_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. |
int32_t ad713x_wideband_bw_sel | ( | struct ad713x_dev * | dev, |
enum ad713x_channels | ch, | ||
uint8_t | wb_opt ) |
Select the wideband filter bandwidth for a channel. The option is relative to ODR, so it's a fraction of it.
[in] | dev | - The device structure. |
[in] | ch | - Number of the channel to which to set the wideband filter option. |
[in] | wb_opt | - Option to set the wideband filter: Values are: 0 - bandwidth of 0.443 * ODR; 1 - bandwidth of 0.10825 * ODR. |