diff options
| author | Avamander <avamander@gmail.com> | 2020-10-02 22:16:48 +0300 |
|---|---|---|
| committer | Avamander <avamander@gmail.com> | 2020-10-02 22:16:48 +0300 |
| commit | 6c86d1d9d706706fcb6f214aba8259e61ed68755 (patch) | |
| tree | 2f4137a9916869cee18fd01449aa83ee586b9604 /src/components/battery/BatteryController.h | |
| parent | 4daab2692692d47af24a9384eb0f402821527882 (diff) | |
Fixed all the includes that were broken due to the renames
Diffstat (limited to 'src/components/battery/BatteryController.h')
| -rw-r--r-- | src/components/battery/BatteryController.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h new file mode 100644 index 00000000..f07648a9 --- /dev/null +++ b/src/components/battery/BatteryController.h @@ -0,0 +1,27 @@ +#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 constexpr uint32_t chargingPin = 12; + static constexpr uint32_t powerPresentPin = 19; + static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; + 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 |
