battmon3 2.0.0.0
BATT-MON 3 Click Driver

API for configuring and manipulating BATT-MON 3 Click driver. More...

Topics

 BATT-MON 3 Registers List
 List of registers of BATT-MON 3 Click driver.
 
 BATT-MON 3 Registers Settings
 Settings for registers of BATT-MON 3 Click driver.
 
 BATT-MON 3 MikroBUS Map
 MikroBUS pin mapping of BATT-MON 3 Click driver.
 

Functions

void battmon3_cfg_setup (battmon3_cfg_t *cfg)
 BATT-MON 3 configuration object setup function.
 
err_t battmon3_init (battmon3_t *ctx, battmon3_cfg_t *cfg)
 BATT-MON 3 initialization function.
 
err_t battmon3_default_cfg (battmon3_t *ctx)
 BATT-MON 3 default configuration function.
 
err_t battmon3_generic_write (battmon3_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 BATT-MON 3 I2C writing function.
 
err_t battmon3_generic_read (battmon3_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 BATT-MON 3 I2C reading function.
 
err_t battmon3_write_two_bytes (battmon3_t *ctx, uint8_t reg, uint16_t data_in)
 BATT-MON 3 write two bytes function.
 
err_t battmon3_read_two_bytes (battmon3_t *ctx, uint8_t reg, uint16_t *data_out)
 BATT-MON 3 read two bytes function.
 
err_t battmon3_write_control (battmon3_t *ctx, uint16_t control)
 BATT-MON 3 write control function.
 
err_t battmon3_read_control (battmon3_t *ctx, uint16_t control, uint16_t *data_out)
 BATT-MON 3 read control function.
 
err_t battmon3_write_data_flash (battmon3_t *ctx, uint16_t address, uint8_t *tx_buf, uint8_t tx_len)
 BATT-MON 3 write data flash function.
 
err_t battmon3_read_data_flash (battmon3_t *ctx, uint16_t address, uint8_t *rx_buf, uint8_t rx_len)
 BATT-MON 3 read data flash function.
 
err_t battmon3_check_communication (battmon3_t *ctx)
 BATT-MON 3 check communication function.
 
err_t battmon3_read_status (battmon3_t *ctx, uint16_t *status)
 BATT-MON 3 read status function.
 
err_t battmon3_wait_for_status (battmon3_t *ctx, uint16_t mask, uint16_t status)
 BATT-MON 3 wait for status function.
 
void battmon3_set_en_pin_high (battmon3_t *ctx)
 BATT-MON 3 set en pin high function.
 
void battmon3_set_en_pin_low (battmon3_t *ctx)
 BATT-MON 3 set en pin low function.
 
uint8_t battmon3_get_alert_pin (battmon3_t *ctx)
 BATT-MON 3 get alert pin function.
 
err_t battmon3_start_gauge (battmon3_t *ctx)
 BATT-MON 3 start gauge function.
 
err_t battmon3_stop_gauge (battmon3_t *ctx)
 BATT-MON 3 stop gauge function.
 
err_t battmon3_disable_gauge (battmon3_t *ctx)
 BATT-MON 3 disable gauge function.
 
err_t battmon3_set_gauge_mode (battmon3_t *ctx, uint8_t gauge_mode)
 BATT-MON 3 set gauge mode function.
 
err_t battmon3_reset (battmon3_t *ctx)
 BATT-MON 3 reset function.
 
err_t battmon3_read_security_mode (battmon3_t *ctx)
 BATT-MON 3 read security mode function.
 
err_t battmon3_set_security_mode (battmon3_t *ctx, uint8_t security_mode)
 BATT-MON 3 set security mode function.
 
err_t battmon3_new_battery (battmon3_t *ctx, uint16_t des_capacity)
 BATT-MON 3 new battery function.
 
err_t battmon3_set_design_capacity (battmon3_t *ctx, uint16_t des_capacity)
 BATT-MON 3 set design capacity function.
 
err_t battmon3_read_design_capacity (battmon3_t *ctx, uint16_t *des_capacity)
 BATT-MON 3 read design capacity function.
 
err_t battmon3_read_used_capacity (battmon3_t *ctx, float *used_capacity)
 BATT-MON 3 read used capacity function.
 
err_t battmon3_read_remaining_capacity (battmon3_t *ctx, float *rem_capacity)
 BATT-MON 3 read remaining capacity function.
 
err_t battmon3_read_remaining_percentage (battmon3_t *ctx, float *rem_percentage)
 BATT-MON 3 read remaining percentage function.
 
err_t battmon3_use_internal_temperature (battmon3_t *ctx)
 BATT-MON 3 use internal temperature function.
 
err_t battmon3_use_external_temperature (battmon3_t *ctx)
 BATT-MON 3 use external temperature function.
 
err_t battmon3_read_temperature (battmon3_t *ctx, float *temperature)
 BATT-MON 3 read temperature function.
 
err_t battmon3_read_internal_temperature (battmon3_t *ctx, float *temperature)
 BATT-MON 3 read internal temperature function.
 
err_t battmon3_read_voltage (battmon3_t *ctx, uint16_t *voltage)
 BATT-MON 3 read voltage function.
 
err_t battmon3_read_current (battmon3_t *ctx, int16_t *current)
 BATT-MON 3 read current function.
 
err_t battmon3_read_scaled_r (battmon3_t *ctx, uint16_t *scaled_r)
 BATT-MON 3 read scaled R function.
 
err_t battmon3_read_measured_z (battmon3_t *ctx, uint16_t *measured_z)
 BATT-MON 3 read measured Z function.
 
err_t battmon3_read_state_of_health (battmon3_t *ctx, uint8_t *state_of_health)
 BATT-MON 3 read state of health function.
 
err_t battmon3_read_battery_status (battmon3_t *ctx, uint8_t *batt_status)
 BATT-MON 3 read battery status function.
 
err_t battmon3_read_battery_alert (battmon3_t *ctx, uint8_t *batt_alert)
 BATT-MON 3 read battery alert function.
 
err_t battmon3_enter_calibration_mode (battmon3_t *ctx)
 BATT-MON 3 enter calibration mode function.
 
err_t battmon3_exit_calibration_mode (battmon3_t *ctx)
 BATT-MON 3 exit calibration mode function.
 
err_t battmon3_read_raw_calibration_data (battmon3_t *ctx, uint8_t reg, uint16_t *cal_data)
 BATT-MON 3 read raw calibration data function.
 
err_t battmon3_perform_cc_offset (battmon3_t *ctx)
 BATT-MON 3 perform CC offset function.
 
err_t battmon3_perform_board_offset (battmon3_t *ctx)
 BATT-MON 3 perform board offset function.
 
err_t battmon3_calibrate_voltage (battmon3_t *ctx, uint16_t voltage)
 BATT-MON 3 calibrate voltage function.
 
err_t battmon3_calibrate_current (battmon3_t *ctx, int16_t current)
 BATT-MON 3 calibrate current function.
 
err_t battmon3_calibrate_temperature (battmon3_t *ctx, float temperature)
 BATT-MON 3 calibrate temperature function.
 

Detailed Description

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

◆ battmon3_calibrate_current()

err_t battmon3_calibrate_current ( battmon3_t * ctx,
int16_t current )

BATT-MON 3 calibrate current function.

This function calibrates the chip with known current flowing.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]current: Known constant current in mA.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
UNSEAL the chip before calibration.

◆ battmon3_calibrate_temperature()

err_t battmon3_calibrate_temperature ( battmon3_t * ctx,
float temperature )

BATT-MON 3 calibrate temperature function.

This function calibrates the internal or external temperature. To determine which temperature source is selected calling battmon3_use_internal_temperature or battmon3_use_external_temperature functions is recommended prior to this.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]temperature: Known temperature in Celsius.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
UNSEAL the chip before calibration.

