Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hy4245.h File Reference

HYCON HY4245 fuel gauge specific properties. More...

#include <stdbool.h>
#include <stdint.h>
#include <zephyr/drivers/fuel_gauge.h>
#include <zephyr/sys/util.h>

Go to the source code of this file.

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.
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.

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...

Detailed Description

HYCON HY4245 fuel gauge specific properties.

The HY4245 stores its battery configuration ("configuration image") and three manufacturer info blocks in an internal data flash. This header defines the device specific fuel gauge properties that give access to these features through the generic fuel gauge API:

Data flash access requires the gauge to be in calibration mode (HY4245_FUEL_GAUGE_CALIBRATION_MODE = true). Leaving calibration mode resets the gauge, which makes programmed data effective.