Merge branch 'develop' into pinmap
This commit is contained in:
@@ -10,10 +10,7 @@ Battery* Battery::instance = nullptr;
|
||||
|
||||
Battery::Battery() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
void Battery::Init() {
|
||||
nrf_gpio_cfg_input(PinMap::Charging, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Pullup);
|
||||
nrf_gpio_cfg_input(PinMap::Charging, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Disabled);
|
||||
}
|
||||
|
||||
void Battery::Update() {
|
||||
@@ -76,5 +73,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;
|
||||
}
|
||||
|
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <drivers/include/nrfx_saadc.h>
|
||||
#include <array>
|
||||
#include <numeric>
|
||||
#include <systemtask/SystemTask.h>
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Controllers {
|
||||
@@ -11,8 +10,8 @@ namespace Pinetime {
|
||||
public:
|
||||
Battery();
|
||||
|
||||
void Init();
|
||||
void Update();
|
||||
void Register(System::SystemTask* systemTask);
|
||||
|
||||
uint8_t PercentRemaining() const {
|
||||
return percentRemaining;
|
||||
@@ -47,6 +46,8 @@ namespace Pinetime {
|
||||
static void AdcCallbackStatic(nrfx_saadc_evt_t const* event);
|
||||
|
||||
bool isReading = false;
|
||||
|
||||
Pinetime::System::SystemTask* systemTask = nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ namespace Pinetime {
|
||||
};
|
||||
|
||||
void setWakeUpMode(WakeUpMode wakeUp, bool enabled) {
|
||||
if (!isWakeUpModeOn(wakeUp)) {
|
||||
if (enabled != isWakeUpModeOn(wakeUp)) {
|
||||
settingsChanged = true;
|
||||
}
|
||||
settings.wakeUpMode.set(static_cast<size_t>(wakeUp), enabled);
|
||||
|
Reference in New Issue
Block a user