![]() |
no-OS
|
Implementation of AD552XR Driver. More...
#include <stdlib.h>#include <string.h>#include <stdbool.h>#include "ad552xr.h"#include "no_os_delay.h"#include "no_os_error.h"#include "no_os_alloc.h"#include "no_os_util.h"Functions | |
| int | ad552xr_spi_reg_read (struct ad552xr_dev *dev, uint32_t reg_addr, uint16_t *reg_data) |
| Read from device. | |
| int | ad552xr_spi_reg_write (struct ad552xr_dev *dev, uint32_t reg_addr, uint16_t reg_data) |
| Write to device. | |
| int | ad552xr_spi_write_mask (struct ad552xr_dev *dev, uint32_t reg_addr, uint32_t mask, uint16_t data) |
| SPI write to device using a mask. | |
| int | ad552xr_set_reference (struct ad552xr_dev *dev, enum ad552xr_vref_select ref_sel) |
| int | ad552xr_set_ch_output_range (struct ad552xr_dev *dev, uint8_t ch, enum ad552xr_output_range range_sel) |
| int | ad552xr_channel_output_en (struct ad552xr_dev *dev, uint8_t ch, bool en) |
| int | ad552xr_func_en (struct ad552xr_dev *dev, uint8_t ch, bool en) |
| int | ad552xr_func_mode_select (struct ad552xr_dev *dev, uint8_t ch, enum ad552xr_function_mode func_mode_sel) |
| int | ad552xr_set_dither_period (struct ad552xr_dev *dev, uint8_t ch, enum ad552xr_dither_period period) |
| int | ad552xr_set_dither_phase (struct ad552xr_dev *dev, uint8_t ch, enum ad552xr_dither_phase phase) |
| int | ad552xr_set_ramp_step_size (struct ad552xr_dev *dev, uint8_t ch, uint8_t step_size) |
| int | ad552xr_set_hw_sw_ldac (struct ad552xr_dev *dev, uint8_t ch, enum ad552xr_hw_sw_ldac ldac_mode_sel) |
| int | ad552xr_set_sync_async_ldac (struct ad552xr_dev *dev, uint8_t ch, bool is_sync) |
| int | ad552xr_set_hw_edge_trigger (struct ad552xr_dev *dev, uint8_t ch, enum ad552xr_ldac_edge_trig trig_edge) |
| Set LDAC/TGP edge trigger. | |
| int | ad552xr_set_hw_ldac_toggle_pin (struct ad552xr_dev *dev, uint8_t ch, enum ad552xr_ldac_toggle_sel ldac_hw_sel) |
| Set LDAC/TGP source pin. | |
| int | ad552xr_set_dac_a_value (struct ad552xr_dev *dev, uint8_t ch, uint16_t dac_value) |
| int | ad552xr_set_dac_b_value (struct ad552xr_dev *dev, uint8_t ch, uint16_t dac_value) |
| int | ad552xr_hw_ldac_trigger (struct ad552xr_dev *dev, enum ad552xr_ldac_toggle_sel ldac_hw_sel, uint32_t delay_us) |
| Trigger the LDAC using hardware. | |
| int | ad552xr_sw_ldac_trigger (struct ad552xr_dev *dev) |
| Trigger the LDAC using software. | |
| int | ad552xr_set_mux_out_select (struct ad552xr_dev *dev, enum ad552xr_mux_out_select mux_output_sel) |
| int | ad552xr_set_device_spi (struct ad552xr_dev *dev, struct ad552xr_device_spi_settings *spi_settings) |
| Set device spi settings. | |
| int | ad552xr_sw_reset (struct ad552xr_dev *dev) |
| Perform soft reset. | |
| int | ad552xr_hw_reset (struct ad552xr_dev *dev) |
| Perform hard reset. | |
| int | ad552xr_init (struct ad552xr_dev **device, struct ad552xr_init_param *init_param) |
| Initialize the device. | |
| int | ad552xr_remove (struct ad552xr_dev *dev) |
| Free the resources allocated by ad552xr_init(). | |
Implementation of AD552XR Driver.
Copyright 2026(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 ad552xr_channel_output_en | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| bool | en ) |
Set the channel output enable.
| dev | - The device structure. |
| ch | - Channel selected. |
| en | - Enable/disable for the channel. |
| int ad552xr_func_en | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| bool | en ) |
Set the function generator enable configuration.
| dev | - The device structure. |
| ch | - Channel selected. |
| en | - Enable/disable for the channel. |
| int ad552xr_func_mode_select | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| enum ad552xr_function_mode | func_mode_sel ) |
Set function generator mode for a channel.
| dev | - The device structure. |
| ch | - Channel selected. |
| func_mode_sel | - Function generator mode to be selected. Accepted values: AD552XR_FUNCTION_MODE_TOGGLE (default) AD552XR_FUNCTION_MODE_DITHER AD552XR_FUNCTION_MODE_TRIANGULAR AD552XR_FUNCTION_MODE_SAWTOOTH |
| int ad552xr_hw_ldac_trigger | ( | struct ad552xr_dev * | dev, |
| enum ad552xr_ldac_toggle_sel | ldac_hw_sel, | ||
| uint32_t | delay_us ) |
Trigger the LDAC using hardware.
| dev | - The device structure. |
| ldac_hw_sel | - HW LDAC Toggle pin select. Accepted values: AD552XR_LDAC_TGP_0 (default) AD552XR_LDAC_TGP_1 AD552XR_LDAC_TGP_2 AD552XR_LDAC_TGP_3 |
| delay_us | - Pulse width of the HW toggle gpio trigger in microseconds. |
| int ad552xr_hw_reset | ( | struct ad552xr_dev * | dev | ) |
Perform hard reset.
| dev | - The device structure. |
| int ad552xr_init | ( | struct ad552xr_dev ** | device, |
| struct ad552xr_init_param * | init_param ) |
Initialize the device.
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
| int ad552xr_remove | ( | struct ad552xr_dev * | dev | ) |
Free the resources allocated by ad552xr_init().
| dev | - The device structure. |
| int ad552xr_set_ch_output_range | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| enum ad552xr_output_range | range_sel ) |
Set output range for a channel.
| dev | - The device structure. |
| ch | - Channel selected. |
| range_sel | - Output range to be selected. Accepted values: AD552XR_UNIPOLAR_5V (default) AD552XR_UNIPOLAR_10V AD552XR_UNIPOLAR_20V AD552XR_UNIPOLAR_40V AD552XR_BIPOLAR_5V AD552XR_BIPOLAR_10V AD552XR_BIPOLAR_15V AD552XR_BIPOLAR_20V |
| int ad552xr_set_dac_a_value | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| uint16_t | dac_value ) |
Set dac value on DAC input register A.
| dev | - The device structure. |
| ch | - selected channel. |
| dac_value | - value that will be set in DAC input register A. |
| int ad552xr_set_dac_b_value | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| uint16_t | dac_value ) |
Set dac value on DAC input register B.
| dev | - The device structure. |
| ch | - selected channel. |
| dac_value | - value that will be set in DAC input register B. |
| int ad552xr_set_device_spi | ( | struct ad552xr_dev * | dev, |
| struct ad552xr_device_spi_settings * | spi_settings ) |
Set device spi settings.
| dev | - The device structure. |
| spi_settings | - The structure that contains the device spi parameters. |
| int ad552xr_set_dither_period | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| enum ad552xr_dither_period | period ) |
Set period for dither function generator.
| dev | - The device structure. |
| ch | - Channel selected. |
| period | - Dither period to be selected. Accepted values: SAMPLES_128 (default) SAMPLES_64 SAMPLES_32 SAMPLES_16 SAMPLES_8 SAMPLES_4 SAMPLES_2 |
| int ad552xr_set_dither_phase | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| enum ad552xr_dither_phase | phase ) |
Set phase for dither function generator.
| dev | - The device structure. |
| ch | - Channel selected. |
| phase | - Dither phase to be selected. Accepted values: DEGREES_0 (default) DEGREES_90 DEGREES_180 DEGREES_270 |
| int ad552xr_set_hw_edge_trigger | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| enum ad552xr_ldac_edge_trig | trig_edge ) |
Set LDAC/TGP edge trigger.
| dev | - The device structure. |
| ch | - Channel selected. |
| trig_edge | - Trigger edge select. Accepted values: RISING_EDGE_TRIG (default) FALLING_EDGE_TRIG ANY_EDGE_TRIG |
| int ad552xr_set_hw_ldac_toggle_pin | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| enum ad552xr_ldac_toggle_sel | ldac_hw_sel ) |
Set LDAC/TGP source pin.
| dev | - The device structure. |
| ch | - Channel selected. |
| ldac_hw_sel | - HW LDAC Toggle pin select. Accepted values: AD552XR_LDAC_TGP_0 (default) AD552XR_LDAC_TGP_1 AD552XR_LDAC_TGP_2 AD552XR_LDAC_TGP_3 |
| int ad552xr_set_hw_sw_ldac | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| enum ad552xr_hw_sw_ldac | ldac_mode_sel ) |
Set the hardware and software ldac configuration.
| dev | - The device structure. |
| ch | - Channel selected. |
| ldac_mode_sel | - LDAC mode to be selected. Accepted values: AD552XR_HW_LDAC (default) AD552XR_SW_LDAC |
| int ad552xr_set_mux_out_select | ( | struct ad552xr_dev * | dev, |
| enum ad552xr_mux_out_select | mux_output_sel ) |
Set the multiplexer output select register.
| dev | - The device structure. |
| mux_output_sel | - signal to be monitored on the mux_out pin. |
| int ad552xr_set_ramp_step_size | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| uint8_t | step_size ) |
Set ramp step size.
| dev | - The device structure. |
| ch | - Channel selected. |
| step_size | - Step size for ramp waveform. |
| int ad552xr_set_reference | ( | struct ad552xr_dev * | dev, |
| enum ad552xr_vref_select | ref_sel ) |
Set reference configuration.
| dev | - The device structure. |
| ref_sel | - The reference to be selected. Accepted values: AD552XR_INTERNAL_VREF_4P096V (default) AD552XR_EXTERNAL_VREF |
| int ad552xr_set_sync_async_ldac | ( | struct ad552xr_dev * | dev, |
| uint8_t | ch, | ||
| bool | is_sync ) |
Set sync/async ldac configuration.
| dev | - The device structure. |
| ch | - Channel selected. |
| is_sync | - To set to synchronous LDAC. |
| int ad552xr_spi_reg_read | ( | struct ad552xr_dev * | dev, |
| uint32_t | reg_addr, | ||
| uint16_t * | reg_data ) |
Read from device.
| dev | - The device structure. |
| reg_addr | - The register address. |
| reg_data | - The register data. |
| int ad552xr_spi_reg_write | ( | struct ad552xr_dev * | dev, |
| uint32_t | reg_addr, | ||
| uint16_t | reg_data ) |
Write to device.
| dev | - The device structure. |
| reg_addr | - The register address. |
| reg_data | - The register data. |
| int ad552xr_spi_write_mask | ( | struct ad552xr_dev * | dev, |
| uint32_t | reg_addr, | ||
| uint32_t | mask, | ||
| uint16_t | data ) |
SPI write to device using a mask.
| dev | - The device structure. |
| reg_addr | - The register address. |
| mask | - The mask. |
| data | - The register data. |
| int ad552xr_sw_ldac_trigger | ( | struct ad552xr_dev * | dev | ) |
Trigger the LDAC using software.
| dev | - The device structure. |
| int ad552xr_sw_reset | ( | struct ad552xr_dev * | dev | ) |
Perform soft reset.
| dev | - The device structure. |