◆ battmon3_calibrate_voltage()

err_t battmon3_calibrate_voltage ( battmon3_t * ctx,
uint16_t voltage )

BATT-MON 3 calibrate voltage function.

This function calibrates the chip with known voltage.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]voltage: Known voltage in mV.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
UNSEAL the chip before calibration.

◆ battmon3_cfg_setup()

void battmon3_cfg_setup ( battmon3_cfg_t * cfg)

BATT-MON 3 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ battmon3_check_communication()

err_t battmon3_check_communication ( battmon3_t * ctx)

BATT-MON 3 check communication function.

This function checks the communication by reading and verifying the CHEM ID value.

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

◆ battmon3_default_cfg()

err_t battmon3_default_cfg ( battmon3_t * ctx)

BATT-MON 3 default configuration function.

This function executes a default configuration of BATT-MON 3 click board.

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

◆ battmon3_disable_gauge()

err_t battmon3_disable_gauge ( battmon3_t * ctx)

BATT-MON 3 disable gauge function.

This function disables gauge by stopping it and waiting for G_DONE bit to be set. And after that it clears the EN pin.

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

◆ battmon3_enter_calibration_mode()

err_t battmon3_enter_calibration_mode ( battmon3_t * ctx)

BATT-MON 3 enter calibration mode function.

