no-OS
Classes | Macros | Enumerations | Functions
ad5629r.h File Reference

Header file of AD5629R Driver for Microblaze processor. More...

#include <stdint.h>
#include "no_os_gpio.h"
#include "no_os_spi.h"
#include "no_os_i2c.h"
Include dependency graph for ad5629r.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ad5629r_chip_info
 
struct  ad5629r_dev
 
struct  ad5629r_init_param
 

Macros

#define AD5629R_I2C_ADDR_0   0x54
 
#define AD5629R_I2C_ADDR_1   0x56
 
#define AD5629R_I2C_ADDR_2   0x57
 
#define MAX_RESOLUTION   16
 
#define AD5629R_WRITE_N   0x0
 
#define AD5629R_UPDATE_N   0x1
 
#define AD5629R_WRITE_N_UPDATE_ALL   0x2
 
#define AD5629R_WRITE_N_UPDATE_N   0x3
 
#define AD5629R_POWER   0x4
 
#define AD5629R_LOAD_CLEAR_REG   0x5
 
#define AD5629R_LOAD_LDAC_REG   0x6
 
#define AD5629R_RESET   0x7
 
#define AD5629R_REFERENCE   0x8
 
#define AD5629R_LDAC_OUT
 
#define AD5629R_LDAC_LOW
 
#define AD5629R_LDAC_HIGH
 
#define AD5629R_CLR_OUT
 
#define AD5629R_CLR_LOW
 
#define AD5629R_CLR_HIGH
 
#define AD5629R_DAC_A_ADDR   0x0
 
#define AD5629R_DAC_B_ADDR   0x1
 
#define AD5629R_DAC_C_ADDR   0x2
 
#define AD5629R_DAC_D_ADDR   0x3
 
#define AD5629R_DAC_E_ADDR   0x4
 
#define AD5629R_DAC_F_ADDR   0x5
 
#define AD5629R_DAC_G_ADDR   0x6
 
#define AD5629R_DAC_H_ADDR   0x7
 
#define AD5629R_DAC_ALL_ADDR   0xF
 
#define DAC_A_SEL   1
 
#define DAC_B_SEL   2
 
#define DAC_C_SEL   4
 
#define DAC_D_SEL   8
 
#define DAC_E_SEL   16
 
#define DAC_F_SEL   32
 
#define DAC_G_SEL   64
 
#define DAC_H_SEL   128
 
#define PWR_NORMAL   0
 
#define PWR_1K_TO_GND   1
 
#define PWR_100K_TO_GND   2
 
#define PWR_3_STATE   3
 
#define CLR_TO_ZEROSCALE   0
 
#define CLR_TO_MIDSCALE   1
 
#define CLR_TO_FULLSCALE   2
 
#define CLR_NOOP   3
 
#define REF_ON   1
 
#define REF_OFF   0
 

Enumerations

enum  ad5629r_type {
  ID_AD5629R,
  ID_AD5669R,
  ID_AD5668,
  ID_AD5648,
  ID_AD5628
}
 
enum  comm_type_t {
  com_spi,
  com_i2c,
  SPI,
  I2C
}
 

Functions

int8_t ad5629r_init (struct ad5629r_dev **device, struct ad5629r_init_param init_param)
 Initializes the communication with the device. More...
 
int32_t ad5629r_remove (struct ad5629r_dev *dev)
 Free the resources allocated by AD5629R_Init(). More...
 
void ad5629r_write_reg_n (struct ad5629r_dev *dev, uint8_t dac_n, uint16_t dac_value)
 Writes a value to Input Register N of selected DAC channel. More...
 
void ad5629r_update_dac_n (struct ad5629r_dev *dev, uint8_t dac_n)
 Updates selected DAC register. More...
 
void ad5629r_write_reg_nupdate_all (struct ad5629r_dev *dev, uint8_t dac_n, uint16_t dac_value)
 Writes a value to Input Register N of selected DAC channel, then updates all. More...
 
void ad5629r_write_reg_nupdate_n (struct ad5629r_dev *dev, uint8_t dac_n, uint16_t dac_value)
 Writes a value to Input Register N and updates the respective DAC channel. More...
 
void ad5629r_set_power_mode (struct ad5629r_dev *dev, uint8_t dac_sel, uint8_t mode)
 Sets the power mode for one or more selected DAC channels. More...
 
void ad5629r_load_clear_code_reg (struct ad5629r_dev *dev, uint8_t clear_value)
 Loads the Clear Code Register with a certain value. More...
 
void ad5629r_load_ldac_reg (struct ad5629r_dev *dev, uint8_t dac_sel)
 Loads the LDAC register with a certain value. More...
 
void ad5629r_reset (struct ad5629r_dev *dev)
 Makes a power-on reset. More...
 
void ad5629r_set_ref (struct ad5629r_dev *dev, uint8_t status)
 Turns on/off the internal reference. More...
 

Detailed Description

Header file of AD5629R Driver for Microblaze processor.

Author
Lucian Sin (Lucia.nosp@m.n.Si.nosp@m.n@ana.nosp@m.log..nosp@m.com)

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

Macro Definition Documentation

◆ AD5629R_CLR_HIGH

#define AD5629R_CLR_HIGH
Value:

◆ AD5629R_CLR_LOW

#define AD5629R_CLR_LOW
Value:

◆ AD5629R_CLR_OUT

#define AD5629R_CLR_OUT
Value:

◆ AD5629R_DAC_A_ADDR

#define AD5629R_DAC_A_ADDR   0x0

◆ AD5629R_DAC_ALL_ADDR

#define AD5629R_DAC_ALL_ADDR   0xF

◆ AD5629R_DAC_B_ADDR

#define AD5629R_DAC_B_ADDR   0x1

◆ AD5629R_DAC_C_ADDR

#define AD5629R_DAC_C_ADDR   0x2

◆ AD5629R_DAC_D_ADDR

#define AD5629R_DAC_D_ADDR   0x3

◆ AD5629R_DAC_E_ADDR

#define AD5629R_DAC_E_ADDR   0x4

◆ AD5629R_DAC_F_ADDR

#define AD5629R_DAC_F_ADDR   0x5

◆ AD5629R_DAC_G_ADDR

#define AD5629R_DAC_G_ADDR   0x6

◆ AD5629R_DAC_H_ADDR

#define AD5629R_DAC_H_ADDR   0x7

◆ AD5629R_I2C_ADDR_0

#define AD5629R_I2C_ADDR_0   0x54

◆ AD5629R_I2C_ADDR_1

#define AD5629R_I2C_ADDR_1   0x56

◆ AD5629R_I2C_ADDR_2

#define AD5629R_I2C_ADDR_2   0x57

◆ AD5629R_LDAC_HIGH

#define AD5629R_LDAC_HIGH
Value:

◆ AD5629R_LDAC_LOW

#define AD5629R_LDAC_LOW
Value:

◆ AD5629R_LDAC_OUT

#define AD5629R_LDAC_OUT
Value:

◆ AD5629R_LOAD_CLEAR_REG

#define AD5629R_LOAD_CLEAR_REG   0x5

◆ AD5629R_LOAD_LDAC_REG

#define AD5629R_LOAD_LDAC_REG   0x6

◆ AD5629R_POWER

#define AD5629R_POWER   0x4

◆ AD5629R_REFERENCE

#define AD5629R_REFERENCE   0x8

◆ AD5629R_RESET

#define AD5629R_RESET   0x7

◆ AD5629R_UPDATE_N

#define AD5629R_UPDATE_N   0x1

◆ AD5629R_WRITE_N

#define AD5629R_WRITE_N   0x0

◆ AD5629R_WRITE_N_UPDATE_ALL

#define AD5629R_WRITE_N_UPDATE_ALL   0x2

◆ AD5629R_WRITE_N_UPDATE_N

#define AD5629R_WRITE_N_UPDATE_N   0x3

◆ CLR_NOOP

#define CLR_NOOP   3

◆ CLR_TO_FULLSCALE

#define CLR_TO_FULLSCALE   2

◆ CLR_TO_MIDSCALE

#define CLR_TO_MIDSCALE   1

◆ CLR_TO_ZEROSCALE

#define CLR_TO_ZEROSCALE   0

◆ DAC_A_SEL

#define DAC_A_SEL   1

◆ DAC_B_SEL

#define DAC_B_SEL   2

◆ DAC_C_SEL

#define DAC_C_SEL   4

◆ DAC_D_SEL

#define DAC_D_SEL   8

◆ DAC_E_SEL

#define DAC_E_SEL   16

◆ DAC_F_SEL

#define DAC_F_SEL   32

◆ DAC_G_SEL

#define DAC_G_SEL   64

◆ DAC_H_SEL

#define DAC_H_SEL   128

◆ MAX_RESOLUTION

#define MAX_RESOLUTION   16

◆ PWR_100K_TO_GND

#define PWR_100K_TO_GND   2

◆ PWR_1K_TO_GND

#define PWR_1K_TO_GND   1

◆ PWR_3_STATE

#define PWR_3_STATE   3

◆ PWR_NORMAL

#define PWR_NORMAL   0

◆ REF_OFF

#define REF_OFF   0

◆ REF_ON

#define REF_ON   1

Enumeration Type Documentation

◆ ad5629r_type

Enumerator
ID_AD5629R 
ID_AD5669R 
ID_AD5668 
ID_AD5648 
ID_AD5628 

