no-OS
|
Implementation of AD5686 Driver. More...
Functions | |
int32_t | ad5686_init (struct ad5686_dev **device, struct ad5686_init_param init_param) |
Initializes the communication peripheral and the initial Values for AD5686 Board. More... | |
int32_t | ad5686_remove (struct ad5686_dev *dev) |
Free the resources allocated by ad5686_init(). More... | |
uint16_t | ad5686_set_shift_reg (struct ad5686_dev *dev, uint8_t command, uint8_t address, uint16_t data) |
Write to input shift register. More... | |
void | ad5686_write_register (struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint16_t data) |
Write to Input Register n (dependent on LDAC) More... | |
void | ad5686_update_register (struct ad5686_dev *dev, enum ad5686_dac_channels channel) |
Update DAC Register n with contents of Input Register n. More... | |
void | ad5686_write_update_register (struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint16_t data) |
Write to and update DAC channel n. More... | |
uint16_t | ad5686_read_back_register (struct ad5686_dev *dev, enum ad5686_dac_channels channel) |
Read back Input Register n. More... | |
void | ad5686_power_mode (struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint8_t mode) |
Set Power-down mode for DAC channel n. More... | |
void | ad5686_ldac_mask (struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint8_t enable) |
Set hardware LDAC mask register. More... | |
void | ad5686_software_reset (struct ad5686_dev *dev) |
Software reset (power-on reset) More... | |
void | ad5686_internal_reference (struct ad5686_dev *dev, uint8_t value) |
Write to Internal reference setup register. More... | |
void | ad5686_daisy_chain_en (struct ad5686_dev *dev, uint8_t value) |
Set up DCEN register (daisy-chain enable) More... | |
void | ad5686_read_back_en (struct ad5686_dev *dev, uint8_t value) |
Set up readback register (readback enable) More... | |
int32_t | ad5686_gain_mode (struct ad5686_dev *dev, uint8_t value) |
Set Gain mode. More... | |
Implementation of AD5686 Driver.
Copyright 2013, 2020(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.
void ad5686_daisy_chain_en | ( | struct ad5686_dev * | dev, |
uint8_t | value | ||
) |
Set up DCEN register (daisy-chain enable)
dev | - The device structure. |
value | - Enable or disable daisy-chain mode Example : 'AD5686_DC_EN' - daisy-chain enable 'AD5686_DC_DIS' - daisy-chain disable |
int32_t ad5686_gain_mode | ( | struct ad5686_dev * | dev, |
uint8_t | value | ||
) |
Set Gain mode.
dev | - The device structure. |
value | - Gain modes. Accepted values: Example : 'AD5683_GB_VREF' - 0V to VREF 'AD5683_GB_2VREF' - 0V to 2xVREF |
int32_t ad5686_init | ( | struct ad5686_dev ** | device, |
struct ad5686_init_param | init_param | ||
) |
Initializes the communication peripheral and the initial Values for AD5686 Board.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
void ad5686_internal_reference | ( | struct ad5686_dev * | dev, |
uint8_t | value | ||
) |
Write to Internal reference setup register.
dev | - The device structure. |
value | - The internal reference register value Example : 'AD5686_INTREF_EN' - enable internal reference 'AD5686_INTREF_DIS' - disable internal reference |
void ad5686_ldac_mask | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel, | ||
uint8_t | enable | ||
) |
Set hardware LDAC mask register.
dev | - The device structure. |
channel | - In case of which channel ignore transitions on the LDAC pin. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
enable | - Enable/disable channel. |
void ad5686_power_mode | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel, | ||
uint8_t | mode | ||
) |
Set Power-down mode for DAC channel n.
dev | - The device structure. |
channel | - The chosen channel to change the power-down mode. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
mode | - Power-down operation modes. Accepted values: 'AD5686_PWRM_NORMAL' - Normal Mode 'AD5686_PWRM_1K' - Power-down mode 1kOhm to GND 'AD5686_PWRM_100K' - Power-down mode 100kOhm to GND 'AD5686_PWRM_THREESTATE' - Three-State 'AD5686_PWRM_100K' is not available for AD5674R/AD5679R. |
void ad5686_read_back_en | ( | struct ad5686_dev * | dev, |
uint8_t | value | ||
) |
Set up readback register (readback enable)
dev | - The device structure. |
value | - Enable or disable daisy-chain mode Example : 'AD5686_RB_EN' - daisy-chain enable 'AD5686_RB_DIS' - daisy-chain disable |
uint16_t ad5686_read_back_register | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel | ||
) |
Read back Input Register n.
dev | - The device structure. |
channel | - The channel which will be read back. Note: only one channel should be selected, if there will be selected more than one channel, the channel A will be read back by default Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
int32_t ad5686_remove | ( | struct ad5686_dev * | dev | ) |
Free the resources allocated by ad5686_init().
dev | - The device structure. |
uint16_t ad5686_set_shift_reg | ( | struct ad5686_dev * | dev, |
uint8_t | command, | ||
uint8_t | address, | ||
uint16_t | data | ||
) |
Write to input shift register.
dev | - The device structure. |
command | - Command control bits. |
address | - The address bits. |
data | - Data to be written in input register. |
void ad5686_software_reset | ( | struct ad5686_dev * | dev | ) |
Software reset (power-on reset)
dev | - The device structure. |
void ad5686_update_register | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel | ||
) |
Update DAC Register n with contents of Input Register n.
dev | - The device structure. |
channel | - The chosen channel to write to. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
void ad5686_write_register | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel, | ||
uint16_t | data | ||
) |
Write to Input Register n (dependent on LDAC)
dev | - The device structure. |
channel | - The chosen channel to write to. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
data | - desired value to be written in register. |
void ad5686_write_update_register | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel, | ||
uint16_t | data | ||
) |
Write to and update DAC channel n.
dev | - The device structure. |
channel | - The chosen channel to write to. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
data | - Desired value to be written in register. |