This function enters to the calibration mode.

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

◆ battmon3_exit_calibration_mode()

err_t battmon3_exit_calibration_mode ( battmon3_t * ctx)

BATT-MON 3 exit calibration mode function.

This function exits from the calibration mode.

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

◆ battmon3_generic_read()

err_t battmon3_generic_read ( battmon3_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

BATT-MON 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 battmon3_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.

◆ battmon3_generic_write()

err_t battmon3_generic_write ( battmon3_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

BATT-MON 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 battmon3_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.

◆ battmon3_get_alert_pin()

uint8_t battmon3_get_alert_pin ( battmon3_t * ctx)

BATT-MON 3 get alert pin function.

This function returns the Alert pin logic state.

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

◆ battmon3_init()

err_t battmon3_init ( battmon3_t * ctx,
battmon3_cfg_t * cfg )

BATT-MON 3 initialization function.

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

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

◆ battmon3_new_battery()

err_t battmon3_new_battery ( battmon3_t * ctx,
uint16_t des_capacity )

BATT-MON 3 new battery function.

This function indicates to the chip that a new battery has been inserted.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]des_capacity: The capacity of the battery (mAh), if zero use the previous set.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_perform_board_offset()

err_t battmon3_perform_board_offset ( battmon3_t * ctx)

BATT-MON 3 perform board offset function.

This function performs the board offset (no current should be flowing).

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
UNSEAL the chip before calibration.

◆ battmon3_perform_cc_offset()

err_t battmon3_perform_cc_offset ( battmon3_t * ctx)

BATT-MON 3 perform CC offset function.

This function performs the CC offset (no current should be flowing).

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
UNSEAL the chip before calibration.

◆ battmon3_read_battery_alert()

err_t battmon3_read_battery_alert ( battmon3_t * ctx,
uint8_t * batt_alert )

BATT-MON 3 read battery alert function.

This function reads the battery alert register.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[out]batt_alert: Battery alert register value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_battery_status()

err_t battmon3_read_battery_status ( battmon3_t * ctx,
uint8_t * batt_status )

BATT-MON 3 read battery status function.

This function reads the battery status register.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[out]batt_status: Battery status register value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_control()

err_t battmon3_read_control ( battmon3_t * ctx,
uint16_t control,
uint16_t * data_out )

BATT-MON 3 read control function.

This function reads data from the selected control subcommand.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]control: Control subcommand.
[out]data_out: Data output read [16-bit].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_current()

err_t battmon3_read_current ( battmon3_t * ctx,
int16_t * current )

BATT-MON 3 read current function.

This function reads the battery current load from BATT+ to GND in milliampers.

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

◆ battmon3_read_data_flash()

err_t battmon3_read_data_flash ( battmon3_t * ctx,
uint16_t address,
uint8_t * rx_buf,
uint8_t rx_len )

BATT-MON 3 read data flash function.

This function reads a desired number of data bytes starting from the selected data flash address.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]address: Data flash 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.

