no-OS
Classes | Macros | Functions
ad5628.h File Reference

Header file of AD5628 Driver. More...

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

Go to the source code of this file.

Classes

struct  ad5628_dev
 
struct  ad5628_init_param
 

Macros

#define AD5628_CMD(x)   ((0x000F & (int32_t)(x)) << 24)
 
#define AD5628_ADDR(x)   ((0x000F & (int32_t)(x)) << 20)
 
#define AD5628_DATA_BITS(x)   ((0x0FFF & (int32_t)(x)) << 8)
 
#define AD5628_CMD_WRITE_INPUT_N   0
 
#define AD5628_CMD_UPDATE_DAC_N   1
 
#define AD5628_CMD_WRITE_INPUT_N_UPDATE_ALL   2
 
#define AD5628_CMD_WRITE_INPUT_N_UPDATE_N   3
 
#define AD5628_CMD_POWERDOWN   4
 
#define AD5628_CMD_LOAD_CLEAR_CODE   5
 
#define AD5628_CMD_LOAD_LDAC_REG   6
 
#define AD5628_CMD_RESET   7
 
#define AD5628_CMD_SET_INT_REF   8
 
#define AD5628_ADDR_DAC_A   0x00
 
#define AD5628_ADDR_DAC_B   0x01
 
#define AD5628_ADDR_DAC_C   0x02
 
#define AD5628_ADDR_DAC_D   0x03
 
#define AD5628_ADDR_DAC_E   0x04
 
#define AD5628_ADDR_DAC_F   0x05
 
#define AD5628_ADDR_DAC_G   0x06
 
#define AD5628_ADDR_DAC_H   0x07
 
#define AD5628_ADDR_DAC_ALL   0x0F
 
#define AD5628_INT_REF_OFF   0
 
#define AD5628_INT_REF_ON   1
 
#define AD5628_POWER_MODE(x)   ((0x03 & (uint16_t) (x)) << 8)
 
#define AD5628_PWRDN_NONE   0
 
#define AD5628_PWRDN_1K   1
 
#define AD5628_PWRDN_100K   2
 
#define AD5628_PWRDN_3STATE   3
 
#define AD5628_CODE_0X0000   0
 
#define AD5628_CODE_0X8000   1
 
#define AD5628_CODE_0XFFFF   2
 
#define AD5628_CODE_NOP   3
 

Functions

int32_t ad5628_init (struct ad5628_dev **device, struct ad5628_init_param init_param)
 Initializes the communication peripheral and the initial Values for AD5628 Board and resets the device. More...
 
int32_t ad5628_remove (struct ad5628_dev *dev)
 Free the resources allocated by ad5628_init(). More...
 
void ad5628_power_mode (struct ad5628_dev *dev, uint8_t pwr_mode, uint8_t channel)
 Sets the device in a specific power mode. More...
 
void ad5628_reset (struct ad5628_dev *dev)
 Resets the device. More...
 
void ad5628_set_input_register (struct ad5628_dev *dev, uint32_t register_value)
 Writes a 32-bit data-word to the Input Register of the device. More...
 

Detailed Description

Header file of AD5628 Driver.

Author
DNechita (Dan.N.nosp@m.echi.nosp@m.ta@an.nosp@m.alog.nosp@m..com)

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

Macro Definition Documentation

◆ AD5628_ADDR

#define AD5628_ADDR (   x)    ((0x000F & (int32_t)(x)) << 20)

◆ AD5628_ADDR_DAC_A

#define AD5628_ADDR_DAC_A   0x00

◆ AD5628_ADDR_DAC_ALL

#define AD5628_ADDR_DAC_ALL   0x0F

◆ AD5628_ADDR_DAC_B

#define AD5628_ADDR_DAC_B   0x01

◆ AD5628_ADDR_DAC_C

#define AD5628_ADDR_DAC_C   0x02

◆ AD5628_ADDR_DAC_D

#define AD5628_ADDR_DAC_D   0x03

◆ AD5628_ADDR_DAC_E

#define AD5628_ADDR_DAC_E   0x04

◆ AD5628_ADDR_DAC_F

#define AD5628_ADDR_DAC_F   0x05

◆ AD5628_ADDR_DAC_G

#define AD5628_ADDR_DAC_G   0x06

◆ AD5628_ADDR_DAC_H

