Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
HY4245 fuel gauge properties

HY4245 fuel gauge specific properties. More...

Data Structures

struct  hy4245_data_flash_block
 Data flash block for HY4245_FUEL_GAUGE_DATA_FLASH_BLOCK. More...

Macros

#define HY4245_DATA_FLASH_BLOCK_SIZE   32U
 Size of one data flash block in bytes.
#define HY4245_CONFIG_IMAGE_ELEMENT_SIZE   (2U + HY4245_DATA_FLASH_BLOCK_SIZE)
 Size of one configuration image element in bytes: subclass id, block id followed by one data flash block.

Enumerations

enum  hy4245_fuel_gauge_prop {
  HY4245_FUEL_GAUGE_FLASH_UPDATE_ENABLE = FUEL_GAUGE_CUSTOM_BEGIN , HY4245_FUEL_GAUGE_CONTROL_STATUS , HY4245_FUEL_GAUGE_OPERATION_CONFIG_A , HY4245_FUEL_GAUGE_FLAGS ,
  HY4245_FUEL_GAUGE_SAFETY_STATUS , HY4245_FUEL_GAUGE_LIFETIME_OVER_TEMPERATURE_MINS , HY4245_FUEL_GAUGE_DATA_FLASH_CHECKSUM , HY4245_FUEL_GAUGE_DATA_FLASH_VERSION ,
  HY4245_FUEL_GAUGE_FIRMWARE_VERSION , HY4245_FUEL_GAUGE_CALIBRATION_MODE , HY4245_FUEL_GAUGE_RESET , HY4245_FUEL_GAUGE_DATA_FLASH_BLOCK ,
  HY4245_FUEL_GAUGE_MANUFACTURER_INFO_A , HY4245_FUEL_GAUGE_MANUFACTURER_INFO_B , HY4245_FUEL_GAUGE_MANUFACTURER_INFO_C , HY4245_FUEL_GAUGE_CONFIG_IMAGE ,
  HY4245_FUEL_GAUGE_CONFIG_IMAGE_VERIFY , HY4245_FUEL_GAUGE_CLEAR_LEARNED , HY4245_FUEL_GAUGE_QUICK_START
}
 HY4245 specific fuel gauge properties. More...

ControlStatus() bits, HY4245_FUEL_GAUGE_CONTROL_STATUS

#define HY4245_CONTROL_STATUS_VOK   BIT(1)
 Battery voltage is high enough for data flash updates.
#define HY4245_CONTROL_STATUS_SLEEP   BIT(4)
 Device is in SLEEP mode.
#define HY4245_CONTROL_STATUS_FULLSLEEP   BIT(5)
 FULLSLEEP mode requested.
#define HY4245_CONTROL_STATUS_HIBERNATE   BIT(6)
 HIBERNATE mode requested.
#define HY4245_CONTROL_STATUS_SHUTDOWN   BIT(7)
 Shutdown feature of the SE pin enabled.
#define HY4245_CONTROL_STATUS_1WR   BIT(8)
 1-Wire interface active
#define HY4245_CONTROL_STATUS_BCA   BIT(10)
 Board offset calibration routine (calibration mode) active.
#define HY4245_CONTROL_STATUS_CCA   BIT(11)
 Coulomb counter offset calibration routine active.
#define HY4245_CONTROL_STATUS_CSV   BIT(12)
 Data or instruction flash checksum generated.
#define HY4245_CONTROL_STATUS_SS   BIT(13)
 Device is sealed.
#define HY4245_CONTROL_STATUS_FAS   BIT(14)
 Full access is sealed.
#define HY4245_CONTROL_STATUS_SE   BIT(15)
 SE pin is active.

Flags() bits, HY4245_FUEL_GAUGE_FLAGS

#define HY4245_FLAGS_DSG   BIT(0)
 Discharging.
#define HY4245_FLAGS_SOCF   BIT(1)
 Capacity depleted, RemainingCapacity() below the SOCF threshold.
#define HY4245_FLAGS_SOC1   BIT(2)
 Capacity low, RemainingCapacity() below the SOC1 threshold.
#define HY4245_FLAGS_BAT_DET   BIT(3)
 Battery inserted.
