no-OS
Loading...
Searching...
No Matches
ad5628.h File Reference

Header file of AD5628 Driver. More...

#include <stdint.h>
#include "no_os_spi.h"
Include dependency graph for ad5628.h:

Classes

struct  ad5628_dev
 
struct  ad5628_init_param
 

Macros

#define AD5628_CMD(x)
 
#define AD5628_ADDR(x)
 
#define AD5628_DATA_BITS(x)
 
#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)
 
#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.
 
int32_t ad5628_remove (struct ad5628_dev *dev)
 Free the resources allocated by ad5628_init().
 
void ad5628_power_mode (struct ad5628_dev *dev, uint8_t pwr_mode, uint8_t channel)
 Sets the device in a specific power mode.
 
void ad5628_reset (struct ad5628_dev *dev)
 Resets the device.
 
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.
 

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.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ AD5628_ADDR

#define AD5628_ADDR ( x)
Value:
((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)
Value:
((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)
Value:
((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)
Value:
((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

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

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