no-OS
|
Implementation of ad5629r Driver for Microblaze processor. More...
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_set_ctrl (struct ad5629r_dev *dev, uint8_t function, uint8_t dac_n, uint32_t data) |
Write to input register and read from output register via SPI. More... | |
void | ad5629r_set_input_reg (struct ad5629r_dev *dev, uint8_t function, uint8_t dac_n, uint16_t dac_value) |
Write to input register and read from output register via SPI. 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... | |
Implementation of ad5629r Driver for Microblaze processor.
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:
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.
int8_t ad5629r_init | ( | struct ad5629r_dev ** | device, |
struct ad5629r_init_param | init_param | ||
) |
Initializes the communication with the device.
device | - AD5629R device structure. |
init_param | - Device initial parameters. Example: AD5629R, AD5669R, AD5668, AD5648, AD5628. |
void ad5629r_load_clear_code_reg | ( | struct ad5629r_dev * | dev, |
uint8_t | clear_value | ||
) |
Loads the Clear Code Register with a certain value.
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. |
void ad5629r_load_ldac_reg | ( | struct ad5629r_dev * | dev, |
uint8_t | dac_sel | ||
) |
Loads the LDAC register with a certain value.
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. |
int32_t ad5629r_remove | ( | struct ad5629r_dev * | dev | ) |
Free the resources allocated by AD5629R_Init().
dev | - The device structure. |
void ad5629r_reset | ( | struct ad5629r_dev * | dev | ) |
Makes a power-on reset.
dev | - The device structure. |
void ad5629r_set_ctrl | ( | struct ad5629r_dev * | dev, |
uint8_t | function, | ||
uint8_t | dac_n, | ||
uint32_t | data | ||
) |
Write to input register and read from output register via SPI.
dev | - The device structure. |
function | - command control bits; |
dac_n | - address of selected DAC; |
data | - data to be written in register. |
void ad5629r_set_input_reg | ( | struct ad5629r_dev * | dev, |
uint8_t | function, | ||
uint8_t | dac_n, | ||
uint16_t | dac_value | ||
) |
Write to input register and read from output register via SPI.
dev | - The device structure. |
function | - command control bits. |
dac_n | - address of selected DAC; |
dac_value | - data to be written in input register. |
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.
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. |
void ad5629r_set_ref | ( | struct ad5629r_dev * | dev, |
uint8_t | status | ||
) |
Turns on/off the internal reference.
dev | - The device structure. |
status | - the status of internal reference. Example: REF_ON - the reference is on; REF_OFF - the reference is off. |
void ad5629r_update_dac_n | ( | struct ad5629r_dev * | dev, |
uint8_t | dac_n | ||
) |
Updates selected DAC register.
dev | - The device structure. |
dac_n | - Address of selected DAC. |
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.
dev | - The device structure. |
dac_value | - Value to be written in register; |
dac_n | - Address of selected DAC. |
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.
dev | - The device structure. |
dac_value | - Value to be written in register; |
dac_n | - Address of selected DAC. |
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.
dev | - The device structure. |
dac_value | - Value to be written in register; |
dac_n | - Address of selected DAC. |