powerbank 2.0.0.0

Functions

void powerbank_cfg_setup (powerbank_cfg_t *cfg)
 Config Object Initialization function.
 
POWERBANK_RETVAL powerbank_init (powerbank_t *ctx, powerbank_cfg_t *cfg)
 Initialization function.
 
void powerbank_generic_write (powerbank_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void powerbank_generic_read (powerbank_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint16_t powerbank_read_data (powerbank_t *ctx)
 Read data function.
 
uint16_t powerbank_read_voltage (powerbank_t *ctx, uint16_t v_ref)
 Read voltage function.
 

Detailed Description

Function Documentation

◆ powerbank_cfg_setup()

void powerbank_cfg_setup ( powerbank_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.

◆ powerbank_generic_read()

void powerbank_generic_read ( powerbank_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ powerbank_generic_write()

void powerbank_generic_write ( powerbank_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.

◆ powerbank_init()

POWERBANK_RETVAL powerbank_init ( powerbank_t * ctx,
powerbank_cfg_t * cfg )

Initialization function.

Parameters
powerbankClick object.
cfgClick configuration structure.

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

◆ powerbank_read_data()

uint16_t powerbank_read_data ( powerbank_t * ctx)

Read data function.

Parameters
ctxClick object.
Returns
result 16-bit value that represents ADC value from output register

@description This function is used to read raw data from MCP3221.

◆ powerbank_read_voltage()

uint16_t powerbank_read_voltage ( powerbank_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.