no-OS
|
Implementation of LT8491 Driver. More...
Go to the source code of this file.
Classes | |
struct | lt8491_desc |
LT8491 descriptor. More... | |
struct | lt8491_init_param |
LT8491 init param. More... | |
Enumerations | |
enum | lt8491_charging_stage { LT8491_STAGE0, LT8491_STAGE1, LT8491_STAGE2, LT8491_STAGE3, LT8491_DONE_CHARGING } |
LT8491 charging stage. More... | |
Functions | |
int | lt8491_reg_read (struct lt8491_desc *dev, uint8_t addr, uint16_t *val, bool is_word) |
Read a register value. More... | |
int | lt8491_reg_write (struct lt8491_desc *dev, uint8_t addr, uint16_t val, bool is_word) |
Write a register value. More... | |
int | lt8491_init (struct lt8491_desc **dev, struct lt8491_init_param *init_param) |
Device and comm init function. More... | |
int | lt8491_remove (struct lt8491_desc *dev) |
Free resources allocated by the init function. More... | |
int | lt8491_configure_telemetry (struct lt8491_desc *dev, struct lt8491_init_param *init_param) |
Device and comm init function. More... | |
int | lt8491_read_tbat (struct lt8491_desc *dev, int32_t *val) |
Read the telemetry battery temperature. More... | |
int | lt8491_read_pout (struct lt8491_desc *dev, uint32_t *val) |
Read the telemetry battery output power. More... | |
int | lt8491_read_pin (struct lt8491_desc *dev, uint32_t *val) |
Read the telemetry battery input power. More... | |
int | lt8491_read_efficiency (struct lt8491_desc *dev, uint32_t *val) |
Read the telemetry battery efficiency. More... | |
int | lt8491_read_iout (struct lt8491_desc *dev, uint32_t *val) |
Read the telemetry battery output current. More... | |
int | lt8491_read_iin (struct lt8491_desc *dev, uint32_t *val) |
Read the telemetry battery input current. More... | |
int | lt8491_read_vbat (struct lt8491_desc *dev, uint32_t *val) |
Read the telemetry battery voltage. More... | |
int | lt8491_read_vin (struct lt8491_desc *dev, uint32_t *val) |
Read the telemetry input voltage. More... | |
int | lt8491_read_charging_stage (struct lt8491_desc *dev, uint32_t *uval) |
Read the telemetry battery charging stage. More... | |
int | lt8491_read_charging_status (struct lt8491_desc *dev, uint32_t *charging) |
Read the telemetry battery charging status. More... | |
int | lt8491_read_enable (struct lt8491_desc *dev, uint32_t *enable) |
Read the telemetry battery charging enable. More... | |
int | lt8491_write_enable (struct lt8491_desc *dev, uint32_t enable) |
Write the telemetry battery charging enable. More... | |
int | lt8491_restart_chip (struct lt8491_desc *dev) |
Restart the chip. More... | |
int | lt8491_read_scratch (struct lt8491_desc *dev, uint32_t *val) |
Read the scratch register. More... | |
int | lt8491_write_scratch (struct lt8491_desc *dev, uint32_t val) |
Write the scratch register. More... | |
int | lt8491_read_serial_id (struct lt8491_desc *dev, uint32_t *val) |
Read the serial ID. More... | |
Implementation of LT8491 Driver.
Copyright 2024(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define LT8491_CFG_CHRG_MISC_REG 0x4D |
#define LT8491_CFG_RDACI_REG 0x34 |
#define LT8491_CFG_RDACO_REG 0x2E |
#define LT8491_CFG_RFBIN1_REG 0x38 |
#define LT8491_CFG_RFBIN2_REG 0x36 |
#define LT8491_CFG_RFBOUT1_REG 0x30 |
#define LT8491_CFG_RFBOUT2_REG 0x32 |
#define LT8491_CFG_RIMON_OUT_REG 0x2A |
#define LT8491_CFG_RSENSE1_REG 0x28 |
#define LT8491_CFG_RSENSE2_REG 0x2C |
#define LT8491_CFG_TBAT_MAX_REG 0x41 |
#define LT8491_CFG_TBAT_MIN_REG 0x40 |
#define LT8491_CFG_USER_CODE 0x5A |
#define LT8491_CHARGING_MASK NO_OS_BIT(2) |
#define LT8491_CHRG_STAGE_MASK NO_OS_GENMASK(5, 3) |
#define LT8491_CTRL_CHRG_EN_REG 0x23 |
#define LT8491_CTRL_RESTART_CHIP_REG 0x24 |
#define LT8491_CTRL_UPDATE_TELEM 0x26 |
#define LT8491_MFR_DATA1_REG 0x5C |
#define LT8491_MFR_DATA2_REG 0x5E |
#define LT8491_MFR_DATA3_REG 0x60 |
#define LT8491_PS_OR_SOLAR_MASK NO_OS_BIT(3) |
#define LT8491_STAT_CHARGER_REG 0x12 |
#define LT8491_STAT_SUPPLY_REG 0x14 |
#define LT8491_TELE_EFF_REG 0x6 |
#define LT8491_TELE_IIN_REG 0xA |
#define LT8491_TELE_IOUT_REG 0x8 |
#define LT8491_TELE_PIN_REG 0x4 |
#define LT8491_TELE_POUT_REG 0x2 |
#define LT8491_TELE_TBAT_REG 0x0 |
#define LT8491_TELE_VBAT_REG 0xC |
#define LT8491_TELE_VIN_REG 0xE |
#define LT8491_TELE_VINR_REG 0x10 |
int lt8491_configure_telemetry | ( | struct lt8491_desc * | dev, |
struct lt8491_init_param * | init_param | ||
) |
Device and comm init function.
Device and comm init function
dev | - LT8491 descriptor to be initialized |
init_param | - Init parameter for descriptor |
int lt8491_init | ( | struct lt8491_desc ** | dev, |
struct lt8491_init_param * | init_param | ||
) |
Device and comm init function.
Device and comm init function
dev | - LT8491 descriptor to be initialized |
init_param | - Init parameter for descriptor |
int lt8491_read_charging_stage | ( | struct lt8491_desc * | dev, |
uint32_t * | uval | ||
) |
Read the telemetry battery charging stage.
Read the telemetry battery charging stage
dev | - LT8491 descriptor |
uval | - telemetry battery charging stage |
int lt8491_read_charging_status | ( | struct lt8491_desc * | dev, |
uint32_t * | charging | ||
) |
Read the telemetry battery charging status.
Read the telemetry battery charging status
dev | - LT8491 descriptor |
charging | - true if charging, false otherwise |
int lt8491_read_efficiency | ( | struct lt8491_desc * | dev, |
uint32_t * | val | ||
) |
Read the telemetry battery efficiency.
Read the telemetry battery efficiency
dev | - LT8491 descriptor |
val | - telemetry battery efficiency in m% |
int lt8491_read_enable | ( | struct lt8491_desc * | dev, |
uint32_t * | enable | ||
) |
Read the telemetry battery charging enable.
Read the telemetry battery charging enable
dev | - LT8491 descriptor |
enable | - true if charging enable, false otherwise |
int lt8491_read_iin | ( | struct lt8491_desc * | dev, |
uint32_t * | val | ||
) |
Read the telemetry battery input current.
Read the telemetry battery input current
dev | - LT8491 descriptor |
val | - telemetry battery input current in mA |
int lt8491_read_iout | ( | struct lt8491_desc * | dev, |
uint32_t * | val | ||
) |
Read the telemetry battery output current.
Read the telemetry battery output current
dev | - LT8491 descriptor |
val | - telemetry battery output current in mA |
int lt8491_read_pin | ( | struct lt8491_desc * | dev, |
uint32_t * | val | ||
) |
Read the telemetry battery input power.
Read the telemetry battery input power
dev | - LT8491 descriptor |
val | - telemetry battery input power in mW |
int lt8491_read_pout | ( | struct lt8491_desc * | dev, |
uint32_t * | val | ||
) |
Read the telemetry battery output power.
Read the telemetry battery output power
dev | - LT8491 descriptor |
val | - telemetry battery output power in mW |
int lt8491_read_scratch | ( | struct lt8491_desc * | dev, |
uint32_t * | val | ||
) |
Read the scratch register.
Read the scratch register
dev | - LT8491 descriptor |
val | - scratch register value |
int lt8491_read_serial_id | ( | struct lt8491_desc * | dev, |
uint32_t * | val | ||
) |
Read the serial ID.
Read the serial ID
dev | - LT8491 descriptor |
val | - serial ID value |
int lt8491_read_tbat | ( | struct lt8491_desc * | dev, |
int32_t * | val | ||
) |
Read the telemetry battery temperature.
Read the telemetry battery temperature
dev | - LT8491 descriptor |
val | - telemetry battery temperature in mC |
int lt8491_read_vbat | ( | struct lt8491_desc * | dev, |
uint32_t * | val | ||
) |
Read the telemetry battery voltage.
Read the telemetry battery voltage
dev | - LT8491 descriptor |
val | - telemetry battery voltage in mV |
int lt8491_read_vin | ( | struct lt8491_desc * | dev, |
uint32_t * | val | ||
) |
Read the telemetry input voltage.
Read the telemetry input voltage
dev | - LT8491 descriptor |
val | - telemetry input voltage in mV |
int lt8491_reg_read | ( | struct lt8491_desc * | dev, |
uint8_t | addr, | ||
uint16_t * | val, | ||
bool | is_word | ||
) |
Read a register value.
Read a register value
dev | - LT8491 descriptor |
addr | - register address |
val | - register value |
is_word | - true if the register is 16-bit, false if 8-bit |
int lt8491_reg_write | ( | struct lt8491_desc * | dev, |
uint8_t | addr, | ||
uint16_t | val, | ||
bool | is_word | ||
) |
Write a register value.
Write a register value
dev | - LT8491 descriptor |
addr | - register address |
val | - register value |
is_word | - true if the register is 16-bit, false if 8-bit |
int lt8491_remove | ( | struct lt8491_desc * | dev | ) |
Free resources allocated by the init function.
Free resources allocated by the init function
dev | - LT8491 descriptor |
int lt8491_restart_chip | ( | struct lt8491_desc * | dev | ) |
Restart the chip.
Restart the chip
dev | - LT8491 descriptor |
int lt8491_write_enable | ( | struct lt8491_desc * | dev, |
uint32_t | enable | ||
) |
Write the telemetry battery charging enable.
Write the telemetry battery charging enable
dev | - LT8491 descriptor |
enable | - true if charging enable, false otherwise |
int lt8491_write_scratch | ( | struct lt8491_desc * | dev, |
uint32_t | val | ||
) |
Write the scratch register.
Write the scratch register
dev | - LT8491 descriptor |
val | - scratch register value |