no-OS
Functions
ad5766.c File Reference

Implementation of AD5766 Driver. More...

#include <stdio.h>
#include <stdlib.h>
#include "ad5766.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
Include dependency graph for ad5766.c:

Functions

int32_t ad5766_spi_cmd_write (struct ad5766_dev *dev, uint8_t cmd, uint16_t data)
 
int32_t ad5766_spi_readback_reg (struct ad5766_dev *dev, enum ad5766_dac dac, uint32_t *data)
 
int32_t ad5766_set_sw_ldac (struct ad5766_dev *dev, uint16_t setting)
 
int32_t ad5766_set_clr_span (struct ad5766_dev *dev, enum ad5766_clr clr, enum ad5766_span span)
 
int32_t ad5766_set_pwr_dac (struct ad5766_dev *dev, uint16_t setting)
 
int32_t ad5766_set_pwr_dither (struct ad5766_dev *dev, uint16_t setting)
 
int32_t ad5766_set_dither_signal (struct ad5766_dev *dev, uint32_t setting)
 
int32_t ad5766_set_inv_dither (struct ad5766_dev *dev, uint16_t setting)
 
int32_t ad5766_set_dither_scale (struct ad5766_dev *dev, uint32_t setting)
 
int32_t ad5766_do_soft_reset (struct ad5766_dev *dev)
 
int32_t ad5766_set_in_reg (struct ad5766_dev *dev, enum ad5766_dac dac, uint16_t data)
 
int32_t ad5766_set_dac_reg (struct ad5766_dev *dev, enum ad5766_dac dac, uint16_t data)
 
int32_t ad5766_set_dac_reg_all (struct ad5766_dev *dev, uint16_t data)
 
int32_t ad5766_init (struct ad5766_dev **device, struct ad5766_init_param init_param)
 
int32_t ad5766_remove (struct ad5766_dev *dev)
 Free the resources allocated by ad5766_init(). More...
 

Detailed Description

Implementation of AD5766 Driver.

Author
DBogdan (drago.nosp@m.s.bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2016(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.

Function Documentation

◆ ad5766_do_soft_reset()

int32_t ad5766_do_soft_reset ( struct ad5766_dev dev)

Do a software reset.

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

◆ ad5766_init()

int32_t ad5766_init ( struct ad5766_dev **  device,
struct ad5766_init_param  init_param 
)

Initialize the device.

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

◆ ad5766_remove()

int32_t ad5766_remove ( struct ad5766_dev dev)

Free the resources allocated by ad5766_init().

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

◆ ad5766_set_clr_span()

int32_t ad5766_set_clr_span ( struct ad5766_dev dev,
enum ad5766_clr  clr,
enum ad5766_span  span 
)

Set clear code and span settings.

Parameters
dev- The device structure.
clr- The clear code setting. Accepted values: AD5766_ZERO AD5766_MID AD5766_FULL
span- The span setting. Accepted values: AD5766_M_20V_TO_0V AD5766_M_16V_TO_0V AD5766_M_10V_TO_0V AD5766_M_12V_TO_P_14V AD5766_M_16V_TO_P_10V AD5766_M_5V_TO_P_6V AD5766_M_10V_TO_P_10V
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5766_set_dac_reg()

int32_t ad5766_set_dac_reg ( struct ad5766_dev dev,
enum ad5766_dac  dac,
uint16_t  data 
)

Set the DAC register for the selected channel.

Parameters
dev- The device structure.
dac- The selected channel.
data- The register data.
Returns
0 in case of success, negative error code otherwise.

◆ ad5766_set_dac_reg_all()

int32_t ad5766_set_dac_reg_all ( struct ad5766_dev dev,
uint16_t  data 
)

Set the DAC register for all channels.

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

◆ ad5766_set_dither_scale()

int32_t ad5766_set_dither_scale ( struct ad5766_dev dev,
uint32_t  setting 
)

Enable the dither scaling for the selected channels.

Parameters
dev- The device structure.
setting- The setting. Accepted values: AD5766_75(x) | AD5766_50(y) | AD5766_25(z) | ...
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5766_set_dither_signal()

int32_t ad5766_set_dither_signal ( struct ad5766_dev dev,
uint32_t  setting 
)

Enable the dither signal for the selected channels.

Parameters
dev- The device structure.
setting- The setting. Accepted values: AD5766_N0(x) | AD5766_N1(y) | ...
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5766_set_in_reg()

int32_t ad5766_set_in_reg ( struct ad5766_dev dev,
enum ad5766_dac  dac,
uint16_t  data 
)

Set the input register for the selected channel.

Parameters
dev- The device structure.
dac- The selected channel.
data- The register data.
Returns
0 in case of success, negative error code otherwise.

◆ ad5766_set_inv_dither()

int32_t ad5766_set_inv_dither ( struct ad5766_dev dev,
uint16_t  setting 
)

Invert the dither signal for the selected channels.

Parameters
dev- The device structure.
setting- The setting. Accepted values: AD5766_INV_D(x) | AD5766_INV_D(y) | ...
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5766_set_pwr_dac()

int32_t ad5766_set_pwr_dac ( struct ad5766_dev dev,
uint16_t  setting 
)

Power down the selected channels.

Parameters
dev- The device structure.
setting- The setting. Accepted values: AD5766_PWDN(x) | AD5766_PWDN(y) | ...
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5766_set_pwr_dither()

int32_t ad5766_set_pwr_dither ( struct ad5766_dev dev,
uint16_t  setting 
)

Power down the dither block for the selected channels.

Parameters
dev- The device structure.
setting- The setting. Accepted values: AD5766_PWDN(x) | AD5766_PWDN(y) | ...
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5766_set_sw_ldac()

int32_t ad5766_set_sw_ldac ( struct ad5766_dev dev,
uint16_t  setting 
)

Set software LDAC for the selected channels.

Parameters
dev- The device structure.
setting- The setting. Accepted values: AD5766_LDAC(x) | AD5766_LDAC(y) | ...
Returns
0 in case of success, negative error code otherwise.

◆ ad5766_spi_cmd_write()

int32_t ad5766_spi_cmd_write ( struct ad5766_dev dev,
uint8_t  cmd,
uint16_t  data 
)

SPI command write to device.

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

◆ ad5766_spi_readback_reg()

int32_t ad5766_spi_readback_reg ( struct ad5766_dev dev,
enum ad5766_dac  dac,
uint32_t *  data 
)

SPI readback register from device.

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