diff options
author | Mark Russell <mruss660@gmail.com> | 2021-09-16 16:12:20 -0400 |
---|---|---|
committer | Mark Russell <mruss660@gmail.com> | 2021-09-16 16:12:20 -0400 |
commit | cdf99b08f42c3826a8608d756bc7cda0a476ed98 (patch) | |
tree | cd30018ebb68be09653b589ae11647ca33d40c73 /src/components/battery/BatteryController.cpp | |
parent | 1d43adcdfa7bd15ba45c0c9d7c59c0ff99176b9c (diff) |
Revert "Merge upstream"
This reverts commit 1d43adcdfa7bd15ba45c0c9d7c59c0ff99176b9c.
Diffstat (limited to 'src/components/battery/BatteryController.cpp')
-rw-r--r-- | src/components/battery/BatteryController.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index 4ef20a24..f8a64ecd 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -1,5 +1,4 @@ #include "BatteryController.h" -#include "drivers/PinMap.h" #include <hal/nrf_gpio.h> #include <nrfx_saadc.h> #include <algorithm> @@ -10,12 +9,15 @@ Battery* Battery::instance = nullptr; Battery::Battery() { instance = this; - nrf_gpio_cfg_input(PinMap::Charging, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Disabled); +} + +void Battery::Init() { + nrf_gpio_cfg_input(chargingPin, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Pullup); } void Battery::Update() { - isCharging = !nrf_gpio_pin_read(PinMap::Charging); - isPowerPresent = !nrf_gpio_pin_read(PinMap::PowerPresent); + isCharging = !nrf_gpio_pin_read(chargingPin); + isPowerPresent = !nrf_gpio_pin_read(powerPresentPin); if (isReading) { return; @@ -73,11 +75,5 @@ void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) { nrfx_saadc_uninit(); isReading = false; - - systemTask->PushMessage(System::Messages::BatteryMeasurementDone); } } - -void Battery::Register(Pinetime::System::SystemTask* systemTask) { - this->systemTask = systemTask; -} |