#include <mock_battery.h>
|
| | MockBattery (uint16_t mv=3900, uint8_t pct=80, bool conn=true, bool chg=false) |
| |
| Result< void > | init () override |
| |
| void | sample () override |
| |
| uint16_t | millivolts () const override |
| | Return the latest measured voltage in millivolts.
|
| |
| uint8_t | percentage () const override |
| |
| bool | isConnected () const override |
| | Report whether a usable battery is connected.
|
| |
| bool | isCharging () const override |
| | Report whether external charging power is present.
|
| |
| void | setMv (uint16_t mv) |
| |
| void | setPct (uint8_t pct) |
| |
| void | setConn (bool conn) |
| |
| void | setChg (bool chg) |
| |
| virtual | ~IBattery ()=default |
| |
◆ MockBattery()
| ersa::test::MockBattery::MockBattery |
( |
uint16_t |
mv = 3900, |
|
|
uint8_t |
pct = 80, |
|
|
bool |
conn = true, |
|
|
bool |
chg = false |
|
) |
| |
|
inlineexplicit |
◆ init()
| Result< void > ersa::test::MockBattery::init |
( |
| ) |
|
|
inlineoverridevirtual |
Configure ADC/gauge resources and report whether the backend is usable.
Implements ersa::hal::IBattery.
◆ isCharging()
| bool ersa::test::MockBattery::isCharging |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ isConnected()
| bool ersa::test::MockBattery::isConnected |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ millivolts()
| uint16_t ersa::test::MockBattery::millivolts |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ percentage()
| uint8_t ersa::test::MockBattery::percentage |
( |
| ) |
const |
|
inlineoverridevirtual |
Return a bounded estimate; voltage-only boards must not imply precision.
Implements ersa::hal::IBattery.
◆ sample()
| void ersa::test::MockBattery::sample |
( |
| ) |
|
|
inlineoverridevirtual |
Refresh cached telemetry; implementations should keep this bounded.
Implements ersa::hal::IBattery.
◆ setChg()
| void ersa::test::MockBattery::setChg |
( |
bool |
chg | ) |
|
|
inline |
◆ setConn()
| void ersa::test::MockBattery::setConn |
( |
bool |
conn | ) |
|
|
inline |
◆ setMv()
| void ersa::test::MockBattery::setMv |
( |
uint16_t |
mv | ) |
|
|
inline |
◆ setPct()
| void ersa::test::MockBattery::setPct |
( |
uint8_t |
pct | ) |
|
|
inline |
◆ chg_
| bool ersa::test::MockBattery::chg_ |
|
private |
◆ conn_
| bool ersa::test::MockBattery::conn_ |
|
private |
◆ mv_
| uint16_t ersa::test::MockBattery::mv_ |
|
private |
◆ pct_
| uint8_t ersa::test::MockBattery::pct_ |
|
private |
The documentation for this class was generated from the following file: