charger25 2.1.0.0
Charger 25 Click Driver

API for configuring and manipulating Charger 25 Click driver. More...

Topics

 Charger 25 Registers List
 List of registers of Charger 25 Click driver.
 
 Charger 25 Registers Settings
 Settings for registers of Charger 25 Click driver.
 
 Charger 25 MikroBUS Map
 MikroBUS pin mapping of Charger 25 Click driver.
 

Functions

void charger25_cfg_setup (charger25_cfg_t *cfg)
 Charger 25 configuration object setup function.
 
err_t charger25_init (charger25_t *ctx, charger25_cfg_t *cfg)
 Charger 25 initialization function.
 
err_t charger25_default_cfg (charger25_t *ctx)
 Charger 25 default configuration function.
 
err_t charger25_generic_write (charger25_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Charger 25 I2C writing function.
 
err_t charger25_generic_read (charger25_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Charger 25 I2C reading function.
 
void charger25_set_qon_pin (charger25_t *ctx, uint8_t state)
 Charger 25 set QON pin state function.
 
void charger25_enable (charger25_t *ctx)
 Charger 25 charge enable function.
 
void charger25_disable (charger25_t *ctx)
 Charger 25 charge disable function.
 
uint8_t charger25_get_interrupt (charger25_t *ctx)
 Charger 25 get interrupt function.
 
err_t charger25_sw_reset (charger25_t *ctx)
 Charger 25 software reset function.
 
err_t charger25_get_vbat (charger25_t *ctx, uint16_t *vbat)
 Charger 25 get VBAT function.
 
err_t charger25_get_vsys_min (charger25_t *ctx, uint16_t *vsys_min)
 Charger 25 get VSYS function.
 
err_t charger25_set_adc_control (charger25_t *ctx, charger25_adc_ctrl_t adc_ctrl)
 Charger 25 set ADC control function.
 
err_t charger25_set_adc_function (charger25_t *ctx, charger25_adc_func_t adc_func)
 Charger 25 set ADC function function.
 
err_t charger25_get_vbat_lim (charger25_t *ctx, uint16_t *vtg_lim)
 Charger 25 get battery voltage limit function.
 
err_t charger25_set_vbat_lim (charger25_t *ctx, uint16_t vtg_lim)
 Charger 25 set battery voltage limit function.
 
err_t charger25_get_cell_count (charger25_t *ctx, uint8_t *cell_count)
 Charger 25 get battery cell count function.
 
err_t charger25_set_cell_count (charger25_t *ctx, uint8_t cell_count)
 Charger 25 set battery cell count function.
 
err_t charger25_get_current_limit (charger25_t *ctx, uint16_t *current_lim)
 Charger 25 get charge current limit function.
 
err_t charger25_set_current_limit (charger25_t *ctx, uint16_t current_lim)
 Charger 25 set charge current limit function.
 
err_t charger25_get_input_vtg_limit (charger25_t *ctx, uint16_t *input_vtg_limit)
 Charger 25 get input voltage limit function.
 
err_t charger25_set_input_vtg_limit (charger25_t *ctx, uint16_t input_vtg_limit)
 Charger 25 set input voltage limit function.
 
err_t charger25_get_input_curr_limit (charger25_t *ctx, uint16_t *input_curr_limit)
 Charger 25 get input current limit function.
 
err_t charger25_set_input_curr_limit (charger25_t *ctx, uint16_t input_curr_limit)
 Charger 25 set input current limit function.
 
err_t charger25_get_status (charger25_t *ctx, charger25_status_t *status)
 Charger 25 get charging status function.
 

Detailed Description

API for configuring and manipulating Charger 25 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

◆ charger25_cfg_setup()

void charger25_cfg_setup ( charger25_cfg_t * cfg)

Charger 25 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ charger25_default_cfg()

err_t charger25_default_cfg ( charger25_t * ctx)

Charger 25 default configuration function.

This function executes a default configuration of Charger 25 click board.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ charger25_disable()

void charger25_disable ( charger25_t * ctx)

Charger 25 charge disable function.

This function disable charging by sets the state of the EN pin high of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ charger25_enable()

void charger25_enable ( charger25_t * ctx)

Charger 25 charge enable function.

This function enable charging by sets the state of the EN pin low of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ charger25_generic_read()

err_t charger25_generic_read ( charger25_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Charger 25 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_generic_write()

err_t charger25_generic_write ( charger25_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Charger 25 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_get_cell_count()

err_t charger25_get_cell_count ( charger25_t * ctx,
uint8_t * cell_count )

Charger 25 get battery cell count function.

This function gets the battery cell count of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[out]cell_count: Battery cell count.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Default power on VSYSMIN list below:
  • 1s: 3.5V,
  • 2s: 7V,
  • 3s: 9V,
  • 4s: 12V.

◆ charger25_get_current_limit()

err_t charger25_get_current_limit ( charger25_t * ctx,
uint16_t * current_lim )

Charger 25 get charge current limit function.

This function gets the charge current limit of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[out]current_lim: Charge current limit [50mA-5000mA].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_get_input_curr_limit()

err_t charger25_get_input_curr_limit ( charger25_t * ctx,
uint16_t * input_curr_limit )

Charger 25 get input current limit function.

This function gets the input current limi of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[out]input_curr_limit: Input current limit [100mA-3300mA].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_get_input_vtg_limit()

err_t charger25_get_input_vtg_limit ( charger25_t * ctx,
uint16_t * input_vtg_limit )

Charger 25 get input voltage limit function.

This function gets the absolute VINDPM threshold of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[out]input_vtg_limit: Input voltage limit [3600mV-22000mV].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_get_interrupt()

uint8_t charger25_get_interrupt ( charger25_t * ctx)

Charger 25 get interrupt function.

This function get states of the Interrupt [INT] pin of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ charger25_get_status()

err_t charger25_get_status ( charger25_t * ctx,
charger25_status_t * status )

Charger 25 get charging status function.

This function gets charging status of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[out]status: Charger status. See charger25_status_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_get_vbat()

err_t charger25_get_vbat ( charger25_t * ctx,
uint16_t * vbat )

Charger 25 get VBAT function.

This function gets the battery remote sensing voltage ADC reading of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[out]vbat: Battery remote sensing voltage [0-20000mV]
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_get_vbat_lim()

err_t charger25_get_vbat_lim ( charger25_t * ctx,
uint16_t * vtg_lim )

Charger 25 get battery voltage limit function.

This function gets the battery voltage limit of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[out]vtg_lim: Battery voltage limit [3000-18800mV].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_get_vsys_min()

err_t charger25_get_vsys_min ( charger25_t * ctx,
uint16_t * vsys_min )

Charger 25 get VSYS function.

This function gets the minimal system voltage of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[out]vsys_min: Minimal system voltage [2500-16000mV]
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_init()

err_t charger25_init ( charger25_t * ctx,
charger25_cfg_t * cfg )

Charger 25 initialization function.

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

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

◆ charger25_set_adc_control()

err_t charger25_set_adc_control ( charger25_t * ctx,
charger25_adc_ctrl_t adc_ctrl )

Charger 25 set ADC control function.

This function configure ADC control of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]adc_ctrl: ADC control object. See charger25_adc_ctrl_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_set_adc_function()

err_t charger25_set_adc_function ( charger25_t * ctx,
charger25_adc_func_t adc_func )

Charger 25 set ADC function function.

This function configure ADC function of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]adc_func: ADC function object. See charger25_adc_func_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_set_cell_count()

err_t charger25_set_cell_count ( charger25_t * ctx,
uint8_t cell_count )

Charger 25 set battery cell count function.

This function set the battery cell count of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]cell_count: Battery cell count [1-4].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Default power on VSYSMIN list below:
  • 1s: 3.5V,
  • 2s: 7V,
  • 3s: 9V,
  • 4s: 12V.

◆ charger25_set_current_limit()

err_t charger25_set_current_limit ( charger25_t * ctx,
uint16_t current_lim )

Charger 25 set charge current limit function.

This function set the charge current limit of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]current_lim: Charge current limit [50mA-5000mA].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_set_input_curr_limit()

