no-OS
Functions | Variables
ltc4162l.c File Reference
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include "no_os_util.h"
#include "no_os_delay.h"
#include "no_os_alloc.h"
#include "no_os_i2c.h"
#include "ltc4162l.h"
Include dependency graph for ltc4162l.c:

Functions

int ltc4162l_reg_write (struct ltc4162l_desc *dev, uint8_t addr, uint16_t val)
 Write to a register of the LTC4162L. More...
 
int ltc4162l_reg_read (struct ltc4162l_desc *dev, uint8_t addr, uint16_t *val)
 Read from a register of the LTC4162L. More...
 
int ltc4162l_reg_update (struct ltc4162l_desc *dev, uint8_t addr, uint16_t mask, uint16_t val)
 Update a register of the LTC4162L. More...
 
int ltc4162l_init (struct ltc4162l_desc **device, struct ltc4162l_init_param *init_param)
 Initialize the LTC4162L device. More...
 
int ltc4162l_remove (struct ltc4162l_desc *dev)
 Free the resources allocated by ltc4162l_init() More...
 
int ltc4162l_get_cell_count (struct ltc4162l_desc *dev, uint16_t *val)
 Get the number of cells. More...
 
int ltc4162l_get_chem_type (struct ltc4162l_desc *dev, uint16_t *val)
 Get the chemistry type. More...
 
int ltc4162l_get_charger_state (struct ltc4162l_desc *dev, uint16_t *val)
 Get the charger state. More...
 
int ltc4162l_get_charge_status (struct ltc4162l_desc *dev, uint16_t *val)
 Get the charge status. More...
 
int ltc4162l_get_online_status (struct ltc4162l_desc *dev, uint16_t *val)
 Get the online status. More...
 
int ltc4162l_read_vbat (struct ltc4162l_desc *dev, uint16_t *val)
 Get the battery voltage. More...
 
int ltc4162l_read_avg_vbat (struct ltc4162l_desc *dev, uint16_t *val)
 Get the average battery voltage. More...
 
int ltc4162l_read_ibat (struct ltc4162l_desc *dev, uint16_t *val)
 Get the battery current. More...
 
int ltc4162l_read_input_voltage (struct ltc4162l_desc *dev, uint16_t *val)
 Get the input voltage. More...
 
int ltc4162l_read_input_current (struct ltc4162l_desc *dev, uint16_t *val)
 Get the input current. More...
 
int ltc4162l_get_icharge_setting (struct ltc4162l_desc *dev, uint16_t *val)
 Get icharge setting. More...
 
int ltc4162l_set_icharge_setting (struct ltc4162l_desc *dev, uint16_t val)
 Set icharge setting. More...
 
int ltc4162l_get_icharge (struct ltc4162l_desc *dev, uint16_t *val)
 Get icharge value. More...
 
int ltc4162l_get_vcharge_setting (struct ltc4162l_desc *dev, uint16_t *val)
 Get the vcharge setting. More...
 
int ltc4162l_set_vcharge_setting (struct ltc4162l_desc *dev, uint16_t val)
 Set the vcharge setting. More...
 
int ltc4162l_get_iin_limit (struct ltc4162l_desc *dev, uint16_t *val)
 Get the iin limit. More...
 
int ltc4162l_set_iin_limit (struct ltc4162l_desc *dev, uint16_t val)
 Set the iin limit. More...
 
int ltc4162l_get_die_temp (struct ltc4162l_desc *dev, uint16_t *val)
 Get the die temperature. More...
 
int ltc4162l_get_term_current (struct ltc4162l_desc *dev, uint16_t *val)
 Get the term current. More...
 
int ltc4162l_set_term_current (struct ltc4162l_desc *dev, uint16_t val)
 Set the term current. More...
 
int ltc4162l_get_telemetry (struct ltc4162l_desc *dev, uint16_t *val)
 Get the telemetry. More...
 
int ltc4162l_set_telemetry (struct ltc4162l_desc *dev, uint16_t val)
 Set the telemetry. More...
 

Variables

const struct ltc4162l_chip_info ltc4162l_infos []
 LTC4162x chip information. More...
 

Function Documentation

◆ ltc4162l_get_cell_count()

int ltc4162l_get_cell_count ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the number of cells.

Parameters
dev- The LTC4162L device structure.
val- The number of cells.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_get_charge_status()

int ltc4162l_get_charge_status ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the charge status.

Parameters
dev- The LTC4162L device structure.
val- The charge status.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_get_charger_state()

int ltc4162l_get_charger_state ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the charger state.

Parameters
dev- The LTC4162L device structure.
val- The charger state.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_get_chem_type()

int ltc4162l_get_chem_type ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the chemistry type.

Parameters
dev- The LTC4162L device structure.
val- The chemistry type.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_get_die_temp()

