digipot 2.0.0.0
DIGI POT Click Driver

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

Topics

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

Functions

void digipot_cfg_setup (digipot_cfg_t *cfg)
 DIGI POT configuration object setup function.
 
err_t digipot_init (digipot_t *ctx, digipot_cfg_t *cfg)
 DIGI POT initialization function.
 
void digipot_generic_transfer (digipot_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
void digipot_set_wiper_positions (digipot_t *ctx, uint8_t wiper_pos)
 Set wiper position.
 
float digipot_convert_output (uint16_t adc_val, float v_ref)
 Convert ADC value to volatage.
 

Detailed Description

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

◆ digipot_cfg_setup()

void digipot_cfg_setup ( digipot_cfg_t * cfg)

DIGI POT configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ digipot_convert_output()

float digipot_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 ).

◆ digipot_generic_transfer()

void digipot_generic_transfer ( digipot_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 digipot_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.

◆ digipot_init()

err_t digipot_init ( digipot_t * ctx,
digipot_cfg_t * cfg )

DIGI POT initialization function.

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

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

◆ digipot_set_wiper_positions()

void digipot_set_wiper_positions ( digipot_t * ctx,
uint8_t wiper_pos )

Set wiper position.

The function sets 8-bit wiper positions data.

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