pmic  2.1.0.0
Modules | Functions
PMIC Click Driver

API for configuring and manipulating PMIC Click driver. More...

Modules

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

Functions

void pmic_cfg_setup (pmic_cfg_t *cfg)
 PMIC configuration object setup function. More...
 
err_t pmic_init (pmic_t *ctx, pmic_cfg_t *cfg)
 PMIC initialization function. More...
 
err_t pmic_default_cfg (pmic_t *ctx)
 PMIC default configuration function. More...
 
err_t pmic_reg_write (pmic_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len)
 PMIC reg write function. More...
 
err_t pmic_reg_read (pmic_t *ctx, uint16_t reg, uint8_t *data_out, uint8_t len)
 PMIC reg read function. More...
 
err_t pmic_reg_write_byte (pmic_t *ctx, uint16_t reg, uint8_t data_in)
 PMIC reg write byte function. More...
 
err_t pmic_reg_read_byte (pmic_t *ctx, uint16_t reg, uint8_t *data_out)
 PMIC reg read byte function. More...
 
uint8_t pmic_get_int_pin (pmic_t *ctx)
 PMIC get int pin function. More...
 
err_t pmic_wait_for_event (pmic_t *ctx, uint16_t evt_set_reg, uint8_t bit_mask)
 PMIC wait for event function. More...
 
err_t pmic_get_vbat (pmic_t *ctx, uint16_t *vbat)
 PMIC get vbat function. More...
 
err_t pmic_get_vbus (pmic_t *ctx, uint16_t *vbus)
 PMIC get vbus function. More...
 
err_t pmic_get_vsys (pmic_t *ctx, uint16_t *vsys)
 PMIC get vsys function. More...
 
err_t pmic_set_charging_current (pmic_t *ctx, uint16_t current)
 PMIC set charging current function. More...
 

Detailed Description

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

◆ pmic_cfg_setup()

void pmic_cfg_setup ( pmic_cfg_t cfg)

PMIC configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ pmic_default_cfg()

err_t pmic_default_cfg ( pmic_t ctx)

PMIC default configuration function.

This function executes a default configuration of PMIC Click board.

Parameters
[in]ctx: Click context object. See pmic_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.

◆ pmic_get_int_pin()

uint8_t pmic_get_int_pin ( pmic_t ctx)

PMIC get int pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See pmic_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ pmic_get_vbat()

err_t pmic_get_vbat ( pmic_t ctx,
uint16_t *  vbat 
)

PMIC get vbat function.

This function reads the VBAT measurement results in millivolts.

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

◆ pmic_get_vbus()

err_t pmic_get_vbus ( pmic_t ctx,
uint16_t *  vbus 
)

PMIC get vbus function.

This function reads the VBUS measurement results in millivolts.

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

◆ pmic_get_vsys()

err_t pmic_get_vsys ( pmic_t ctx,
uint16_t *  vsys 
)

PMIC get vsys function.

This function reads the VSYS measurement results in millivolts.

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

◆ pmic_init()

err_t pmic_init ( pmic_t ctx,
pmic_cfg_t cfg 
)

PMIC initialization function.

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

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

◆ pmic_reg_read()

err_t pmic_reg_read ( pmic_t ctx,
uint16_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

PMIC reg read 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 pmic_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.

◆ pmic_reg_read_byte()

err_t pmic_reg_read_byte ( pmic_t ctx,
uint16_t  reg,
uint8_t *  data_out 
)

PMIC reg read byte function.

This function reads a data byte from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See pmic_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pmic_reg_write()

err_t pmic_reg_write ( pmic_t ctx,
uint16_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

PMIC reg write 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 pmic_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.

◆ pmic_reg_write_byte()

err_t pmic_reg_write_byte ( pmic_t ctx,
uint16_t  reg,
uint8_t  data_in 
)

PMIC reg write byte function.

This function writes a data byte to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See pmic_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pmic_set_charging_current()

err_t pmic_set_charging_current ( pmic_t ctx,
uint16_t  current 
)

PMIC set charging current function.

This function sets the charging current limit.

Parameters
[in]ctx: Click context object. See pmic_t object definition for detailed explanation.
[in]current: Current limit from 32mA to 800mA in 2mA steps.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Charger must be disabled before changing the current setting.

◆ pmic_wait_for_event()

err_t pmic_wait_for_event ( pmic_t ctx,
uint16_t  evt_set_reg,
uint8_t  bit_mask 
)

PMIC wait for event function.

This function waits for a desired bits to be set in the selected event set register.

Parameters
[in]ctx: Click context object. See pmic_t object definition for detailed explanation.
[in]evt_set_reg: Event set register address.
[in]bit_mask: Bit mask to wait for.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.