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

Classes

struct  dpot_command_525x
 

Macros

#define AD5259_RDAC_READ_INSTRUCTION   0X00
 
#define AD5259_EEPROM_READ_INSTRUCTION   0x20
 
#define AD5259_RDAC_WRITE_INSTRUCTION   0X00
 
#define AD5259_EEPROM_WRITE_INSTRUCTION   0x20
 
#define AD5259_COPY_EEPROM_TO_RDAC_INSTRUCTION   0XA0
 
#define AD5259_COPY_RDAC_TO_EEPROM_INSTRUCTION   0xC0
 
#define AD5259_READ_TOLERANCE_INT_INSTRUCTION   0x3E
 
#define AD5259_READ_TOLERANCE_DEC_INSTRUCTION   0x3F
 

Functions

int ad5259_dpot_init (struct dpot_init_param *param, struct dpot_dev **desc)
 Initialize the ad5259 digital potentiometer.
 
int ad5259_dpot_remove (struct dpot_dev *desc)
 Free the memory allocated by ad5259_dpot_init().
 
int ad5259_dpot_chn_read (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
 Read the ad5259 digital potentiometer channel.
 
int ad5259_dpot_chn_write (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
 Write to the digital potentiometer channel.
 
int ad5259_dpot_nvm_read (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
 Read the NVM (non-volatile) memory data.
 
int ad5259_dpot_tolerance_read (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
 Read the NVM (non-volatile) memory data.
 
int ad5259_dpot_nvm_write (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
 Write data to NVM (non-volatile) memory.
 
int ad5259_dpot_copy_rdac_to_nvm (struct dpot_dev *desc, enum dpot_chn_type chn)
 Copy RDAC register to NVM/EEPROM.
 
int ad5259_dpot_copy_nvm_to_rdac (struct dpot_dev *desc, enum dpot_chn_type chn)
 Copy NVM/EEPROM data to RDAC.
 

Variables

const struct dpot_ops ad5259_dpot_ops
 

Macro Definition Documentation

◆ AD5259_COPY_EEPROM_TO_RDAC_INSTRUCTION

#define AD5259_COPY_EEPROM_TO_RDAC_INSTRUCTION   0XA0

◆ AD5259_COPY_RDAC_TO_EEPROM_INSTRUCTION

#define AD5259_COPY_RDAC_TO_EEPROM_INSTRUCTION   0xC0

◆ AD5259_EEPROM_READ_INSTRUCTION

#define AD5259_EEPROM_READ_INSTRUCTION   0x20

◆ AD5259_EEPROM_WRITE_INSTRUCTION

#define AD5259_EEPROM_WRITE_INSTRUCTION   0x20

◆ AD5259_RDAC_READ_INSTRUCTION

#define AD5259_RDAC_READ_INSTRUCTION   0X00

◆ AD5259_RDAC_WRITE_INSTRUCTION

#define AD5259_RDAC_WRITE_INSTRUCTION   0X00

◆ AD5259_READ_TOLERANCE_DEC_INSTRUCTION

#define AD5259_READ_TOLERANCE_DEC_INSTRUCTION   0x3F

◆ AD5259_READ_TOLERANCE_INT_INSTRUCTION

#define AD5259_READ_TOLERANCE_INT_INSTRUCTION   0x3E

Function Documentation

◆ ad5259_dpot_chn_read()

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

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

◆ ad5259_dpot_chn_write()

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

◆ ad5259_dpot_copy_nvm_to_rdac()

int ad5259_dpot_copy_nvm_to_rdac ( struct dpot_dev * desc,
enum dpot_chn_type chn )

Copy NVM/EEPROM data to RDAC.

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

◆ ad5259_dpot_copy_rdac_to_nvm()

int ad5259_dpot_copy_rdac_to_nvm ( struct dpot_dev * desc,
enum dpot_chn_type chn )

Copy RDAC register to NVM/EEPROM.

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

◆ ad5259_dpot_init()

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

Initialize the ad5259 digital potentiometer.

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

◆ ad5259_dpot_nvm_read()

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

Read the NVM (non-volatile) memory data.

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

◆ ad5259_dpot_nvm_write()

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

Write data to NVM (non-volatile) memory.

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

◆ ad5259_dpot_remove()

int ad5259_dpot_remove ( struct dpot_dev * desc)

Free the memory allocated by ad5259_dpot_init().

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

◆ ad5259_dpot_tolerance_read()

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

Read the NVM (non-volatile) memory data.

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

Variable Documentation

◆ ad5259_dpot_ops

const struct dpot_ops ad5259_dpot_ops
Initial value:
= {
.dpot_init = &ad5259_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 = &ad5259_dpot_chn_read,
.dpot_chn_write = &ad5259_dpot_chn_write,
.dpot_nvm_read = &ad5259_dpot_nvm_read,
.dpot_nvm_write = &ad5259_dpot_nvm_write,
.dpot_copy_rdac_to_nvm = &ad5259_dpot_copy_rdac_to_nvm,
.dpot_copy_nvm_to_rdac = &ad5259_dpot_copy_nvm_to_rdac,
.dpot_rdac_linear_update = NULL,
.dpot_rdac_6db_update = NULL,
.dpot_remove = &ad5259_dpot_remove,
.dpot_enable_top_bottom_scale = NULL,
.dpot_tolerance_read = &ad5259_dpot_tolerance_read
}
int ad5259_dpot_init(struct dpot_init_param *param, struct dpot_dev **desc)
Initialize the ad5259 digital potentiometer.
Definition ad5259.c:79
int ad5259_dpot_copy_nvm_to_rdac(struct dpot_dev *desc, enum dpot_chn_type chn)
Copy NVM/EEPROM data to RDAC.
Definition ad5259.c:352
int ad5259_dpot_remove(struct dpot_dev *desc)
Free the memory allocated by ad5259_dpot_init().
Definition ad5259.c:140
int ad5259_dpot_chn_read(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
Read the ad5259 digital potentiometer channel.
Definition ad5259.c:167
int ad5259_dpot_nvm_read(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
Read the NVM (non-volatile) memory data.
Definition ad5259.c:224
int ad5259_dpot_nvm_write(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
Write data to NVM (non-volatile) memory.
Definition ad5259.c:292
int ad5259_dpot_tolerance_read(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
Read the NVM (non-volatile) memory data.
Definition ad5259.c:254
int ad5259_dpot_chn_write(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
Write to the digital potentiometer channel.
Definition ad5259.c:196
int ad5259_dpot_copy_rdac_to_nvm(struct dpot_dev *desc, enum dpot_chn_type chn)
Copy RDAC register to NVM/EEPROM.
Definition ad5259.c:321
#define NULL
Definition wrapper.h:64