charger3 2.0.0.0
Charger 3 Click Driver

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

Topics

 Charger 3 Registers Settings
 Settings for registers of Charger 3 Click driver.
 
 Charger 3 MikroBUS Map
 MikroBUS pin mapping of Charger 3 Click driver.
 
 Charger3_command
 
 Mode
 
 Status
 
 Charger3_dummy
 

Functions

void charger3_cfg_setup (charger3_cfg_t *cfg)
 Charger 3 configuration object setup function.
 
err_t charger3_init (charger3_t *ctx, charger3_cfg_t *cfg)
 Charger 3 initialization function.
 
void charger3_default_cfg (charger3_t *ctx)
 Charger 3 default configuration function.
 
err_t charger3_generic_write (charger3_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Charger 3 I2C writing function.
 
err_t charger3_generic_read (charger3_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Charger 3 I2C reading function.
 
void charger3_enable_write (charger3_t *ctx)
 Charger 3 enable write function.
 
void charger3_operating_mode (charger3_t *ctx, uint8_t mode)
 Charger 3 set operating mode function.
 
void charger3_write_rdac (charger3_t *ctx, uint16_t rdac_data)
 Charger 3 write to rdac function.
 
uint8_t charger3_set_digipot_res (charger3_t *ctx, uint16_t res_ohm)
 Charger 3 set digital potentiometer resistance function.
 
uint8_t charger3_set_current (charger3_t *ctx, float curr_value)
 Charger 3 set current function.
 
uint16_t charger3_read_rdac (charger3_t *ctx)
 Charger 3 read rdac function.
 
float charger3_calc_digipot_res (charger3_t *ctx)
 Charger 3 calculate digipot resistance function.
 

Detailed Description

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

◆ charger3_calc_digipot_res()

float charger3_calc_digipot_res ( charger3_t * ctx)

Charger 3 calculate digipot resistance function.

This function returns calculated resistance of AD5175.

Parameters
[in]ctx: Click context object. See charger3_t object definition for detailed explanation.
Returns
Digipot resistance value.
Note
If calculating the total resistance on PROG pin, keep in mind that there is 1kohm resistor in series with the AD5175 digipot.

◆ charger3_cfg_setup()

void charger3_cfg_setup ( charger3_cfg_t * cfg)

Charger 3 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ charger3_default_cfg()

void charger3_default_cfg ( charger3_t * ctx)

Charger 3 default configuration function.

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

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

◆ charger3_enable_write()

void charger3_enable_write ( charger3_t * ctx)

Charger 3 enable write function.

This function enables write to the AD5175 Single-Channel, 1024-Position, Digital Rheostat over I2C Interface.

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

◆ charger3_generic_read()

err_t charger3_generic_read ( charger3_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Charger 3 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 charger3_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ charger3_generic_write()

err_t charger3_generic_write ( charger3_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Charger 3 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 charger3_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ charger3_init()

err_t charger3_init ( charger3_t * ctx,
charger3_cfg_t * cfg )

Charger 3 initialization function.

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

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

◆ charger3_operating_mode()

void charger3_operating_mode ( charger3_t * ctx,
uint8_t mode )

Charger 3 set operating mode function.

This function shorts or creates open circuit on PROG pin enabling or disabling charging of the battery.

Parameters
[in]ctx: Click context object. See charger3_t object definition for detailed explanation.
[in]mode: Operating mode.
  • 0x00 ( CHARGER3_ENABLE_CHARGING )- Shorts PROG pin, enabling battery charging,
  • 0x01 ( CHARGER3_DISABLE_CHARGING )- Creates open circuit on PROG pin, disabling battery charging.
Note
None.

◆ charger3_read_rdac()

uint16_t charger3_read_rdac ( charger3_t * ctx)

Charger 3 read rdac function.

This function reads the 10-bit value of RDAC register of AD5175.

Parameters
[in]ctx: Click context object. See charger3_t object definition for detailed explanation.
Returns
Value of 10-bit RDAC register content.
Note
None.

◆ charger3_set_current()

uint8_t charger3_set_current ( charger3_t * ctx,
float curr_value )

Charger 3 set current function.

This function sets the battery charging current.

Parameters
[in]ctx: Click context object. See charger3_t object definition for detailed explanation.
[in]curr_value: Current value.
Returns
  • 0x00 ( CHARGER3_STATUS_ERROR_SUCCESS ),
  • 0x01 ( CHARGER3_STATUS_ERROR_FAILURE ).
Note
None.

◆ charger3_set_digipot_res()

uint8_t charger3_set_digipot_res ( charger3_t * ctx,
uint16_t res_ohm )

Charger 3 set digital potentiometer resistance function.

This function sets the actual resistance of AD5175 digital potentiometer.

Parameters
[in]ctx: Click context object. See charger3_t object definition for detailed explanation.
[in]res_ohm: Resistance value.
Returns
  • 0x00 ( CHARGER3_STATUS_ERROR_SUCCESS ),
  • 0x01 ( CHARGER3_STATUS_ERROR_FAILURE ).
Note
When setting the total resistance on PROG pin, keep in mind that there is 1kohm resistor in series with the AD5175 digipot.

◆ charger3_write_rdac()

void charger3_write_rdac ( charger3_t * ctx,
uint16_t rdac_data )

Charger 3 write to rdac function.

This function writes 10-bit data directly to the RDAC register of AD5175.

Parameters
[in]ctx: Click context object. See charger3_t object definition for detailed explanation.
[in]rdac_data: RDAC value.
Note
None.