no-OS
Loading...
Searching...
No Matches
ad5144.h
Go to the documentation of this file.
1/***************************************************************************/
32#ifndef AD5144_H_
33#define AD5144_H_
34
35#include "../common/dpot.h"
36#include "no_os_spi.h"
37#include "no_os_i2c.h"
38#include "no_os_gpio.h"
39#include "no_os_util.h"
40#include "ad51xx_cmd.h"
41/* Number of channels in Potentiometer mode of operation*/
42#define AD5144_NUM_POTENTIOMETER_CH 4
43/* Number of channels in Linear gain mode of operation*/
44#define AD5144_NUM_LINEAR_GAIN_CH 8
45/*Required delay after resetting the AD5144 */
46#define AD5144_RESET_DELAY 30
47
48
49
55 /* Interface type */
57 /* SPI init parameters */
59 /* I2C init parameters */
61 /* Reset GPIO init parameters */
63 /* Digital interface select GPIO init parameters */
65 /* LRDAC GPIO init parameters */
67 /* EEPROM Write Protect GPIO init parameters */
69 /* INDEP GPIO init parameters */
71 /* Shutdown enable flag for status in the potentiometer mode*/
73 /* Shutdown enable flag for status in the Linear gain mode*/
75 /* Operating mode */
77
78};
79
86 /* SPI descriptor */
88 /* I2C descriptor */
90 /* Reset GPIO desc */
92 /* Digital interface select GPIO descriptor */
94 /* LRDAC GPIO descriptor */
96 /* EEPROM Write Protect descriptor */
98 /* INDEP GPIO init parameters */
100 /* Shutdown enable flag */
102 /* Operating mode */
104
105};
106/* AD5144 digital potentiometer ops */
107int ad5144_dpot_init(struct dpot_init_param *init_params,
108 struct dpot_dev **desc);
109int ad5144_dpot_remove(struct dpot_dev *desc);
110int ad5144_dpot_reset(struct dpot_dev *desc);
111int ad5144_dpot_shutdown(struct dpot_dev *desc,
112 enum dpot_chn_type chn, bool shutdown_enable);
114 enum dpot_operating_mode operating_mode);
115int ad5144_dpot_input_reg_read(struct dpot_dev *desc,
116 enum dpot_chn_type chn, uint8_t *data);
118 enum dpot_chn_type chn, uint8_t data);
119int ad5144_dpot_sw_lrdac_update(struct dpot_dev *desc, enum dpot_chn_type chn);
120int ad5144_dpot_chn_read(struct dpot_dev *desc,
121 enum dpot_chn_type chn, uint8_t *data);
122int ad5144_dpot_chn_write(struct dpot_dev *desc,
123 enum dpot_chn_type chn, uint8_t data);
124int ad5144_dpot_nvm_read(struct dpot_dev *desc,
125 enum dpot_chn_type chn, uint8_t *data);
126int ad5144_dpot_nvm_write(struct dpot_dev *desc,
127 enum dpot_chn_type chn, uint8_t data);
128int ad5144_dpot_copy_rdac_to_nvm(struct dpot_dev *desc, enum dpot_chn_type chn);
129int ad5144_dpot_copy_nvm_to_rdac(struct dpot_dev *desc, enum dpot_chn_type chn);
131 enum dpot_chn_type chn,
132 enum dpot_rdac_linear_status status);
133int ad5144_dpot_rdac_6db_update(struct dpot_dev *desc, enum dpot_chn_type chn,
134 enum dpot_rdac_6db_status status);
135int ad5144_dpot_send_cmd(struct dpot_dev *desc,
136 struct dpot_command *cmd);
137
138#endif // AD5144_H_
int ad5144_dpot_nvm_read(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
Read the NVM (non-volatile) memory data.
Definition ad5144.c:698
int ad5144_dpot_rdac_6db_update(struct dpot_dev *desc, enum dpot_chn_type chn, enum dpot_rdac_6db_status status)
Perform RDAC 6dB increment/decrement.
Definition ad5144.c:870
int ad5144_dpot_shutdown(struct dpot_dev *desc, enum dpot_chn_type chn, bool shutdown_enable)
Shutdown the AD5144 digital potentiometer channel.
Definition ad5144.c:406
int ad5144_dpot_rdac_linear_update(struct dpot_dev *desc, enum dpot_chn_type chn, enum dpot_rdac_linear_status status)
Perform RDAC linear increment/decrement.
Definition ad5144.c:834
#define AD5144_NUM_LINEAR_GAIN_CH
Definition ad5144.h:44
int ad5144_dpot_set_operating_mode(struct dpot_dev *desc, enum dpot_operating_mode operating_mode)
Set the AD5144 digital potentiometer operating mode.
Definition ad5144.c:443
int ad5144_dpot_copy_rdac_to_nvm(struct dpot_dev *desc, enum dpot_chn_type chn)
Copy RDAC register to NVM/EEPROM.
Definition ad5144.c:768
#define AD5144_NUM_POTENTIOMETER_CH
Definition ad5144.h:42
int ad5144_dpot_nvm_write(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
Write data to NVM (non-volatile) memory.
Definition ad5144.c:733
int ad5144_dpot_reset(struct dpot_dev *desc)
Reset the AD5144 digital potentiometer.
Definition ad5144.c:356
int ad5144_dpot_init(struct dpot_init_param *init_params, struct dpot_dev **desc)
Initialize the AD5144 digital potentiometer.
Definition ad5144.c:210
int ad5144_dpot_sw_lrdac_update(struct dpot_dev *desc, enum dpot_chn_type chn)
Copy input register to RDAC (software LRDAC).
Definition ad5144.c:559
int ad5144_dpot_chn_write(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
Write to the digital potentiometer channel.
Definition ad5144.c:665
int ad5144_dpot_send_cmd(struct dpot_dev *desc, struct dpot_command *cmd)
Send command word to the AD5144 digital potentiometer.
Definition ad5144.c:904
int ad5144_dpot_copy_nvm_to_rdac(struct dpot_dev *desc, enum dpot_chn_type chn)
Copy NVM/EEPROM data to RDAC.
Definition ad5144.c:802
int ad5144_dpot_remove(struct dpot_dev *desc)
Free the memory allocated by ad5144_dpot_init().
Definition ad5144.c:318
int ad5144_dpot_chn_read(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
Read the AD5144 digital potentiometer channel.
Definition ad5144.c:591
int ad5144_dpot_input_reg_write(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
Write to the digital potentiometer input register.
Definition ad5144.c:527
int ad5144_dpot_input_reg_read(struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
Read the AD5144 digital potentiometer input register.
Definition ad5144.c:492
dpot_operating_mode
Digital potentiometer operating mode.
Definition dpot.h:106
dpot_rdac_linear_status
Digital potentiometer RDAC linear update status.
Definition dpot.h:118
dpot_rdac_6db_status
Digital potentiometer RDAC 6dB update status.
Definition dpot.h:130
dpot_chn_type
Digital potentiometer channel type.
Definition dpot.h:81
dpot_intf_type
digital potentiometer interface type.
Definition dpot.h:72
Header file of GPIO Interface.
Header file of I2C Interface.
Header file of SPI Interface.
Header file of utility functions.
AD5144 digital potentiometer device descriptor parameters.
Definition ad5144.h:84
struct no_os_gpio_desc * dis_gpio_desc
Definition ad5144.h:93
struct no_os_gpio_desc * wp_gpio_desc
Definition ad5144.h:97
enum dpot_intf_type intf_type
Definition ad5144.h:85
struct no_os_gpio_desc * reset_gpio_desc
Definition ad5144.h:91
bool shutdown_enable[AD5144_NUM_LINEAR_GAIN_CH]
Definition ad5144.h:101
enum dpot_operating_mode eoperating_mode
Definition ad5144.h:103
struct no_os_i2c_desc * i2c_desc
Definition ad5144.h:89
struct no_os_gpio_desc * indep_gpio_desc
Definition ad5144.h:99
struct no_os_spi_desc * spi_desc
Definition ad5144.h:87
struct no_os_gpio_desc * lrdac_gpio_desc
Definition ad5144.h:95
AD5144 digital potentiometer init parameters.
Definition ad5144.h:54
struct no_os_spi_init_param * spi_init
Definition ad5144.h:58
enum dpot_intf_type eintf_type
Definition ad5144.h:56
struct no_os_gpio_init_param * dis_gpio_init
Definition ad5144.h:64
struct no_os_gpio_init_param * lrdac_gpio_init
Definition ad5144.h:66
struct no_os_gpio_init_param * reset_gpio_init
Definition ad5144.h:62
struct no_os_gpio_init_param * wp_gpio_init
Definition ad5144.h:68
struct no_os_i2c_init_param * i2c_init
Definition ad5144.h:60
bool shutdown_enable_lg[AD5144_NUM_LINEAR_GAIN_CH]
Definition ad5144.h:74
struct no_os_gpio_init_param * indep_gpio_init
Definition ad5144.h:70
enum dpot_operating_mode eoperating_mode
Definition ad5144.h:76
bool shutdown_enable_pt[AD5144_NUM_POTENTIOMETER_CH]
Definition ad5144.h:72
Digital potentiometer command structure.
Definition dpot.h:141
Digital potentiometer device descriptor parameters.
Definition dpot.h:175
Digital potentiometer init parameters.
Definition dpot.h:157
Structure holding the GPIO descriptor.
Definition no_os_gpio.h:84
Structure holding the parameters for GPIO initialization.
Definition no_os_gpio.h:67
Structure holding I2C address descriptor.
Definition no_os_i2c.h:89
Structure holding the parameters for I2C initialization.
Definition no_os_i2c.h:52
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128