digipot12 2.1.0.0
DIGI POT 12 Click Driver

API for configuring and manipulating DIGI POT 12 Click driver. More...

Topics

 DIGI POT 12 Registers List
 List of registers of DIGI POT 12 Click driver.
 
 DIGI POT 12 Registers Settings
 Settings for registers of DIGI POT 12 Click driver.
 
 DIGI POT 12 MikroBUS Map
 MikroBUS pin mapping of DIGI POT 12 Click driver.
 
 Digipot12_ctrl
 
 Digipot12_addr
 
 Digipot12_wiper_sel
 
 Digipot12_mask
 

Functions

void digipot12_cfg_setup (digipot12_cfg_t *cfg)
 DIGI POT 12 configuration object setup function.
 
err_t digipot12_init (digipot12_t *ctx, digipot12_cfg_t *cfg)
 DIGI POT 12 initialization function.
 
err_t digipot12_default_cfg (digipot12_t *ctx)
 DIGI POT 12 default configuration function.
 
void digipot12_device_enable (digipot12_t *ctx)
 DIGI POT 12 enable the device function.
 
void digipot12_hw_reset (digipot12_t *ctx)
 DIGI POT 12 hardware reset function.
 
err_t digipot12_write_data (digipot12_t *ctx, uint8_t ctrl, uint8_t addr, uint8_t data_in)
 DIGI POT 12 I2C writing function.
 
err_t digipot12_read_data (digipot12_t *ctx, uint8_t addr, uint8_t mask, uint8_t *data_out)
 DIGI POT 12 I2C reading function.
 
err_t digipot12_write_rdac (digipot12_t *ctx, uint8_t addr, uint8_t data_in)
 DIGI POT 12 write the RDAC function.
 
err_t digipot12_read_rdac (digipot12_t *ctx, uint8_t addr, uint8_t *data_out)
 DIGI POT 12 read the RDAC function.
 
err_t digipot12_set_wiper_1 (digipot12_t *ctx, uint8_t wiper_pos)
 DIGI POT 12 set wiper 1 function.
 
err_t digipot12_set_wiper_2 (digipot12_t *ctx, uint8_t wiper_pos)
 DIGI POT 12 set wiper 2 function.
 
err_t digipot12_set_resistance (digipot12_t *ctx, uint8_t wiper_sel, float res_kohm)
 DIGI POT 12 set the resistance function.
 
err_t digipot12_get_resistance (digipot12_t *ctx, uint8_t wiper_sel, float *res_kohm)
 DIGI POT 12 get the resistance function.
 

Detailed Description

API for configuring and manipulating DIGI POT 12 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ digipot12_cfg_setup()

void digipot12_cfg_setup ( digipot12_cfg_t * cfg)

DIGI POT 12 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See digipot12_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ digipot12_default_cfg()

err_t digipot12_default_cfg ( digipot12_t * ctx)

DIGI POT 12 default configuration function.

This function executes a default configuration of DIGI POT 12 click board.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ digipot12_device_enable()

void digipot12_device_enable ( digipot12_t * ctx)

DIGI POT 12 enable the device function.

This function performs the enable the device of the AD5142A, Dual Channel, 256-Position, I2C, Nonvolatile Digital Potentiometer on the DIGI POT 12 Click board™.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_get_resistance()

err_t digipot12_get_resistance ( digipot12_t * ctx,
uint8_t wiper_sel,
float * res_kohm )

DIGI POT 12 get the resistance function.

This function gets the resistance of the selected wiper of the AD5142A, Dual Channel, 256-Position, I2C, Nonvolatile Digital Potentiometer on the DIGI POT 12 Click board™.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
[in]wiper_sel: Wiper selection.
[out]res_kohm: Rwb1/2 (wiper-to-B) resistance from 0.0 to 10.0 [kOhm].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_hw_reset()

void digipot12_hw_reset ( digipot12_t * ctx)

DIGI POT 12 hardware reset function.

This function perform the hardware reset of the AD5142A, Dual Channel, 256-Position, I2C, Nonvolatile Digital Potentiometer on the DIGI POT 12 Click board™.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_init()

err_t digipot12_init ( digipot12_t * ctx,
digipot12_cfg_t * cfg )

DIGI POT 12 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See digipot12_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See digipot12_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_read_data()

err_t digipot12_read_data ( digipot12_t * ctx,
uint8_t addr,
uint8_t mask,
uint8_t * data_out )

DIGI POT 12 I2C reading function.

This function reads a byte of data from the selected address and data bits mask by using I2C serial interface.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
[in]addr: Address bits - wiper selection.
[in]mask: Data bits mask.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_read_rdac()

err_t digipot12_read_rdac ( digipot12_t * ctx,
uint8_t addr,
uint8_t * data_out )

DIGI POT 12 read the RDAC function.

This function reads the RDAC data value of the AD5142A, Dual Channel, 256-Position, I2C, Nonvolatile Digital Potentiometer on the DIGI POT 12 Click board™.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
[in]addr: Address bits - wiper selection.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_set_resistance()

err_t digipot12_set_resistance ( digipot12_t * ctx,
uint8_t wiper_sel,
float res_kohm )

DIGI POT 12 set the resistance function.

This function sets the resistance of the selected wiper of the AD5142A, Dual Channel, 256-Position, I2C, Nonvolatile Digital Potentiometer on the DIGI POT 12 Click board™.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
[in]wiper_sel: Wiper selection.
[in]res_kohm: Rwb1/2 (wiper-to-B) resistance from 0.0 to 10.0 [kOhm].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_set_wiper_1()

err_t digipot12_set_wiper_1 ( digipot12_t * ctx,
uint8_t wiper_pos )

DIGI POT 12 set wiper 1 function.

This function sets the position of the wiper 1 of the AD5142A, Dual Channel, 256-Position, I2C, Nonvolatile Digital Potentiometer on the DIGI POT 12 Click board™.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
[in]wiper_pos: Wiper 1 position [0-255].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_set_wiper_2()

err_t digipot12_set_wiper_2 ( digipot12_t * ctx,
uint8_t wiper_pos )

DIGI POT 12 set wiper 2 function.

This function sets the position of the wiper 2 of the AD5142A, Dual Channel, 256-Position, I2C, Nonvolatile Digital Potentiometer on the DIGI POT 12 Click board™.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
[in]wiper_pos: Wiper 2 position [0-255].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_write_data()

err_t digipot12_write_data ( digipot12_t * ctx,
uint8_t ctrl,
uint8_t addr,
uint8_t data_in )

DIGI POT 12 I2C writing function.

This function writes a byte of data for the selected command and address by using I2C serial interface.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
[in]ctrl: Control bits - commands operation.
[in]addr: Address bits - wiper selection.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ digipot12_write_rdac()

err_t digipot12_write_rdac ( digipot12_t * ctx,
uint8_t addr,
uint8_t data_in )

DIGI POT 12 write the RDAC function.

This function writes RDAC data value of the AD5142A, Dual Channel, 256-Position, I2C, Nonvolatile Digital Potentiometer on the DIGI POT 12 Click board™.

Parameters
[in]ctx: Click context object. See digipot12_t object definition for detailed explanation.
[in]addr: Address bits - wiper selection.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.