◆ battmon3_read_design_capacity()

err_t battmon3_read_design_capacity ( battmon3_t * ctx,
uint16_t * des_capacity )

BATT-MON 3 read design capacity function.

This function reads the design capacity of the cell.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[out]des_capacity: The capacity of the battery (mAh).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_internal_temperature()

err_t battmon3_read_internal_temperature ( battmon3_t * ctx,
float * temperature )

BATT-MON 3 read internal temperature function.

This function reads the internal temperature in Celsius.

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

◆ battmon3_read_measured_z()

err_t battmon3_read_measured_z ( battmon3_t * ctx,
uint16_t * measured_z )

BATT-MON 3 read measured Z function.

This function reads the measured impedance of the cell. It is updated upon a new resistance update in EOS mode only with a resolution of 1 mOhm per bit.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[out]measured_z: Measured impedance of the cell.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_raw_calibration_data()

err_t battmon3_read_raw_calibration_data ( battmon3_t * ctx,
uint8_t reg,
uint16_t * cal_data )

BATT-MON 3 read raw calibration data function.

This function reads the RAW calibration voltage, current or temperature data.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]reg: Calibration voltage, current or temperature register address.
[out]cal_data: Output read calibration data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_remaining_capacity()

err_t battmon3_read_remaining_capacity ( battmon3_t * ctx,
float * rem_capacity )

BATT-MON 3 read remaining capacity function.

This function reads the remaining battery capacity in mAh. This relies on the Design Capacity of the battery having been set correctly.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[out]rem_capacity: The remaining capacity of the battery (mAh).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_remaining_percentage()

err_t battmon3_read_remaining_percentage ( battmon3_t * ctx,
float * rem_percentage )

BATT-MON 3 read remaining percentage function.

This function reads the remaining battery capacity in percent. This relies on the Design Capacity of the battery having been set correctly.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[out]rem_percentage: The remaining capacity of the battery (%).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_scaled_r()

err_t battmon3_read_scaled_r ( battmon3_t * ctx,
uint16_t * scaled_r )

BATT-MON 3 read scaled R function.

This function reads the scaled resistance of the cell. It is updated upon a new resistance update in EOS mode only with a resolution of 1 mOhm per bit.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[out]scaled_r: Scaled resistance of the cell.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_security_mode()

err_t battmon3_read_security_mode ( battmon3_t * ctx)

BATT-MON 3 read security mode function.

This function reads the security mode and stores the value in ctx->security_mode.

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

◆ battmon3_read_state_of_health()

err_t battmon3_read_state_of_health ( battmon3_t * ctx,
uint8_t * state_of_health )

BATT-MON 3 read state of health function.

This function reads the state-of-health (SOH) value.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[out]state_of_health: State-of-health (SOH) value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_status()

err_t battmon3_read_status ( battmon3_t * ctx,
uint16_t * status )

BATT-MON 3 read status function.

This function reads the control status register.

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

◆ battmon3_read_temperature()

err_t battmon3_read_temperature ( battmon3_t * ctx,
float * temperature )

BATT-MON 3 read temperature function.

This function reads the internal or external temperature in Celsius.

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

◆ battmon3_read_two_bytes()

err_t battmon3_read_two_bytes ( battmon3_t * ctx,
uint8_t reg,
uint16_t * data_out )

BATT-MON 3 read two bytes function.

This function reads two bytes of data from the selected register by using I2C serial interface.

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

◆ battmon3_read_used_capacity()

err_t battmon3_read_used_capacity ( battmon3_t * ctx,
float * used_capacity )

BATT-MON 3 read used capacity function.

This function reads the used battery capacity in mAh.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[out]used_capacity: The used capacity of the battery (mAh).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_read_voltage()

err_t battmon3_read_voltage ( battmon3_t * ctx,
uint16_t * voltage )

BATT-MON 3 read voltage function.

This function reads the battery voltage in millivolts.

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

◆ battmon3_reset()

err_t battmon3_reset ( battmon3_t * ctx)

BATT-MON 3 reset function.

