Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
esp32_battery.h
Go to the documentation of this file.
1#pragma once
2
3#if defined(ARDUINO)
4
5#include "ersa/hal/battery.h"
6#include "ersa/board/pins.h"
7
8namespace ersa {
9namespace hal {
10
12class Esp32Battery : public IBattery {
13public:
15 explicit Esp32Battery(const board::BatteryPins& pins);
16 ~Esp32Battery() override = default;
17
18 Result<void> init() override;
19 void sample() override;
20 uint16_t millivolts() const override;
21 uint8_t percentage() const override;
22 bool isConnected() const override;
23 bool isCharging() const override;
24
25private:
26 board::BatteryPins pins_;
27 uint16_t cachedMillivolts_{0};
28 uint8_t cachedPercentage_{0};
29 bool connected_{false};
30 bool hasVoltageSample_{false};
31};
32
33} // namespace hal
34} // namespace ersa
35
36#endif // ARDUINO
Definition application.h:10