no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ad5592r-base.c File Reference

Implementation of AD5592R Base Driver. More...

#include "no_os_error.h"
#include "ad5592r-base.h"
Include dependency graph for ad5592r-base.c:

Functions

int32_t ad5592r_base_reg_write (struct ad5592r_dev *dev, uint8_t reg, uint16_t value)
 
int32_t ad5592r_base_reg_read (struct ad5592r_dev *dev, uint8_t reg, uint16_t *value)
 
int32_t ad5592r_gpio_get (struct ad5592r_dev *dev, uint8_t offset)
 
int32_t ad5592r_gpio_set (struct ad5592r_dev *dev, uint8_t offset, int32_t value)
 
int32_t ad5592r_gpio_direction_input (struct ad5592r_dev *dev, uint8_t offset)
 
int32_t ad5592r_gpio_direction_output (struct ad5592r_dev *dev, uint8_t offset, int32_t value)
 
int32_t ad5592r_software_reset (struct ad5592r_dev *dev)
 
int32_t ad5592r_set_channel_modes (struct ad5592r_dev *dev)
 
int32_t ad5592r_reset_channel_modes (struct ad5592r_dev *dev)
 
int32_t ad5592r_base_reg_update (struct ad5592r_dev *dev, uint16_t reg_addr, uint16_t data, uint16_t mask)
 
int32_t ad5592r_set_adc_range (struct ad5592r_dev *dev, enum ad559xr_range adc_range)
 
int32_t ad5592r_set_dac_range (struct ad5592r_dev *dev, enum ad559xr_range dac_range)
 
int32_t ad5592r_power_down (struct ad5592r_dev *dev, uint8_t chan, bool enable)
 
int32_t ad5592r_set_int_ref (struct ad5592r_dev *dev, bool enable)
 
int32_t ad5592r_set_adc_buffer (struct ad5592r_dev *dev, bool enable)
 

Detailed Description

Implementation of AD5592R Base Driver.

Author
Mircea Caprioru (mirce.nosp@m.a.ca.nosp@m.prior.nosp@m.u@an.nosp@m.alog..nosp@m.com)

Copyright 2018, 2020, 2025(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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Function Documentation

◆ ad5592r_base_reg_read()

int32_t ad5592r_base_reg_read ( struct ad5592r_dev * dev,
uint8_t reg,
uint16_t * value )

Read register.

Parameters
dev- The device structure.
reg- The register address.
value- register value
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ad5592r_base_reg_update()

int32_t ad5592r_base_reg_update ( struct ad5592r_dev * dev,
uint16_t reg_addr,
uint16_t data,
uint16_t mask )

Register update

Parameters
dev- The device structure.
reg_addr- The Register address
data- The data to be written
mask- The mask
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ad5592r_base_reg_write()

int32_t ad5592r_base_reg_write ( struct ad5592r_dev * dev,
uint8_t reg,
uint16_t value )

Write register.

Parameters
dev- The device structure.
reg- The register address.
value- register value
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ad5592r_gpio_direction_input()

int32_t ad5592r_gpio_direction_input ( struct ad5592r_dev * dev,
uint8_t offset )

Set GPIO as input

Parameters
dev- The device structure.
offset- The channel number.
Returns
0 in case of success, negative error code otherwise

◆ ad5592r_gpio_direction_output()

int32_t ad5592r_gpio_direction_output ( struct ad5592r_dev * dev,
uint8_t offset,
int32_t value )

Set GPIO as output

Parameters
dev- The device structure.
offset- The channel number.
value- GPIO value to set.
Returns
0 in case of success, negative error code otherwise

◆ ad5592r_gpio_get()

int32_t ad5592r_gpio_get ( struct ad5592r_dev * dev,
uint8_t offset )

Get GPIO value

Parameters
dev- The device structure.
offset- The channel number.
Returns
0 or 1 depending on the GPIO value.

◆ ad5592r_gpio_set()

int32_t ad5592r_gpio_set ( struct ad5592r_dev * dev,
uint8_t offset,
int32_t value )

Set GPIO value

Parameters
dev- The device structure.
offset- The channel number.
value- the GPIO value (0 or 1)

◆ ad5592r_power_down()

int32_t ad5592r_power_down ( struct ad5592r_dev * dev,
uint8_t chan,
bool enable )

Set Power Down DAC Channel of the device

Parameters
dev- The device structure.
chan- The channel number.
enable- Status to enable/disable power down.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ad5592r_reset_channel_modes()

int32_t ad5592r_reset_channel_modes ( struct ad5592r_dev * dev)

Reset channels and set GPIO to unused.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise

◆ ad5592r_set_adc_buffer()

int32_t ad5592r_set_adc_buffer ( struct ad5592r_dev * dev,
bool enable )

Set ADC Buffer for the device

Parameters
dev- The device structure.
enable- Status to enable/disable adc buffer.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ad5592r_set_adc_range()

int32_t ad5592r_set_adc_range ( struct ad5592r_dev * dev,
enum ad559xr_range adc_range )

Set ADC Range of the device

Parameters
dev- The device structure.
adc_range- ADC Range
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ad5592r_set_channel_modes()

int32_t ad5592r_set_channel_modes ( struct ad5592r_dev * dev)

Set channels modes.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ad5592r_set_dac_range()

int32_t ad5592r_set_dac_range ( struct ad5592r_dev * dev,
enum ad559xr_range dac_range )

Set DAC Range of the device

Parameters
dev- The device structure.
dac_range- DAC Range
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ad5592r_set_int_ref()

int32_t ad5592r_set_int_ref ( struct ad5592r_dev * dev,
bool enable )

Set Reference Select option for the device

Parameters
dev- The device structure.
enable- Status to enable/disable internal reference.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ad5592r_software_reset()

int32_t ad5592r_software_reset ( struct ad5592r_dev * dev)

Software reset device.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function: