26 lines
623 B
C
26 lines
623 B
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <Arduino.h>
|
||
|
|
#include "config.h"
|
||
|
|
|
||
|
|
class PowerManager {
|
||
|
|
public:
|
||
|
|
void begin();
|
||
|
|
uint8_t getBatteryPercent();
|
||
|
|
bool isCharging();
|
||
|
|
void updateBatteryLED();
|
||
|
|
void flashLED(uint8_t r, uint8_t g, uint8_t b, uint16_t duration_ms = LED_PULSE_DURATION_MS);
|
||
|
|
void enterDeepSleep();
|
||
|
|
void enableLightSleep();
|
||
|
|
void disableEPDPower();
|
||
|
|
void enableEPDPower();
|
||
|
|
|
||
|
|
private:
|
||
|
|
uint8_t _lastBatteryPct = 100;
|
||
|
|
unsigned long _lastLEDPulse = 0;
|
||
|
|
uint8_t _ledBrightness = DEFAULT_LED_BRIGHTNESS;
|
||
|
|
|
||
|
|
void setLED(uint8_t index, uint8_t r, uint8_t g, uint8_t b);
|
||
|
|
void clearLEDs();
|
||
|
|
};
|