Battery Monitor for T-Beams

This commit is contained in:
richonguzman 2024-05-27 11:46:14 -04:00
parent e9bb0391f2
commit c5217842ff
6 changed files with 64 additions and 36 deletions

View file

@ -21,6 +21,22 @@ extern Configuration Config;
namespace POWER_Utils {
double getBatteryVoltage() {
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
return (PMU.getBattVoltage() / 1000.0);
#else
return 0.0;
#endif
}
bool isBatteryConnected() {
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
return PMU.isBatteryConnect();
#else
return false;
#endif
}
void activateMeasurement() {
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
PMU.disableTSPinMeasure();