no-OS
|
Implementation of AD5754R Driver. More...
Functions | |
int | ad5754r_write (struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t reg_val) |
Write device register. More... | |
int | ad5754r_read (struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t *reg_val) |
Read device register. More... | |
int | ad5754r_update_bits (struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t mask, uint16_t reg_val) |
Update specific register bits. More... | |
int | ad5754r_update_dac_ch_register (struct ad5754r_dev *dev, uint8_t chn, uint16_t value) |
Update DAC register value for specific channel. More... | |
int | ad5754r_update_dac_all_ch_registers (struct ad5754r_dev *dev, uint16_t value) |
Update DAC register value for all channels. More... | |
int | ad5754r_ldac_trigger (struct ad5754r_dev *dev) |
Trigger LDAC. More... | |
int | ad5754r_clear_async (struct ad5754r_dev *dev) |
Clear DAC output for all channels. More... | |
int | ad5754r_read_dac_ch_register (struct ad5754r_dev *dev, uint8_t chn, uint16_t *value) |
Read DAC register value for specific channel. More... | |
int | ad5754r_dac_code_to_mvolts (struct ad5754r_dev *dev, uint8_t chn, uint16_t code, uint16_t *value) |
Convert DAC code to millivolts for specific channel. More... | |
int | ad5754r_dac_mvolts_to_code (struct ad5754r_dev *dev, uint8_t chn, uint16_t mvolts, uint16_t *code) |
Convert DAC millivolts to code for specific channel. More... | |
int | ad5754r_set_ch_range (struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_dac_ch_range ch_range) |
Set output range for specific channel. More... | |
int | ad5754r_set_ch_pwrup (struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_pwr_dac_ch_pwrup ch_pwrup) |
Set power-up state for specific channel. More... | |
int | ad5754r_set_current_clamp_en (struct ad5754r_dev *dev, enum ad5754r_ctrl_current_clamp_en clamp_en) |
Apply current clamp setting for device. More... | |
int | ad5754r_set_tsd_en (struct ad5754r_dev *dev, enum ad5754r_ctrl_tsd_en tsd_en) |
Apply TSD setting for device. More... | |
int | ad5754r_set_clear_mode (struct ad5754r_dev *dev, enum ad5754r_ctrl_clear_sel clear_sel) |
Set clear mode setting for device. More... | |
int | ad5754r_set_sdo_disable (struct ad5754r_dev *dev, enum ad5754r_ctrl_sdo_dis sdo_dis) |
Set SDO Enable/Disable state for device. More... | |
int | ad5754r_set_int_ref_pwrup (struct ad5754r_dev *dev, enum ad5754r_pwr_int_ref_pwrup int_ref_pwrup) |
Set Internal Reference Enable/Disable state for device. More... | |
int | ad5754r_get_oc_ch_alert (struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_pwr_oc_ch_alert *oc_ch_alert) |
Get Over-current status bit for specific channel. More... | |
int | ad5754r_get_tsd_alert (struct ad5754r_dev *dev, enum ad5754r_pwr_tsd_alert *tsd_alert) |
Get Thermal Shutdown status bit. More... | |
int | ad5754r_spi_verify (struct ad5754r_dev *dev) |
Write to and read back a register to verify SPI. More... | |
int | ad5754r_gpio_init (struct ad5754r_dev *dev, struct ad5754r_init_param *init_param) |
Do GPIO initialization and config for AD5754R. More... | |
int | ad5754r_reg_init (struct ad5754r_dev *dev, struct ad5754r_init_param *init_param) |
Initialize registers based on init parameters. More... | |
int | ad5754r_init (struct ad5754r_dev **device, struct ad5754r_init_param *init_param) |
Initialize the device. More... | |
int | ad5754r_remove_gpios (struct ad5754r_dev *dev) |
Remove GPIOs and free resources. More... | |
int | ad5754r_remove (struct ad5754r_dev *dev) |
Remove the device and release resources. More... | |
Variables | |
const unsigned int | ad5754r_gain_values_scaled [AD5754R_SPAN_M10V8_TO_10V8+1] |
Implementation of AD5754R Driver.
Copyright 2023(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.
int ad5754r_clear_async | ( | struct ad5754r_dev * | dev | ) |
Clear DAC output for all channels.
dev | - The device structure. |
int ad5754r_dac_code_to_mvolts | ( | struct ad5754r_dev * | dev, |
uint8_t | chn, | ||
uint16_t | code, | ||
uint16_t * | value | ||
) |
Convert DAC code to millivolts for specific channel.
dev | - The device structure. |
chn | - The index of channel being addressed. |
code | - DAC code |
value | - Millivolts output calculated using DAC code. |
int ad5754r_dac_mvolts_to_code | ( | struct ad5754r_dev * | dev, |
uint8_t | chn, | ||
uint16_t | mvolts, | ||
uint16_t * | code | ||
) |
Convert DAC millivolts to code for specific channel.
dev | - The device structure. |
chn | - The index of channel being addressed. |
mvolts | - Desired millivolts ouput for specific channel |
code | - DAC code for desired output voltage |
int ad5754r_get_oc_ch_alert | ( | struct ad5754r_dev * | dev, |
uint8_t | chn, | ||
enum ad5754r_pwr_oc_ch_alert * | oc_ch_alert | ||
) |
Get Over-current status bit for specific channel.
dev | - The device structure. |
chn | - The index of channel being addressed. |
oc_ch_alert | - Store channel overcurrent alert status. |
int ad5754r_get_tsd_alert | ( | struct ad5754r_dev * | dev, |
enum ad5754r_pwr_tsd_alert * | tsd_alert | ||
) |
Get Thermal Shutdown status bit.
dev | - The device structure. |
tsd_alert | - Store TSD alert status. |
int ad5754r_gpio_init | ( | struct ad5754r_dev * | dev, |
struct ad5754r_init_param * | init_param | ||
) |
Do GPIO initialization and config for AD5754R.
dev | - The device structure. |
init_param | - Pointer to structure containing the device initial parameters. |
int ad5754r_init | ( | struct ad5754r_dev ** | device, |
struct ad5754r_init_param * | init_param | ||
) |
Initialize the device.
device | - The device structure. |
init_param | - Pointer to structure containing the device initial parameters. |
int ad5754r_ldac_trigger | ( | struct ad5754r_dev * | dev | ) |
Trigger LDAC.
dev | - The device structure. |
int ad5754r_read | ( | struct ad5754r_dev * | dev, |
uint8_t | instr_addr, | ||
uint16_t * | reg_val | ||
) |
Read device register.
dev | - The device structure. |
instr_addr | - The instruction address comprising register and dac channel address. |
reg_val | - The data read from the register. |
int ad5754r_read_dac_ch_register | ( | struct ad5754r_dev * | dev, |
uint8_t | chn, | ||
uint16_t * | value | ||
) |
Read DAC register value for specific channel.
dev | - The device structure. |
chn | - The index of channel being addressed. |
value | - The data read from dac channel register. |
int ad5754r_reg_init | ( | struct ad5754r_dev * | dev, |
struct ad5754r_init_param * | init_param | ||
) |
Initialize registers based on init parameters.
dev | - The device structure. |
init_param | - Pointer to structure containing the device initial parameters. |
int ad5754r_remove | ( | struct ad5754r_dev * | dev | ) |
Remove the device and release resources.
dev | - The device structure. |
int ad5754r_remove_gpios | ( | struct ad5754r_dev * | dev | ) |
Remove GPIOs and free resources.
dev | - The device structure. |
int ad5754r_set_ch_pwrup | ( | struct ad5754r_dev * | dev, |
uint8_t | chn, | ||
enum ad5754r_pwr_dac_ch_pwrup | ch_pwrup | ||
) |
Set power-up state for specific channel.
dev | - The device structure. |
chn | - The index of channel being addressed. |
ch_pwrup | - Powerup setting for specified channel. |
int ad5754r_set_ch_range | ( | struct ad5754r_dev * | dev, |
uint8_t | chn, | ||
enum ad5754r_dac_ch_range | ch_range | ||
) |
Set output range for specific channel.
dev | - The device structure. |
chn | - The index of channel being addressed. |
ch_range | - Range option to be set for specified channel. |
int ad5754r_set_clear_mode | ( | struct ad5754r_dev * | dev, |
enum ad5754r_ctrl_clear_sel | clear_sel | ||
) |
Set clear mode setting for device.
dev | - The device structure. |
clear_sel | - Clear mode setting for device. |
int ad5754r_set_current_clamp_en | ( | struct ad5754r_dev * | dev, |
enum ad5754r_ctrl_current_clamp_en | clamp_en | ||
) |
Apply current clamp setting for device.
dev | - The device structure. |
clamp_en | - Clamp setting for device. |
int ad5754r_set_int_ref_pwrup | ( | struct ad5754r_dev * | dev, |
enum ad5754r_pwr_int_ref_pwrup | int_ref_pwrup | ||
) |
Set Internal Reference Enable/Disable state for device.
dev | - The device structure. |
int_ref_pwrup | - Internal Reference Enable/Disable state for device. |
int ad5754r_set_sdo_disable | ( | struct ad5754r_dev * | dev, |
enum ad5754r_ctrl_sdo_dis | sdo_dis | ||
) |
Set SDO Enable/Disable state for device.
dev | - The device structure. |
sdo_dis | - SDO Enable/Disable state for device. |
int ad5754r_set_tsd_en | ( | struct ad5754r_dev * | dev, |
enum ad5754r_ctrl_tsd_en | tsd_en | ||
) |
Apply TSD setting for device.
dev | - The device structure. |
tsd_en | - TSD setting for device. |
int ad5754r_spi_verify | ( | struct ad5754r_dev * | dev | ) |
Write to and read back a register to verify SPI.
dev | - The device structure. |
int ad5754r_update_bits | ( | struct ad5754r_dev * | dev, |
uint8_t | instr_addr, | ||
uint16_t | mask, | ||
uint16_t | reg_val | ||
) |
Update specific register bits.
dev | - The device structure. |
instr_addr | - The instruction address comprising register and dac channel address. |
mask | - Specific bits mask. |
reg_val | - The data to be written. |
int ad5754r_update_dac_all_ch_registers | ( | struct ad5754r_dev * | dev, |
uint16_t | value | ||
) |
Update DAC register value for all channels.
dev | - The device structure. |
value | - The data to be written to the dac channel registers. |
int ad5754r_update_dac_ch_register | ( | struct ad5754r_dev * | dev, |
uint8_t | chn, | ||
uint16_t | value | ||
) |
Update DAC register value for specific channel.
dev | - The device structure. |
chn | - The index of channel being addressed. |
value | - The data to be written to the dac channel. |
int ad5754r_write | ( | struct ad5754r_dev * | dev, |
uint8_t | instr_addr, | ||
uint16_t | reg_val | ||
) |
Write device register.
dev- | The device structure. |
instr_addr | - The instruction address comprising register and dac channel address. |
reg_val | - The data to be written. |
const unsigned int ad5754r_gain_values_scaled[AD5754R_SPAN_M10V8_TO_10V8+1] |