digipot2 2.0.0.0
DIGI POT 2 Click Driver

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

Topics

 DIGI POT 2 MikroBUS Map
 MikroBUS pin mapping of DIGI POT 2 Click driver.
 
 DIGI POT 2 Macros
 Macros of Click driver.
 

Functions

void digipot2_cfg_setup (digipot2_cfg_t *cfg)
 DIGI POT 2 configuration object setup function.
 
err_t digipot2_init (digipot2_t *ctx, digipot2_cfg_t *cfg)
 DIGI POT 2 initialization function.
 
void digipot2_generic_transfer (digipot2_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
void digipot2_set_wiper_positions (digipot2_t *ctx, uint8_t wiper_pos)
 Set wiper position.
 
float digipot2_convert_output (uint16_t adc_val, float v_ref)
 Convert ADC value to volatage.
 

Detailed Description

API for configuring and manipulating DIGI POT 2 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

◆ digipot2_cfg_setup()

void digipot2_cfg_setup ( digipot2_cfg_t * cfg)

DIGI POT 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ digipot2_convert_output()

float digipot2_convert_output ( uint16_t adc_val,
float v_ref )

Convert ADC value to volatage.

The function convert 10-bit ADC value to volatage reference.

Parameters
[in]adc_val: 10-bit ADC value.
[in]wiper_pos: float voltage reference: 3.3V or 5V.
Returns
float voltage ( 0V - 3.3V ) or ( 0V - 5.0V ).

◆ digipot2_generic_transfer()

void digipot2_generic_transfer ( digipot2_t * ctx,
uint8_t * wr_buf,
uint16_t wr_len,
uint8_t * rd_buf,
uint16_t rd_len )

Generic transfer function.

Generic SPI transfer, for sending and receiving packages

Parameters
[in]ctx: Click context object. See digipot2_t object definition for detailed explanation.
[in]wr_buf: Write data buffer
[in]wr_len: Number of byte in write data buffer
[out]rd_buf: Read data buffer
[in]rd_len: Number of byte in read data buffer
Returns
Nothing.

◆ digipot2_init()

err_t digipot2_init ( digipot2_t * ctx,
digipot2_cfg_t * cfg )

DIGI POT 2 initialization function.

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

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

◆ digipot2_set_wiper_positions()

void digipot2_set_wiper_positions ( digipot2_t * ctx,
uint8_t wiper_pos )

Set wiper position.

The function sets 8-bit wiper positions data.

Parameters
[in]ctx: Click context object. See digipot2_t object definition for detailed explanation.
[out]wiper_pos: uint8_t wiper positions data.
Returns
Nothing.