precision-converters-firmware
Loading...
Searching...
No Matches
Functions
dpot.c File Reference
#include "dpot.h"
Include dependency graph for dpot.c:

Functions

int dpot_init (struct dpot_dev **desc, struct dpot_init_param *pdpot_init_param)
 Initialize the digital potentiometer.
 
int dpot_remove (struct dpot_dev *desc)
 Free the memory allocated by dpot_init().
 
int dpot_reset (struct dpot_dev *desc)
 Reset the digital potentiometer.
 
int dpot_shutdown (struct dpot_dev *desc, enum dpot_chn_type chn, bool shutdown_enable)
 Shutdown the digital potentiometer channel.
 
int dpot_set_operating_mode (struct dpot_dev *desc, enum dpot_operating_mode operating_mode)
 Set the digital potentiometer operating mode.
 
int dpot_input_reg_read (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
 Read the digital potentiometer input register.
 
int dpot_input_reg_write (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
 Write to the digital potentiometer input register.
 
int dpot_sw_lrdac_update (struct dpot_dev *desc, enum dpot_chn_type chn)
 Copy input register to RDAC (software LRDAC).
 
int dpot_chn_read (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
 Read the digital potentiometer channel.
 
int dpot_chn_write (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
 Write to the digital potentiometer channel.
 
int dpot_nvm_read (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
 Read the NVM (non-volatile) memory data.
 
int dpot_nvm_write (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t data)
 Write data to NVM (non-volatile) memory.
 
int dpot_copy_rdac_to_nvm (struct dpot_dev *desc, enum dpot_chn_type chn)
 Copy RDAC register to NVM/EEPROM.
 
int dpot_copy_nvm_to_rdac (struct dpot_dev *desc, enum dpot_chn_type chn)
 Copy NVM/EEPROM data to RDAC.
 
int dpot_rdac_linear_update (struct dpot_dev *desc, enum dpot_chn_type chn, enum dpot_rdac_linear_status status)
 Perform RDAC linear increment/decrement.
 
int dpot_enable_top_scale (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t nEnter)
 Perform Enter/exit top scale.
 
int dpot_enable_bottom_scale (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t nEnter)
 Perform Enter/exit top scale.
 
int dpot_rdac_6db_update (struct dpot_dev *desc, enum dpot_chn_type chn, enum dpot_rdac_6db_status status)
 Perform RDAC 6dB increment/decrement.
 
int dpot_send_cmd (struct dpot_dev *desc, struct dpot_command *cmd)
 Send command word to the digital potentiometer.
 
int dpot_tolerance_read (struct dpot_dev *desc, enum dpot_chn_type chn, uint8_t *data)
 Send command word to the digital potentiometer.
 
int dpot_set_mid_scale (struct dpot_dev *desc, enum dpot_chn_type chn, bool shutdown_enable)
 Shutdown the digital potentiometer channel.
 

Function Documentation

◆ dpot_chn_read()

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

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

◆ dpot_chn_write()

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

◆ dpot_copy_nvm_to_rdac()

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

◆ dpot_copy_rdac_to_nvm()

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

◆ dpot_enable_bottom_scale()

int dpot_enable_bottom_scale ( struct dpot_dev desc,
enum dpot_chn_type  chn,
uint8_t  nEnter 
)

Perform Enter/exit top scale.

Parameters
desc- digipot descriptor.
chn- digipot channel.
nEnter- Enter or exit the Bottom scake.
Returns
0 in case of success, negative error code otherwise.

◆ dpot_enable_top_scale()

int dpot_enable_top_scale ( struct dpot_dev desc,
enum dpot_chn_type  chn,
uint8_t  nEnter 
)

Perform Enter/exit top scale.

Parameters
desc- digipot descriptor.
chn- digipot channel.
nEnter- Enter or exit the TS.
Returns
0 in case of success, negative error code otherwise.

◆ dpot_init()

int dpot_init ( struct dpot_dev **  desc,
struct dpot_init_param pdpot_init_param 
)

Initialize the digital potentiometer.

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

◆ dpot_input_reg_read()

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

Read the digital potentiometer input register.

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

◆ dpot_input_reg_write()

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

Write to the digital potentiometer input register.

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

◆ dpot_nvm_read()

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

◆ dpot_nvm_write()

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

◆ dpot_rdac_6db_update()

int dpot_rdac_6db_update ( struct dpot_dev desc,
enum dpot_chn_type  chn,
enum dpot_rdac_6db_status  status 
)

Perform RDAC 6dB increment/decrement.

Parameters
desc- digipot descriptor.
chn- digipot channel.
status- 6dB increment/decrement status.
Returns
0 in case of success, negative error code otherwise.

◆ dpot_rdac_linear_update()

int dpot_rdac_linear_update ( struct dpot_dev desc,
enum dpot_chn_type  chn,
enum dpot_rdac_linear_status  status 
)

Perform RDAC linear increment/decrement.

Parameters
desc- digipot descriptor.
chn- digipot channel.
status- linear increment/decrement status.
Returns
0 in case of success, negative error code otherwise.

◆ dpot_remove()

int dpot_remove ( struct dpot_dev desc)

Free the memory allocated by dpot_init().

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

◆ dpot_reset()

int dpot_reset ( struct dpot_dev desc)

Reset the digital potentiometer.

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

◆ dpot_send_cmd()

int dpot_send_cmd ( struct dpot_dev desc,
struct dpot_command cmd 
)

Send command word to the 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:

◆ dpot_set_mid_scale()

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

Shutdown the digital potentiometer channel.

Parameters
desc- digipot descriptor.
chn- digipot channel.
shutdown_enable- To set bid scaleenable mid scale .
Returns
0 in case of success, negative error code otherwise.

◆ dpot_set_operating_mode()

int dpot_set_operating_mode ( struct dpot_dev desc,
enum dpot_operating_mode  operating_mode 
)

Set the digital potentiometer operating mode.

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

◆ dpot_shutdown()

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

Shutdown the 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.

◆ dpot_sw_lrdac_update()

int dpot_sw_lrdac_update ( struct dpot_dev desc,
enum dpot_chn_type  chn 
)

Copy input register to RDAC (software LRDAC).

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

◆ dpot_tolerance_read()

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

Send command word to the digital potentiometer.

Parameters
desc- digipot descriptor.
chn- Channel type
data- Pointer to location where tolerance should be written.
Returns
0 in case of success, negative error code otherwise.