err_t charger25_set_input_curr_limit ( charger25_t * ctx,
uint16_t input_curr_limit )

Charger 25 set input current limit function.

This function set the input current limi of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]input_curr_limit: Input current limit [100mA-3300mA].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_set_input_vtg_limit()

err_t charger25_set_input_vtg_limit ( charger25_t * ctx,
uint16_t input_vtg_limit )

Charger 25 set input voltage limit function.

This function set the absolute VINDPM threshold of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]input_vtg_limit: Input voltage limit [3600mV-22000mV].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger25_set_qon_pin()

void charger25_set_qon_pin ( charger25_t * ctx,
uint8_t state )

Charger 25 set QON pin state function.

This function sets the state of the ship fet enable or system power reset control input [QON] pin of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]state:QON pin state.
Returns
Nothing.
Note
None.

◆ charger25_set_vbat_lim()

err_t charger25_set_vbat_lim ( charger25_t * ctx,
uint16_t vtg_lim )

Charger 25 set battery voltage limit function.

This function set the battery voltage limit of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
[in]vtg_lim: Battery voltage limit [3000-18800mV].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Default power-on battery voltage regulation limit:
  • 1s: 4.2V,
  • 2s: 8.4V,
  • 3s: 12.6V,
  • 4s: 16.8V.

◆ charger25_sw_reset()

err_t charger25_sw_reset ( charger25_t * ctx)

Charger 25 software reset function.

This function is used to software reset of the BQ25792 I2C Controlled, 1-4 Cell, 5-A Buck-Boost Battery Charger with Dual-Input Selector and USB PD 3.0 OTG Output on the Charger 25 click board™.

Parameters
[in]ctx: Click context object. See charger25_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.