Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ersa::hal::IBattery Class Referenceabstract

#include <battery.h>

Inheritance diagram for ersa::hal::IBattery:
Inheritance graph
[legend]

Public Member Functions

virtual ~IBattery ()=default
 
virtual Result< void > init ()=0
 
virtual void sample ()=0
 
virtual uint16_t millivolts () const =0
 Return the latest measured voltage in millivolts.
 
virtual uint8_t percentage () const =0
 
virtual bool isConnected () const =0
 Report whether a usable battery is connected.
 
virtual bool isCharging () const =0
 Report whether external charging power is present.
 

Detailed Description

Board-level battery telemetry and sampling contract.

Sampling is explicit so PowerManager can adapt its cadence to battery health instead of performing ADC work on every UI tick. Implementations cache the most recent measurement; getters therefore return a coherent last sample without initiating potentially expensive hardware conversions.

Constructor & Destructor Documentation

◆ ~IBattery()

virtual ersa::hal::IBattery::~IBattery ( )
virtualdefault

Member Function Documentation

◆ init()

virtual Result< void > ersa::hal::IBattery::init ( )
pure virtual

Configure ADC/gauge resources and report whether the backend is usable.

Implemented in ersa::test::MockBattery.

◆ isCharging()

virtual bool ersa::hal::IBattery::isCharging ( ) const
pure virtual

Report whether external charging power is present.

Implemented in ersa::test::MockBattery.

◆ isConnected()

virtual bool ersa::hal::IBattery::isConnected ( ) const
pure virtual

Report whether a usable battery is connected.

Implemented in ersa::test::MockBattery.

◆ millivolts()

virtual uint16_t ersa::hal::IBattery::millivolts ( ) const
pure virtual

Return the latest measured voltage in millivolts.

Implemented in ersa::test::MockBattery.

◆ percentage()

virtual uint8_t ersa::hal::IBattery::percentage ( ) const
pure virtual

Return a bounded estimate; voltage-only boards must not imply precision.

Implemented in ersa::test::MockBattery.

◆ sample()

virtual void ersa::hal::IBattery::sample ( )
pure virtual

Refresh cached telemetry; implementations should keep this bounded.

Implemented in ersa::test::MockBattery.


The documentation for this class was generated from the following file: