1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include "Power.h"
- void PowerClass::begin() {
-
- M5.Power.begin();
-
- canControl = M5.Power.canControl();
- }
- void PowerClass::adaptChargeMode() {
-
- if(!canControl) {
- return;
- }
-
- if(M5.Power.isChargeFull()) {
- M5.Power.setCharge(false);
- } else {
- M5.Power.setCharge(true);
- }
-
- M5.Power.setLowPowerShutdownTime(M5.Power.ShutdownTime::SHUTDOWN_64S);
- }
- int8_t PowerClass::getBatteryLevel() {
- return M5.Power.getBatteryLevel();
- }
- PowerClass Power;
|