#define HY4245_FLAGS_LRND   BIT(4)
 Capacity learned since the last ClearLearned().
#define HY4245_FLAGS_QSTART   BIT(5)
 QuickStart() in progress.
#define HY4245_FLAGS_EODCTAKEN   BIT(6)
 End of discharge compensation in progress.
#define HY4245_FLAGS_OCVTAKEN   BIT(7)
 Open circuit voltage measurement taken.
#define HY4245_FLAGS_CHG   BIT(8)
 Charging.
#define HY4245_FLAGS_FC   BIT(9)
 Fully charged.
#define HY4245_FLAGS_CHGSUSP   BIT(10)
 Charge suspended because of the temperature.
#define HY4245_FLAGS_XCHG   BIT(11)
 Charge inhibited because of the temperature.
#define HY4245_FLAGS_DOT   BIT(14)
 Discharge over temperature.
#define HY4245_FLAGS_COT   BIT(15)
 Charge over temperature.

SafetyStatus() bits, HY4245_FUEL_GAUGE_SAFETY_STATUS

#define HY4245_SAFETY_STATUS_OV   BIT(6)
 Over voltage.
#define HY4245_SAFETY_STATUS_UV   BIT(7)
 Under voltage.
#define HY4245_SAFETY_STATUS_COC   BIT(12)
 Charge over current.
#define HY4245_SAFETY_STATUS_DOC   BIT(13)
 Discharge over current.
#define HY4245_SAFETY_STATUS_COT   BIT(14)
 Charge over temperature.
#define HY4245_SAFETY_STATUS_DOT   BIT(15)
 Discharge over temperature.

OperationCfgA() bits, HY4245_FUEL_GAUGE_OPERATION_CONFIG_A

#define HY4245_OPERATION_CONFIG_A_TEMPS   BIT(0)
 Temperature() is measured at the TS input instead of the internal sensor.
#define HY4245_OPERATION_CONFIG_A_SE_EN   BIT(1)
 SE pin functions enabled.
#define HY4245_OPERATION_CONFIG_A_SE_POL   BIT(3)
 SE pin is active low.
#define HY4245_OPERATION_CONFIG_A_RMFCC   BIT(4)
 RelativeStateOfCharge() is held at 99 % until charge termination.
#define HY4245_OPERATION_CONFIG_A_SLEEP   BIT(5)
 SLEEP mode enabled.
#define HY4245_OPERATION_CONFIG_A_UPIMP_B   BIT(6)
 Updates when the battery impedance is learned at normal temperature.
#define HY4245_OPERATION_CONFIG_A_CELL0   BIT(8)
 Two cells in series.
#define HY4245_OPERATION_CONFIG_A_SMLSR   BIT(10)
 Higher current measurement resolution for small sense resistors.
#define HY4245_OPERATION_CONFIG_A_GNDSEL   BIT(11)
 VSS connected to SRP instead of SRN.
#define HY4245_OPERATION_CONFIG_A_NR   BIT(13)
 Battery is not removable.
#define HY4245_OPERATION_CONFIG_A_FACDC_EN   BIT(14)
 Design capacity is updated from Qmax() during the first capacity learning.
#define HY4245_OPERATION_CONFIG_A_UPD_EN   BIT(15)
 Data flash updates by the algorithm in operation enabled.

Detailed Description

HY4245 fuel gauge specific properties.

Macro Definition Documentation

◆ HY4245_CONFIG_IMAGE_ELEMENT_SIZE

#define HY4245_CONFIG_IMAGE_ELEMENT_SIZE   (2U + HY4245_DATA_FLASH_BLOCK_SIZE)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Size of one configuration image element in bytes: subclass id, block id followed by one data flash block.

◆ HY4245_CONTROL_STATUS_1WR

#define HY4245_CONTROL_STATUS_1WR   BIT(8)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

1-Wire interface active

◆ HY4245_CONTROL_STATUS_BCA

#define HY4245_CONTROL_STATUS_BCA   BIT(10)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Board offset calibration routine (calibration mode) active.

◆ HY4245_CONTROL_STATUS_CCA

#define HY4245_CONTROL_STATUS_CCA   BIT(11)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Coulomb counter offset calibration routine active.

◆ HY4245_CONTROL_STATUS_CSV

#define HY4245_CONTROL_STATUS_CSV   BIT(12)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Data or instruction flash checksum generated.

◆ HY4245_CONTROL_STATUS_FAS

#define HY4245_CONTROL_STATUS_FAS   BIT(14)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Full access is sealed.

◆ HY4245_CONTROL_STATUS_FULLSLEEP

#define HY4245_CONTROL_STATUS_FULLSLEEP   BIT(5)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

FULLSLEEP mode requested.

◆ HY4245_CONTROL_STATUS_HIBERNATE

#define HY4245_CONTROL_STATUS_HIBERNATE   BIT(6)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

HIBERNATE mode requested.

◆ HY4245_CONTROL_STATUS_SE

#define HY4245_CONTROL_STATUS_SE   BIT(15)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

SE pin is active.

◆ HY4245_CONTROL_STATUS_SHUTDOWN

#define HY4245_CONTROL_STATUS_SHUTDOWN   BIT(7)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Shutdown feature of the SE pin enabled.

◆ HY4245_CONTROL_STATUS_SLEEP

#define HY4245_CONTROL_STATUS_SLEEP   BIT(4)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Device is in SLEEP mode.

◆ HY4245_CONTROL_STATUS_SS

#define HY4245_CONTROL_STATUS_SS   BIT(13)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Device is sealed.

◆ HY4245_CONTROL_STATUS_VOK

#define HY4245_CONTROL_STATUS_VOK   BIT(1)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Battery voltage is high enough for data flash updates.

◆ HY4245_DATA_FLASH_BLOCK_SIZE

#define HY4245_DATA_FLASH_BLOCK_SIZE   32U

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Size of one data flash block in bytes.

◆ HY4245_FLAGS_BAT_DET

#define HY4245_FLAGS_BAT_DET   BIT(3)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Battery inserted.

◆ HY4245_FLAGS_CHG

#define HY4245_FLAGS_CHG   BIT(8)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Charging.

◆ HY4245_FLAGS_CHGSUSP

#define HY4245_FLAGS_CHGSUSP   BIT(10)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Charge suspended because of the temperature.

◆ HY4245_FLAGS_COT

#define HY4245_FLAGS_COT   BIT(15)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Charge over temperature.

◆ HY4245_FLAGS_DOT

#define HY4245_FLAGS_DOT   BIT(14)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Discharge over temperature.

◆ HY4245_FLAGS_DSG

#define HY4245_FLAGS_DSG   BIT(0)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Discharging.

◆ HY4245_FLAGS_EODCTAKEN

#define HY4245_FLAGS_EODCTAKEN   BIT(6)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

End of discharge compensation in progress.

◆ HY4245_FLAGS_FC

#define HY4245_FLAGS_FC   BIT(9)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Fully charged.

◆ HY4245_FLAGS_LRND

#define HY4245_FLAGS_LRND   BIT(4)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Capacity learned since the last ClearLearned().

◆ HY4245_FLAGS_OCVTAKEN

#define HY4245_FLAGS_OCVTAKEN   BIT(7)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Open circuit voltage measurement taken.

◆ HY4245_FLAGS_QSTART

#define HY4245_FLAGS_QSTART   BIT(5)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

QuickStart() in progress.

◆ HY4245_FLAGS_SOC1

#define HY4245_FLAGS_SOC1   BIT(2)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Capacity low, RemainingCapacity() below the SOC1 threshold.

◆ HY4245_FLAGS_SOCF

#define HY4245_FLAGS_SOCF   BIT(1)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Capacity depleted, RemainingCapacity() below the SOCF threshold.

◆ HY4245_FLAGS_XCHG

#define HY4245_FLAGS_XCHG   BIT(11)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Charge inhibited because of the temperature.

◆ HY4245_OPERATION_CONFIG_A_CELL0

#define HY4245_OPERATION_CONFIG_A_CELL0   BIT(8)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Two cells in series.

◆ HY4245_OPERATION_CONFIG_A_FACDC_EN

#define HY4245_OPERATION_CONFIG_A_FACDC_EN   BIT(14)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Design capacity is updated from Qmax() during the first capacity learning.

◆ HY4245_OPERATION_CONFIG_A_GNDSEL

#define HY4245_OPERATION_CONFIG_A_GNDSEL   BIT(11)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

VSS connected to SRP instead of SRN.

◆ HY4245_OPERATION_CONFIG_A_NR

#define HY4245_OPERATION_CONFIG_A_NR   BIT(13)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Battery is not removable.

◆ HY4245_OPERATION_CONFIG_A_RMFCC

#define HY4245_OPERATION_CONFIG_A_RMFCC   BIT(4)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

RelativeStateOfCharge() is held at 99 % until charge termination.

◆ HY4245_OPERATION_CONFIG_A_SE_EN

#define HY4245_OPERATION_CONFIG_A_SE_EN   BIT(1)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

SE pin functions enabled.

◆ HY4245_OPERATION_CONFIG_A_SE_POL

#define HY4245_OPERATION_CONFIG_A_SE_POL   BIT(3)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

SE pin is active low.

◆ HY4245_OPERATION_CONFIG_A_SLEEP

#define HY4245_OPERATION_CONFIG_A_SLEEP   BIT(5)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

SLEEP mode enabled.

◆ HY4245_OPERATION_CONFIG_A_SMLSR

#define HY4245_OPERATION_CONFIG_A_SMLSR   BIT(10)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Higher current measurement resolution for small sense resistors.

◆ HY4245_OPERATION_CONFIG_A_TEMPS

#define HY4245_OPERATION_CONFIG_A_TEMPS   BIT(0)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Temperature() is measured at the TS input instead of the internal sensor.

◆ HY4245_OPERATION_CONFIG_A_UPD_EN

#define HY4245_OPERATION_CONFIG_A_UPD_EN   BIT(15)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Data flash updates by the algorithm in operation enabled.

◆ HY4245_OPERATION_CONFIG_A_UPIMP_B

#define HY4245_OPERATION_CONFIG_A_UPIMP_B   BIT(6)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Updates when the battery impedance is learned at normal temperature.

◆ HY4245_SAFETY_STATUS_COC

#define HY4245_SAFETY_STATUS_COC   BIT(12)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Charge over current.

◆ HY4245_SAFETY_STATUS_COT

#define HY4245_SAFETY_STATUS_COT   BIT(14)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Charge over temperature.

◆ HY4245_SAFETY_STATUS_DOC

#define HY4245_SAFETY_STATUS_DOC   BIT(13)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Discharge over current.

◆ HY4245_SAFETY_STATUS_DOT

#define HY4245_SAFETY_STATUS_DOT   BIT(15)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Discharge over temperature.

◆ HY4245_SAFETY_STATUS_OV

#define HY4245_SAFETY_STATUS_OV   BIT(6)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Over voltage.

◆ HY4245_SAFETY_STATUS_UV

#define HY4245_SAFETY_STATUS_UV   BIT(7)

#include <zephyr/drivers/fuel_gauge/hy4245.h>

Under voltage.

Enumeration Type Documentation

◆ hy4245_fuel_gauge_prop

#include <zephyr/drivers/fuel_gauge/hy4245.h>

HY4245 specific fuel gauge properties.

The value type used with each property is given in the description: custom_bool and custom_uint refer to the members of union fuel_gauge_prop_val.

Enumerator
HY4245_FUEL_GAUGE_FLASH_UPDATE_ENABLE 

Data flash updates by the gauge algorithm (OperationCfgA().UPD_EN).

get, custom_bool: true if the gauge updates its data flash with learned values while operating.

set, custom_bool: true enables the updates if they are not enabled yet (Control() subcommand SetUPD_EN). Disabling is not supported by the gauge.

HY4245_FUEL_GAUGE_CONTROL_STATUS 

ControlStatus() register.

get, custom_uint: raw 16 bit register value, see HY4245_CONTROL_STATUS_*.

HY4245_FUEL_GAUGE_OPERATION_CONFIG_A 

OperationCfgA() register.

get, custom_uint: raw 16 bit register value, see HY4245_OPERATION_CONFIG_A_*.

HY4245_FUEL_GAUGE_FLAGS 

Flags() register.

get, custom_uint: raw 16 bit register value, see HY4245_FLAGS_*.

