diff options
| author | Riku Isokoski <riksu9000@gmail.com> | 2021-08-14 18:18:11 (GMT) |
|---|---|---|
| committer | Riku Isokoski <riksu9000@gmail.com> | 2021-08-14 18:18:11 (GMT) |
| commit | 23bde0d18e99a344b95b5f1507350e186659eec2 (patch) | |
| tree | f243992efa5ebd0dc1a8870ab062a0e119a02ab9 /src/components/battery/BatteryController.cpp | |
| parent | 643077341b14a52819cbaf02abbd5fb56cdeb802 (diff) | |
Make battery reading periodic. Add events. Disable pullup
Diffstat (limited to 'src/components/battery/BatteryController.cpp')
| -rw-r--r-- | src/components/battery/BatteryController.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index f8a64ec..aa038c5 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -9,10 +9,7 @@ Battery* Battery::instance = nullptr; Battery::Battery() { instance = this; -} - -void Battery::Init() { - nrf_gpio_cfg_input(chargingPin, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Pullup); + nrf_gpio_cfg_input(chargingPin, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Disabled); } void Battery::Update() { @@ -75,5 +72,11 @@ 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; +} |
