/************************************************************************** * * Copyright (c) 2026 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file BatteryMonitor.h * * @author (last) Suresh Dharnala * @date (last) 15-May-2026 * * @author (original) Suresh Dharnala * @date (original) 13-May-2026 * ***************************************************************************/ #ifndef APP_MONITORS_BATTERYMONITOR_H_ #define APP_MONITORS_BATTERYMONITOR_H_ #include "Utilities.h" void initBattery( void ); void execBatteryMonitor( void ); BOOL isBatteryCharged( void ); /// Payload record structure for battery status data broadcast message typedef struct { U32 RemainingCapacity; ///< Remaining capacity (mAh). U32 BatteryStatus; ///< Battery status. U32 BatteryChargerStatus; ///< Battery charge status. U32 BatteryI2CStatus; } BATTERY_STATUS_PAYLOAD_T; /// Payload record structure for battery module data broadcast message typedef struct { U32 FaultStatus; ///< Charger fault status. U32 TS; ///< Temperature. U32 VBAT; ///< Voltage. U32 VSYS; ///< System voltage in mV. U32 IBAT; ///< Current. U32 RelativeStateOfCharge; ///< Relative state of charge. U32 FullChargeCapacity; ///< Full charge capacity. } BATTERY_MANAGER_PAYLOAD_T; /// Enumeration of battery data to be read from the battery pack or battery charger in a round-robin fashion. typedef enum BatteryManagementEnum { BEGINNING_OF_LIST = 0, ///< Start of battery data list BATTERY_PACK_REMAINING_CAPACITY1, ///< Remaining battery capacity (in mWh) (first of 5 to increase frequency of reads) BATTERY_PACK_BATTERY_STATUS1, ///< Battery pack status (first of 5 to increase frequency of reads) BATTERY_CHARGER_STATUS1, ///< Battery charger status (first of 5 to increase frequency of reads) BATTERY_PACK_REMAINING_CAPACITY2, ///< Remaining battery capacity (in mWh) (second of 5 to increase frequency of reads) BATTERY_PACK_BATTERY_STATUS2, ///< Battery pack status (second of 5 to increase frequency of reads) BATTERY_CHARGER_STATUS2, ///< Battery charger status (second of 5 to increase frequency of reads) BATTERY_PACK_REMAINING_CAPACITY3, ///< Remaining battery capacity (in mWh) (third of 5 to increase frequency of reads) BATTERY_PACK_BATTERY_STATUS3, ///< Battery pack status (third of 5 to increase frequency of reads) BATTERY_CHARGER_STATUS3, ///< Battery charger status (third of 5 to increase frequency of reads) BATTERY_PACK_RELATIVE_STATE_OF_CHARGE, ///< Battery pack relative state of charge (%) (relative to full charge capacity) BATTERY_PACK_FULL_CHARGE_CAPACITY, ///< Battery pack full charge capacity (in mWh) BATTERY_PACK_REMAINING_CAPACITY4, ///< Remaining battery capacity (in mWh) (fourth of 5 to increase frequency of reads) BATTERY_PACK_BATTERY_STATUS4, ///< Battery pack status (fourth of 5 to increase frequency of reads) BATTERY_CHARGER_STATUS4, ///< Battery charger status (fourth of 5 to increase frequency of reads) BATTERY_PACK_REMAINING_CAPACITY5, ///< Remaining battery capacity (in mWh) (fifth of 5 to increase frequency of reads) BATTERY_PACK_BATTERY_STATUS5, ///< Battery pack status (fifth of 5 to increase frequency of reads) BATTERY_CHARGER_STATUS5, ///< Battery charger status (fifth of 5 to increase frequency of reads) BATTERY_CHARGER_TS, ///< Battery charger temperature (in deg K) BATTERY_CHARGER_VBAT, ///< Battery charger terminal voltage (in mV) BATTERY_CHARGER_VSYS, ///< Battery charger system voltage (in mV) BATTERY_CHARGER_FAULT, ///< Battery charger fault status BATTERY_CHARGER_CURRENT, ///< Battery charger current (in mA) END_OF_LIST, ///< End of battery data list NUM_OF_BATTERY_PACK_LIST, ///< Number of battery pack list } BATTERY_MANAGEMENT_ENUM_T; #endif /* APP_MONITORS_BATTERYMONITOR_H_ */