no-OS
Loading...
Searching...
No Matches
ad5171.c File Reference
#include "ad5171.h"
#include "no_os_delay.h"
Include dependency graph for ad5171.c:

Functions

int ad5171_dpot_init (struct dpot_init_param *param, struct dpot_dev **desc)
 Initialize the ad5171 digital potentiometer.
 
int ad5171_dpot_remove (struct dpot_dev *desc)
 Free the memory allocated by ad5171_dpot_init().
 
int ad5171_dpot_chn_read (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
 Read the ad5171 digital potentiometer channel.
 
int ad5171_dpot_chn_write (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
 Write to the digital potentiometer channel.
 
int ad5171_dpot_chn_write_with_OTP (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
 Write to the digital potentiometer channel.
 
int ad5171_dpot_send_cmd (struct dpot_dev *desc, struct dpot_command *cmd)
 Send command word to the ad5171 digital potentiometer.
 

Variables

const struct dpot_ops ad5171_dpot_ops
 

Function Documentation

◆ ad5171_dpot_chn_read()

int ad5171_dpot_chn_read ( struct dpot_dev * desc,
enum dpot_chn_type chn,
uint8_t * data )

Read the ad5171 digital potentiometer channel.

Parameters
desc- digipot descriptor.
chn- digipot channel.
data- Channel data to be read.
Returns
0 in case of success, negative error code otherwise.

◆ ad5171_dpot_chn_write()

int ad5171_dpot_chn_write ( struct dpot_dev * desc,
enum dpot_chn_type chn,
uint8_t data )

Write to the digital potentiometer channel.

Parameters
desc- digipot descriptor.
chn- digipot channel.
data- Channel data to be written.
Returns
0 in case of success, negative error code otherwise.

◆ ad5171_dpot_chn_write_with_OTP()

int ad5171_dpot_chn_write_with_OTP ( struct dpot_dev * desc,
enum dpot_chn_type chn,
uint8_t data )

Write to the digital potentiometer channel.

Parameters
desc- digipot descriptor.
chn- digipot channel.
data- Channel data to be written.
Returns
0 in case of success, negative error code otherwise.

◆ ad5171_dpot_init()

int ad5171_dpot_init ( struct dpot_init_param * param,
struct dpot_dev ** desc )

Initialize the ad5171 digital potentiometer.

 @file   ad5171.c
 @brief  Source file for the ad5171 digital potentiometer drivers

Copyright 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.

Parameters
param- digipot init parameters.
desc- digipot descriptor.
Returns
0 in case of success, negative error code otherwise.

◆ ad5171_dpot_remove()

int ad5171_dpot_remove ( struct dpot_dev * desc)

Free the memory allocated by ad5171_dpot_init().

Parameters
desc- digipot descriptor.
Returns
0 in case of success, negative error code otherwise.

◆ ad5171_dpot_send_cmd()

int ad5171_dpot_send_cmd ( struct dpot_dev * desc,
struct dpot_command * cmd )

Send command word to the ad5171 digital potentiometer.

Parameters
desc- digipot descriptor.
cmd- digipot command word
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

Variable Documentation

◆ ad5171_dpot_ops

const struct dpot_ops ad5171_dpot_ops
Initial value:
= {
.dpot_init = &ad5171_dpot_init,
.dpot_reset = NULL,
.dpot_shutdown = NULL,
.dpot_set_operating_mode = NULL,
.dpot_input_reg_read = NULL,
.dpot_input_reg_write = NULL,
.dpot_sw_lrdac_update = NULL,
.dpot_chn_read = &ad5171_dpot_chn_read,
.dpot_chn_write = &ad5171_dpot_chn_write,
.dpot_nvm_read = NULL,
.dpot_nvm_write = NULL,
.dpot_copy_rdac_to_nvm = NULL,
.dpot_copy_nvm_to_rdac = NULL,
.dpot_rdac_linear_update = NULL,
.dpot_rdac_6db_update = NULL,
.dpot_remove = &ad5171_dpot_remove,
.dpot_enable_top_bottom_scale = NULL,
.dpot_tolerance_read = NULL
}
int ad5171_dpot_chn_read(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
Read the ad5171 digital potentiometer channel.
Definition ad5171.c:127
int ad5171_dpot_remove(struct dpot_dev *desc)
Free the memory allocated by ad5171_dpot_init().
Definition ad5171.c:100
int ad5171_dpot_chn_write(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
Write to the digital potentiometer channel.
Definition ad5171.c:154
int ad5171_dpot_init(struct dpot_init_param *param, struct dpot_dev **desc)
Initialize the ad5171 digital potentiometer.
Definition ad5171.c:41
#define NULL
Definition wrapper.h:64