#define AD5628_ADDR_DAC_H   0x07

◆ AD5628_CMD

#define AD5628_CMD (   x)    ((0x000F & (int32_t)(x)) << 24)

◆ AD5628_CMD_LOAD_CLEAR_CODE

#define AD5628_CMD_LOAD_CLEAR_CODE   5

◆ AD5628_CMD_LOAD_LDAC_REG

#define AD5628_CMD_LOAD_LDAC_REG   6

◆ AD5628_CMD_POWERDOWN

#define AD5628_CMD_POWERDOWN   4

◆ AD5628_CMD_RESET

#define AD5628_CMD_RESET   7

◆ AD5628_CMD_SET_INT_REF

#define AD5628_CMD_SET_INT_REF   8

◆ AD5628_CMD_UPDATE_DAC_N

#define AD5628_CMD_UPDATE_DAC_N   1

◆ AD5628_CMD_WRITE_INPUT_N

#define AD5628_CMD_WRITE_INPUT_N   0

◆ AD5628_CMD_WRITE_INPUT_N_UPDATE_ALL

#define AD5628_CMD_WRITE_INPUT_N_UPDATE_ALL   2

◆ AD5628_CMD_WRITE_INPUT_N_UPDATE_N

#define AD5628_CMD_WRITE_INPUT_N_UPDATE_N   3

◆ AD5628_CODE_0X0000

#define AD5628_CODE_0X0000   0

◆ AD5628_CODE_0X8000

#define AD5628_CODE_0X8000   1

◆ AD5628_CODE_0XFFFF

#define AD5628_CODE_0XFFFF   2

◆ AD5628_CODE_NOP

#define AD5628_CODE_NOP   3

◆ AD5628_DATA_BITS

#define AD5628_DATA_BITS (   x)    ((0x0FFF & (int32_t)(x)) << 8)

◆ AD5628_INT_REF_OFF

#define AD5628_INT_REF_OFF   0

◆ AD5628_INT_REF_ON

#define AD5628_INT_REF_ON   1

◆ AD5628_POWER_MODE

#define AD5628_POWER_MODE (   x)    ((0x03 & (uint16_t) (x)) << 8)

◆ AD5628_PWRDN_100K

#define AD5628_PWRDN_100K   2

◆ AD5628_PWRDN_1K

#define AD5628_PWRDN_1K   1

◆ AD5628_PWRDN_3STATE

#define AD5628_PWRDN_3STATE   3

◆ AD5628_PWRDN_NONE

#define AD5628_PWRDN_NONE   0

Function Documentation

◆ ad5628_init()

int32_t ad5628_init ( struct ad5628_dev **  device,
struct ad5628_init_param  init_param 
)

Initializes the communication peripheral and the initial Values for AD5628 Board and resets the device.

Resets the device and performs several initializations.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
ret - The result of the initialization procedure. Example: -1 - SPI peripheral was not initialized or the device is not present. 0 - SPI peripheral was initialized and the device is present.

◆ ad5628_power_mode()

void ad5628_power_mode ( struct ad5628_dev dev,
uint8_t  pwr_mode,
uint8_t  channel 
)

Sets the device in a specific power mode.

Sets the device in a specific power mode.

Parameters
dev- The device structure.
pwr_mode- power mode of the device. Example: AD5628_PWRDN_NONE AD5628_PWRDN_1K AD5628_PWRDN_100K AD5628_PWRDN_3STATE
channel- The channel or channels that are being configured. Example: AD5628_ADDR_DAC_A AD5628_ADDR_DAC_B ... AD5628_ADDR_DAC_ALL
Returns
none.

◆ ad5628_remove()

int32_t ad5628_remove ( struct ad5628_dev dev)

Free the resources allocated by ad5628_init().

Free the resources allocated by AD5628_Init().

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

◆ ad5628_reset()

void ad5628_reset ( struct ad5628_dev dev)

Resets the device.

Resets the device.

Parameters
dev- The device structure.
Returns
none.
Here is the caller graph for this function:

◆ ad5628_set_input_register()

void ad5628_set_input_register ( struct ad5628_dev dev,
uint32_t  register_value 
)

Writes a 32-bit data-word to the Input Register of the device.

Writes a 32-bit data-word to the Input Register of the device.

Parameters
dev- The device structure.
register_value- Value of the register.
Returns
none.
Here is the caller graph for this function: