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

Functions

int ad5161_dpot_init (struct dpot_init_param *param, struct dpot_dev **desc)
 Initialize the ad5161 digital potentiometer.
 
int ad5161_dpot_remove (struct dpot_dev *desc)
 Free the memory allocated by ad5161_dpot_init().
 
int ad5161_dpot_chn_write (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
 Write to the digital potentiometer channel.
 
int ad5161_dpot_chn_read (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
 Read the ad5161 digital potentiometer channel.
 
int ad5161_dpot_shutdown (struct dpot_dev *desc, enum dpot_chn_type chn, bool shutdown_enable)
 Shutdown the AD5161 digital potentiometer channel.
 
int ad5161_dpot_set_mid_scale (struct dpot_dev *desc, enum dpot_chn_type chn, bool midscale_en)
 To set the the AD5161 to mid scale.
 

Variables

uint8_t ad5161_dpot_cmd_addr []
 
const struct dpot_ops ad5161_dpot_ops
 

Function Documentation

◆ ad5161_dpot_chn_read()

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

Read the ad5161 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.

◆ ad5161_dpot_chn_write()

int ad5161_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.

◆ ad5161_dpot_init()

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

Initialize the ad5161 digital potentiometer.

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

◆ ad5161_dpot_remove()

int ad5161_dpot_remove ( struct dpot_dev * desc)

Free the memory allocated by ad5161_dpot_init().

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

◆ ad5161_dpot_set_mid_scale()

int ad5161_dpot_set_mid_scale ( struct dpot_dev * desc,
enum dpot_chn_type chn,
bool midscale_en )

To set the the AD5161 to mid scale.

Parameters
desc- digipot descriptor.
chn- digipot channel.
midscale_en- To enable the set the device to mid scale.
Returns
0 in case of success, negative error code otherwise.

◆ ad5161_dpot_shutdown()

int ad5161_dpot_shutdown ( struct dpot_dev * desc,
enum dpot_chn_type chn,
bool shutdown_enable )

Shutdown the AD5161 digital potentiometer channel.

Parameters
desc- digipot descriptor.
chn- digipot channel.
shutdown_enable- Shutdown enable status flag.
Returns
0 in case of success, negative error code otherwise.

Variable Documentation

◆ ad5161_dpot_cmd_addr

uint8_t ad5161_dpot_cmd_addr[]
Initial value:
= {
[DPOT_CHN_RDAC1] = 0x0,
}
@ DPOT_CHN_RDAC1
Definition dpot.h:60
 @file   ad5161.c
 @brief  Source file for the ad5161 digital potentiometer drivers

Copyright 2025(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

◆ ad5161_dpot_ops

const struct dpot_ops ad5161_dpot_ops
Initial value:
= {
.dpot_init = &ad5161_dpot_init,
.dpot_reset = NULL,
.dpot_shutdown = &ad5161_dpot_shutdown,
.dpot_set_operating_mode = NULL,
.dpot_input_reg_read = NULL,
.dpot_input_reg_write = NULL,
.dpot_sw_lrdac_update = NULL,
.dpot_chn_read = &ad5161_dpot_chn_read,
.dpot_chn_write = &ad5161_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_send_cmd = NULL,
.dpot_remove = &ad5161_dpot_remove,
.dpot_enable_top_bottom_scale = NULL,
.dpot_tolerance_read = NULL,
.dpot_set_mid_scale = &ad5161_dpot_set_mid_scale
}
int ad5161_dpot_shutdown(struct dpot_dev *desc, enum dpot_chn_type chn, bool shutdown_enable)
Shutdown the AD5161 digital potentiometer channel.
Definition ad5161.c:257
int ad5161_dpot_chn_read(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
Read the ad5161 digital potentiometer channel.
Definition ad5161.c:224
int ad5161_dpot_init(struct dpot_init_param *param, struct dpot_dev **desc)
Initialize the ad5161 digital potentiometer.
Definition ad5161.c:83
int ad5161_dpot_chn_write(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
Write to the digital potentiometer channel.
Definition ad5161.c:195
int ad5161_dpot_set_mid_scale(struct dpot_dev *desc, enum dpot_chn_type chn, bool midscale_en)
To set the the AD5161 to mid scale.
Definition ad5161.c:292
int ad5161_dpot_remove(struct dpot_dev *desc)
Free the memory allocated by ad5161_dpot_init().
Definition ad5161.c:159
#define NULL
Definition wrapper.h:67