current2 2.0.0.0
Public function

Functions

void current2_cfg_setup (current2_cfg_t *cfg)
 Config Object Initialization function.
 
uint8_t current2_init (current2_t *ctx, current2_cfg_t *cfg)
 Initialization function.
 
void current2_generic_transfer (current2_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
uint16_t current2_get_adc (current2_t *ctx)
 Get ADC function.
 
uint16_t current2_get_average_adc (current2_t *ctx, uint8_t n_samp)
 Get Averaged ADC function.
 
uint16_t current2_get_current (current2_t *ctx, uint8_t n_sample)
 Get Current function.
 

Detailed Description

Function Documentation

◆ current2_cfg_setup()

void current2_cfg_setup ( current2_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ current2_generic_transfer()

void current2_generic_transfer ( current2_t * ctx,
uint8_t * wr_buf,
uint16_t wr_len,
uint8_t * rd_buf,
uint16_t rd_len )

Generic transfer function.

Parameters
ctxClick object.
wr_bufWrite data buffer
wr_lenNumber of byte in write data buffer
rd_bufRead data buffer
rd_lenNumber of byte in read data buffer

@description Generic SPI transfer, for sending and receiving packages

◆ current2_get_adc()

uint16_t current2_get_adc ( current2_t * ctx)

Get ADC function.

Parameters
ctxClick object.

@description Function returns 10-bit digital value from the AD converter.

◆ current2_get_average_adc()

uint16_t current2_get_average_adc ( current2_t * ctx,
uint8_t n_samp )

Get Averaged ADC function.

Parameters
ctxClick object.
n_sampNumber of samples to be used for averaging

@description Function returns averaged result from the AD converter.

◆ current2_get_current()

uint16_t current2_get_current ( current2_t * ctx,
uint8_t n_sample )

Get Current function.

Parameters
ctxClick object.
n_sampleNumber of samples to be used for averaging

@description Function reads averaged result from the ADC and performs a calculations to get current in proper value [mA].

◆ current2_init()

uint8_t current2_init ( current2_t * ctx,
current2_cfg_t * cfg )

Initialization function.

Parameters
current2Click object.
cfgClick configuration structure.

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