HY4245_FUEL_GAUGE_SAFETY_STATUS 

SafetyStatus() register.

get, custom_uint: raw 16 bit register value, see HY4245_SAFETY_STATUS_*.

HY4245_FUEL_GAUGE_LIFETIME_OVER_TEMPERATURE_MINS 

Accumulated duration of over temperature events (Control() subcommand LifetimeOverTempDuration).

get, custom_uint: time in minutes.

HY4245_FUEL_GAUGE_DATA_FLASH_CHECKSUM 

Data flash checksum (Control() subcommand DFChecksum).

get, custom_uint: 16 bit checksum over the data flash. Used to identify or verify the programmed configuration image. The gauge computes the checksum only while it is unsealed, so this requires calibration mode and returns -EACCES otherwise.

HY4245_FUEL_GAUGE_DATA_FLASH_VERSION 

Data flash version (Control() subcommand DFVersion), the version field of the programmed configuration image.

get, custom_uint: 16 bit version.

HY4245_FUEL_GAUGE_FIRMWARE_VERSION 

Firmware (algorithm) version (Control() subcommand Version).

get, custom_uint: 16 bit version.

HY4245_FUEL_GAUGE_CALIBRATION_MODE 

Calibration mode (data flash access session).

set, custom_bool: true unseals the gauge and enters calibration mode, false resets the gauge and waits until it is operational again (CONFIG_HY4245_RESET_SETTLE_TIME_MS).

get, custom_bool: true while the driver is in calibration mode.

HY4245_FUEL_GAUGE_RESET 

Full reset of the gauge (Control() subcommand Reset).

set, custom_bool: true triggers the reset and waits until the gauge is operational again. Leaves calibration mode.

HY4245_FUEL_GAUGE_DATA_FLASH_BLOCK 

Single data flash block, buffer property with struct hy4245_data_flash_block.

Requires calibration mode.

set_buffer_prop: writes len bytes of data to the start of the block, the remaining bytes of the block are kept.

get_buffer_prop: the caller fills subclass, block and len, the driver reads the block and copies len bytes into data.

HY4245_FUEL_GAUGE_MANUFACTURER_INFO_A 

Manufacturer info block A, buffer property with up to HY4245_DATA_FLASH_BLOCK_SIZE bytes.

Requires calibration mode.

set_buffer_prop: writes the buffer, padded with zeros to the block size.

get_buffer_prop: reads the first dst_len bytes of the block.

HY4245_FUEL_GAUGE_MANUFACTURER_INFO_B 

Manufacturer info block B, see HY4245_FUEL_GAUGE_MANUFACTURER_INFO_A.

HY4245_FUEL_GAUGE_MANUFACTURER_INFO_C 

Manufacturer info block C, see HY4245_FUEL_GAUGE_MANUFACTURER_INFO_A.

HY4245_FUEL_GAUGE_CONFIG_IMAGE 

Configuration image (battery parameter file), buffer property.

Requires calibration mode.

set_buffer_prop: programs the image into the data flash. The image is a sequence of HY4245_CONFIG_IMAGE_ELEMENT_SIZE byte elements (subclass, block, 32 data bytes). Elements that hold device specific calibration data or manufacturer info block A are not programmed, device specific bytes inside shared blocks are preserved. The image becomes effective after leaving calibration mode.

HY4245_FUEL_GAUGE_CONFIG_IMAGE_VERIFY 

Verify the data flash against a configuration image, buffer property.

Requires calibration mode.

set_buffer_prop: reads back every programmed element of the image and compares it with the data flash. Returns -EILSEQ on the first mismatch.

HY4245_FUEL_GAUGE_CLEAR_LEARNED 

Clear learned capacity information (Control() subcommand ClearLearned).

Clears HY4245_FLAGS_LRND, so the gauge relearns the capacity, e.g. after the battery has been replaced.

set, custom_bool: true triggers the command.

HY4245_FUEL_GAUGE_QUICK_START 

QuickStart: re-estimate the capacity information from the open circuit voltage (Control() subcommand QuickStart).

The gauge holds the bus for 250 ms, the driver waits accordingly.

set, custom_bool: true triggers the command.