This function performs a hard reset of the chip, reinitialising RAM data to defaults from ROM.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The security mode of the chip is unaffected.

◆ battmon3_set_design_capacity()

err_t battmon3_set_design_capacity ( battmon3_t * ctx,
uint16_t des_capacity )

BATT-MON 3 set design capacity function.

This function sets the design capacity of the cell.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]des_capacity: The capacity of the battery (mAh).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_set_en_pin_high()

void battmon3_set_en_pin_high ( battmon3_t * ctx)

BATT-MON 3 set en pin high function.

This function sets the EN pin to high logic state.

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

◆ battmon3_set_en_pin_low()

void battmon3_set_en_pin_low ( battmon3_t * ctx)

BATT-MON 3 set en pin low function.

This function sets the EN pin to low logic state.

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

◆ battmon3_set_gauge_mode()

err_t battmon3_set_gauge_mode ( battmon3_t * ctx,
uint8_t gauge_mode )

BATT-MON 3 set gauge mode function.

This function sets the gauging mode.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]gauge_mode:
  • 0 - Accumulated,
  • 1 - SOH (for LiMnO2),
  • 2 - EOS (for LiSOCl2).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_set_security_mode()

err_t battmon3_set_security_mode ( battmon3_t * ctx,
uint8_t security_mode )

BATT-MON 3 set security mode function.

This function sets the security mode of the chip.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]security_mode:
  • 1 - FULL ACCESS - Allows writes to all of memory,
  • 2 - UNSEALED - Allows writes to all of memory apart from the security codes area,
  • 3 - SEALED - Normal operating mode, prevents accidental writes.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_start_gauge()

err_t battmon3_start_gauge ( battmon3_t * ctx)

BATT-MON 3 start gauge function.

This function starts the battery gauge. Battery gauging must be switched on for the battery capacity and percentage readings to be valid. The chip will consume more when battery gauging is switched on.

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

◆ battmon3_stop_gauge()

err_t battmon3_stop_gauge ( battmon3_t * ctx)

BATT-MON 3 stop gauge function.

This function stops the battery gauging. It doesn't handle EN pin! If BATTMON3_GAUGE_MODE_ACCUMULATOR is activated, the accumulated capacity values will be stored in non-volatile memory. Please see the warning in section 5.1.1 of the TI BQ35100 technical reference manual concerning how frequently this should be done.

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

◆ battmon3_use_external_temperature()

err_t battmon3_use_external_temperature ( battmon3_t * ctx)

BATT-MON 3 use external temperature function.

This function selects the external temperature sensor (NTC) to be used for temperature measurements.

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

◆ battmon3_use_internal_temperature()

err_t battmon3_use_internal_temperature ( battmon3_t * ctx)

BATT-MON 3 use internal temperature function.

This function selects the internal temperature sensor to be used for temperature measurements.

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

◆ battmon3_wait_for_status()

err_t battmon3_wait_for_status ( battmon3_t * ctx,
uint16_t mask,
uint16_t status )

BATT-MON 3 wait for status function.

This function waits for the specific status to occur (up to 10 seconds).

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]mask: Bit mask to be matched.
[in]status: Status of bit mask to be matched.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ battmon3_write_control()

err_t battmon3_write_control ( battmon3_t * ctx,
uint16_t control )

BATT-MON 3 write control function.

This function writes the selected control subcommand.

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

◆ battmon3_write_data_flash()

err_t battmon3_write_data_flash ( battmon3_t * ctx,
uint16_t address,
uint8_t * tx_buf,
uint8_t tx_len )

BATT-MON 3 write data flash function.

This function writes a desired number of data bytes starting from the selected data flash address.

Parameters
[in]ctx: Click context object. See battmon3_t object definition for detailed explanation.
[in]address: Data flash 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.

◆ battmon3_write_two_bytes()

err_t battmon3_write_two_bytes ( battmon3_t * ctx,
uint8_t reg,
uint16_t data_in )

BATT-MON 3 write two bytes function.

This function writes two bytes of data to the selected register by using I2C serial interface.

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