◆ comm_type_t

Enumerator
com_spi 
com_i2c 
SPI 
I2C 

Function Documentation

◆ ad5629r_init()

int8_t ad5629r_init ( struct ad5629r_dev **  device,
struct ad5629r_init_param  init_param 
)

Initializes the communication with the device.

Parameters
device- AD5629R device structure.
init_param- Device initial parameters. Example: AD5629R, AD5669R, AD5668, AD5648, AD5628.
Returns
status - Result of the initialization procedure. Example: 0 - if initialization was successful; -1 - if initialization was unsuccessful.

◆ ad5629r_load_clear_code_reg()

void ad5629r_load_clear_code_reg ( struct ad5629r_dev dev,
uint8_t  clear_value 
)

Loads the Clear Code Register with a certain value.

Parameters
dev- The device structure.
clear_value- the value to be set in all DAC registers after a clear operation. Example: CLR_TO_ZEROSCALE - clears to 0x0; CLR_TO_MIDSCALE - clears to 0x8000; CLR_TO_FULLSCALE - clears to 0xFFFF; CLR_NOOP - no operation.
Returns
none.

◆ ad5629r_load_ldac_reg()

void ad5629r_load_ldac_reg ( struct ad5629r_dev dev,
uint8_t  dac_sel 
)

Loads the LDAC register with a certain value.

Parameters
dev- The device structure.
dac_sel- a byte where each bit is corresponding to a DAC; when a bit is set to 1, the corresponding DAC is selected to override LDAC pin. Example: DAC_A_SEL - the selected DAC to override the LDAC pin is DAC A; DAC_D_SEL | DAC_F_SEL | DAC_H_SEL - the selected DACs to override the LDAC pin are: DAC D, DAC F and DAC H.
Returns
none.

◆ ad5629r_remove()

int32_t ad5629r_remove ( struct ad5629r_dev dev)

Free the resources allocated by AD5629R_Init().

Parameters
dev- The device structure.
Returns
ret - The result of the remove procedure.

◆ ad5629r_reset()

void ad5629r_reset ( struct ad5629r_dev dev)

Makes a power-on reset.

Parameters
dev- The device structure.
Returns
none.

◆ ad5629r_set_power_mode()

void ad5629r_set_power_mode ( struct ad5629r_dev dev,
uint8_t  dac_sel,
uint8_t  mode 
)

Sets the power mode for one or more selected DAC channels.

Parameters
dev- The device structure.
dac_sel- a byte where each bit is corresponding to a DAC; when a bit is set to 1, the corresponding DAC is selected. Example: DAC_A_SEL - the selected DAC is DAC A; DAC_D_SEL | DAC_F_SEL | DAC_H_SEL - the selected DACs are: DAC D, DAC F and DAC H.
mode- the desired power mode to be set. Example: PWR_NORMAL - normal operation; PWR_1K_TO_GND - 1KOhm to GND; PWR_100K_TO_GND - 100KOhms to GND; PWR_3_STATE - three-state.
Returns
none.

◆ ad5629r_set_ref()

void ad5629r_set_ref ( struct ad5629r_dev dev,
uint8_t  status 
)

Turns on/off the internal reference.

Parameters
dev- The device structure.
status- the status of internal reference. Example: REF_ON - the reference is on; REF_OFF - the reference is off.
Returns
none.

◆ ad5629r_update_dac_n()

void ad5629r_update_dac_n ( struct ad5629r_dev dev,
uint8_t  dac_n 
)

Updates selected DAC register.

Parameters
dev- The device structure.
dac_n- Address of selected DAC.
Returns
none.

◆ ad5629r_write_reg_n()

void ad5629r_write_reg_n ( struct ad5629r_dev dev,
uint8_t  dac_n,
uint16_t  dac_value 
)

Writes a value to Input Register N of selected DAC channel.

Parameters
dev- The device structure.
dac_value- Value to be written in register;
dac_n- Address of selected DAC.
Returns
none.

◆ ad5629r_write_reg_nupdate_all()

void ad5629r_write_reg_nupdate_all ( struct ad5629r_dev dev,
uint8_t  dac_n,
uint16_t  dac_value 
)

Writes a value to Input Register N of selected DAC channel, then updates all.

Parameters
dev- The device structure.
dac_value- Value to be written in register;
dac_n- Address of selected DAC.
Returns
none.

◆ ad5629r_write_reg_nupdate_n()

void ad5629r_write_reg_nupdate_n ( struct ad5629r_dev dev,
uint8_t  dac_n,
uint16_t  dac_value 
)

Writes a value to Input Register N and updates the respective DAC channel.

Parameters
dev- The device structure.
dac_value- Value to be written in register;
dac_n- Address of selected DAC.
Returns
none.
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147