diff options
Diffstat (limited to 'src/Components/Battery/BatteryController.h')
| -rw-r--r-- | src/Components/Battery/BatteryController.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Components/Battery/BatteryController.h b/src/Components/Battery/BatteryController.h new file mode 100644 index 00000000..5c631dc2 --- /dev/null +++ b/src/Components/Battery/BatteryController.h @@ -0,0 +1,24 @@ +#pragma once +#include <drivers/include/nrfx_saadc.h> + + +namespace Pinetime { + namespace Controllers { + class Battery { + public: + void Init(); + void Update(); + float PercentRemaining() const { return percentRemaining; } + float Voltage() const { return voltage; } + bool IsCharging() const { return isCharging; } + bool IsPowerPresent() const { return isPowerPresent; } + + private: + static void SaadcEventHandler(nrfx_saadc_evt_t const * p_event); + float percentRemaining = 0.0f; + float voltage = 0.0f; + bool isCharging = false; + bool isPowerPresent = false; + }; + } +}
\ No newline at end of file |
