powerbank2  2.0.0.0
Functions

Functions

void powerbank2_cfg_setup (powerbank2_cfg_t *cfg)
 Config Object Initialization function. More...
 
POWERBANK2_RETVAL powerbank2_init (powerbank2_t *ctx, powerbank2_cfg_t *cfg)
 Initialization function. More...
 
void powerbank2_generic_write (powerbank2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function. More...
 
void powerbank2_read (powerbank2_t *ctx, uint16_t *result)
 Read function. More...
 
uint16_t powerbank2_read_voltage (powerbank2_t *ctx, uint16_t v_ref)
 Read voltage function. More...
 

Detailed Description

Function Documentation

◆ powerbank2_cfg_setup()

void powerbank2_cfg_setup ( powerbank2_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.

◆ powerbank2_generic_write()

void powerbank2_generic_write ( powerbank2_t ctx,
uint8_t  reg,
uint8_t *  data_buf,
uint8_t  len 
)

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ powerbank2_init()

POWERBANK2_RETVAL powerbank2_init ( powerbank2_t ctx,
powerbank2_cfg_t cfg 
)

Initialization function.

Parameters
powerbank2Click object.
cfgClick configuration structure.

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

◆ powerbank2_read()

void powerbank2_read ( powerbank2_t ctx,
uint16_t *  result 
)

Read function.

Parameters
ctxClick object.
resultResult.

@description This function reads data from the desired register.

◆ powerbank2_read_voltage()

uint16_t powerbank2_read_voltage ( powerbank2_t ctx,
uint16_t  v_ref 
)

Read voltage function.

Parameters
ctxClick object.
v_ref16-bit value representing power supply voltage.
Returns
result 12-bit value that represents voltage in millivolts.

@description This function is used to calculate voltage of the connected battery.