charger 2.1.0.0
Charger Click Driver

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

Topics

 Charger Commands List
 List of commands of Charger Click driver.
 
 Charger Settings
 Settings of Charger Click driver.
 
 Charger MikroBUS Map
 MikroBUS pin mapping of Charger Click driver.
 

Functions

void charger_cfg_setup (charger_cfg_t *cfg)
 Charger configuration object setup function.
 
void charger_gpio_selection (charger_cfg_t *cfg, charger_gpio_sel_t gpio_sel)
 Charger driver interface setup function.
 
err_t charger_init (charger_t *ctx, charger_cfg_t *cfg)
 Charger initialization function.
 
err_t charger_default_cfg (charger_t *ctx)
 Charger default configuration function.
 
err_t charger_check_communication (charger_t *ctx)
 Charger check communication function.
 
err_t charger_select_device (charger_t *ctx)
 Charger select device function.
 
err_t charger_read_scratchpad (charger_t *ctx, uint8_t page, uint8_t *data_out, uint8_t len)
 Charger read scratchpad function.
 
err_t charger_write_scratchpad (charger_t *ctx, uint8_t page, uint8_t *data_in, uint8_t len)
 Charger write scratchpad function.
 
err_t charger_copy_scratchpad (charger_t *ctx, uint8_t page)
 Charger copy scratchpad function.
 
err_t charger_recall_memory (charger_t *ctx, uint8_t page)
 Charger recall scratchpad function.
 
err_t charger_convert_temperature (charger_t *ctx)
 Charger convert temperature function.
 
err_t charger_convert_voltage (charger_t *ctx)
 Charger convert voltage function.
 
err_t charger_read_temperature (charger_t *ctx, float *temperature)
 Charger read temperature function.
 
err_t charger_read_batt_vdd (charger_t *ctx, float *voltage)
 Charger read battery VDD function.
 
err_t charger_read_system_vdd (charger_t *ctx, float *voltage)
 Charger read system VDD function.
 
err_t charger_read_current (charger_t *ctx, float *current)
 Charger read current function.
 
err_t charger_calibrate_current (charger_t *ctx)
 Charger calibrate current function.
 
err_t charger_write_elapsed_time (charger_t *ctx, uint32_t seconds)
 Charger write elapsed time function.
 
err_t charger_read_elapsed_time (charger_t *ctx, uint32_t *seconds)
 Charger read elapsed time function.
 

Detailed Description

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

◆ charger_calibrate_current()

err_t charger_calibrate_current ( charger_t * ctx)

Charger calibrate current function.

This function calibrates the zero current charging output.

Parameters
[in]ctx: Click context object. See charger_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
No battery should be connected to the click board during this calibration.

◆ charger_cfg_setup()

void charger_cfg_setup ( charger_cfg_t * cfg)

Charger configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ charger_check_communication()

err_t charger_check_communication ( charger_t * ctx)

Charger check communication function.

This function checks the communication by reading the ROM address as well as verifying family code and CRC 8.

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

◆ charger_convert_temperature()

err_t charger_convert_temperature ( charger_t * ctx)

Charger convert temperature function.

This function begins a temperature conversion.

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

◆ charger_convert_voltage()

err_t charger_convert_voltage ( charger_t * ctx)

Charger convert voltage function.

This function initiates a voltage analog-to-digital conversion cycle.

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

◆ charger_copy_scratchpad()

err_t charger_copy_scratchpad ( charger_t * ctx,
uint8_t page )

Charger copy scratchpad function.

This function copies the scratchpad page into the EEPROM/SRAM memory page.

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

◆ charger_default_cfg()

err_t charger_default_cfg ( charger_t * ctx)

Charger default configuration function.

This function executes a default configuration of Charger click board.

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

◆ charger_gpio_selection()

void charger_gpio_selection ( charger_cfg_t * cfg,
charger_gpio_sel_t gpio_sel )

Charger driver interface setup function.

This function sets a communication GPIO pin which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See charger_cfg_t object definition for detailed explanation.
[in]gpio_sel: GPIO pin selection. See charger_gpio_sel_t object definition for detailed explanation.
Returns
Nothing.
Note
This gpio selection should be called before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ charger_init()

err_t charger_init ( charger_t * ctx,
charger_cfg_t * cfg )

Charger initialization function.

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

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

◆ charger_read_batt_vdd()

err_t charger_read_batt_vdd ( charger_t * ctx,
float * voltage )

Charger read battery VDD function.

This function reads the battery input voltage.

Parameters
[in]ctx: Click context object. See charger_t object definition for detailed explanation.
[out]voltage: Voltage measurement output.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger_read_current()

err_t charger_read_current ( charger_t * ctx,
float * current )

Charger read current function.

This function reads the battery charging current.

Parameters
[in]ctx: Click context object. See charger_t object definition for detailed explanation.
[out]current: Current measurement output.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger_read_elapsed_time()

err_t charger_read_elapsed_time ( charger_t * ctx,
uint32_t * seconds )

Charger read elapsed time function.

This function reads the elapsed time meter counter.

Parameters
[in]ctx: Click context object. See charger_t object definition for detailed explanation.
[out]seconds: 32-bit seconds counter value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger_read_scratchpad()

err_t charger_read_scratchpad ( charger_t * ctx,
uint8_t page,
uint8_t * data_out,
uint8_t len )

Charger read scratchpad function.

This function reads a desired number of scratchpad bytes using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See charger_t object definition for detailed explanation.
[in]page: Page number 0-7.
[out]data_out: Output read scratchpad.
[in]len: Scratchpad length in bytes.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger_read_system_vdd()

err_t charger_read_system_vdd ( charger_t * ctx,
float * voltage )

Charger read system VDD function.

This function reads the mikroBUS system input voltage.

Parameters
[in]ctx: Click context object. See charger_t object definition for detailed explanation.
[out]voltage: Voltage measurement output.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger_read_temperature()

err_t charger_read_temperature ( charger_t * ctx,
float * temperature )

Charger read temperature function.

This function reads the chip internal temperature measurement in degrees Celsius.

Parameters
[in]ctx: Click context object. See charger_t object definition for detailed explanation.
[out]temperature: Temperature measurement output.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger_recall_memory()

err_t charger_recall_memory ( charger_t * ctx,
uint8_t page )

Charger recall scratchpad function.

This function recalls the stored values in EEPROM/SRAM memory page to the scratchpad page.

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

◆ charger_select_device()

err_t charger_select_device ( charger_t * ctx)

Charger select device function.

This function selects the device by performing a skip or match ROM commands depending on the address value set in the ctx->address.

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

◆ charger_write_elapsed_time()

err_t charger_write_elapsed_time ( charger_t * ctx,
uint32_t seconds )

Charger write elapsed time function.

This function writes the elapsed time meter counter.

Parameters
[in]ctx: Click context object. See charger_t object definition for detailed explanation.
[in]seconds: 32-bit seconds counter value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ charger_write_scratchpad()

err_t charger_write_scratchpad ( charger_t * ctx,
uint8_t page,
uint8_t * data_in,
uint8_t len )

Charger write scratchpad function.

This function writes a desired number of scratchpad bytes using One Wire communication protocol.

Parameters
[in]ctx: Click context object. See charger_t object definition for detailed explanation.
[in]page: Page number 0-7.
[in]data_in: Scratchpad to be written.
[in]len: Scratchpad length in bytes.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.