int ltc4162l_get_die_temp ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the die temperature.

Parameters
dev- The LTC4162L device structure.
val- The die temperature.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_get_icharge()

int ltc4162l_get_icharge ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get icharge value.

Parameters
dev- The LTC4162L device structure.
val- The icharge value.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_get_icharge_setting()

int ltc4162l_get_icharge_setting ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get icharge setting.

Parameters
dev- The LTC4162L device structure.
val- The icharge setting.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_get_iin_limit()

int ltc4162l_get_iin_limit ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the iin limit.

Parameters
dev- The LTC4162L device structure.
val- The iin limit.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_get_online_status()

int ltc4162l_get_online_status ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the online status.

Parameters
dev- The LTC4162L device structure.
val- The online status.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_get_telemetry()

int ltc4162l_get_telemetry ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the telemetry.

Parameters
dev- The LTC4162L device structure.
val- The telemetry.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_get_term_current()

int ltc4162l_get_term_current ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the term current.

Parameters
dev- The LTC4162L device structure.
val- The term current.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_get_vcharge_setting()

int ltc4162l_get_vcharge_setting ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the vcharge setting.

Parameters
dev- The LTC4162L device structure.
val- The vcharge setting.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_init()

int ltc4162l_init ( struct ltc4162l_desc **  device,
struct ltc4162l_init_param init_param 
)

Initialize the LTC4162L device.

Parameters
device- The LTC4162L device structure.
init_param- The LTC4162L initialization structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_read_avg_vbat()

int ltc4162l_read_avg_vbat ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the average battery voltage.

Parameters
dev- The LTC4162L device structure.
val- The average battery voltage.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_read_ibat()

int ltc4162l_read_ibat ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the battery current.

Parameters
dev- The LTC4162L device structure.
val- The battery current.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_read_input_current()

int ltc4162l_read_input_current ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the input current.

Parameters
dev- The LTC4162L device structure.
val- The input current.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_read_input_voltage()

int ltc4162l_read_input_voltage ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the input voltage.

Parameters
dev- The LTC4162L device structure.
val- The input voltage.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_read_vbat()

int ltc4162l_read_vbat ( struct ltc4162l_desc dev,
uint16_t *  val 
)

Get the battery voltage.

Parameters
dev- The LTC4162L device structure.
val- The battery voltage.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_reg_read()

int ltc4162l_reg_read ( struct ltc4162l_desc dev,
uint8_t  addr,
uint16_t *  val 
)

Read from a register of the LTC4162L.

Parameters
dev- The LTC4162L device structure.
addr- The address of the register to read from.
val- The value read from the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_reg_update()

int ltc4162l_reg_update ( struct ltc4162l_desc dev,
uint8_t  addr,
uint16_t  mask,
uint16_t  val 
)

Update a register of the LTC4162L.

Parameters
dev- The LTC4162L device structure.
addr- The address of the register to update.
mask- The mask to apply to the register.
val- The value to write to the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_reg_write()

int ltc4162l_reg_write ( struct ltc4162l_desc dev,
uint8_t  addr,
uint16_t  val 
)

Write to a register of the LTC4162L.

Parameters
dev- The LTC4162L device structure.
addr- The address of the register to write to.
val- The value to write to the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_remove()

int ltc4162l_remove ( struct ltc4162l_desc dev)

Free the resources allocated by ltc4162l_init()

Parameters
dev- The LTC4162L device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc4162l_set_icharge_setting()

int ltc4162l_set_icharge_setting ( struct ltc4162l_desc dev,
uint16_t  val 
)

Set icharge setting.

Parameters
dev- The LTC4162L device structure.
val- The icharge setting.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_set_iin_limit()

int ltc4162l_set_iin_limit ( struct ltc4162l_desc dev,
uint16_t  val 
)

Set the iin limit.

Parameters
dev- The LTC4162L device structure.
val- The iin limit.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_set_telemetry()

int ltc4162l_set_telemetry ( struct ltc4162l_desc dev,
uint16_t  val 
)

Set the telemetry.

Parameters
dev- The LTC4162L device structure.
val- The telemetry.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_set_term_current()

int ltc4162l_set_term_current ( struct ltc4162l_desc dev,
uint16_t  val 
)

Set the term current.

Parameters
dev- The LTC4162L device structure.
val- The term current.
Returns
0 in case of success, negative error code otherwise.

◆ ltc4162l_set_vcharge_setting()

int ltc4162l_set_vcharge_setting ( struct ltc4162l_desc dev,
uint16_t  val 
)

Set the vcharge setting.

Parameters
dev- The LTC4162L device structure.
val- The vcharge setting.
Returns
0 in case of success, negative error code otherwise.

Variable Documentation

◆ ltc4162l_infos

const struct ltc4162l_chip_info ltc4162l_infos[]

LTC4162x chip information.