Add new App : Sysinfo. It displays various info about the running system : version, date/time, battery, brightness and resetreason. It contains placeholder for future use (like mac address, uptime,...).
This commit is contained in:
parent
8ed6ffaaf8
commit
fb64ba8fb6
|
@ -213,6 +213,8 @@ list(APPEND SOURCE_FILES
|
|||
DisplayApp/Screens/BatteryIcon.cpp
|
||||
DisplayApp/Screens/BleIcon.cpp
|
||||
DisplayApp/Screens/Brightness.cpp
|
||||
DisplayApp/Screens/ScreenList.cpp
|
||||
DisplayApp/Screens/Label.cpp
|
||||
main.cpp
|
||||
drivers/St7789.cpp
|
||||
drivers/SpiMaster.cpp
|
||||
|
@ -253,7 +255,8 @@ set(INCLUDE_FILES
|
|||
DisplayApp/Screens/BatteryIcon.h
|
||||
DisplayApp/Screens/BleIcon.cpp
|
||||
DisplayApp/Screens/Brightness.h
|
||||
# DisplayApp/Screens/Tab.h
|
||||
DisplayApp/Screens/ScreenList.h
|
||||
DisplayApp/Screens/Label.h
|
||||
drivers/St7789.h
|
||||
drivers/SpiMaster.h
|
||||
drivers/Watchdog.h
|
||||
|
|
|
@ -36,8 +36,8 @@ void Battery::Update() {
|
|||
voltage = (value * 2.0f) / (1024/3.0f);
|
||||
percentRemaining = ((voltage - 3.55)*100)*3.9;
|
||||
|
||||
NRF_LOG_INFO("BATTERY " NRF_LOG_FLOAT_MARKER " %% - " NRF_LOG_FLOAT_MARKER " v", NRF_LOG_FLOAT(percentRemaining), NRF_LOG_FLOAT(voltage));
|
||||
NRF_LOG_INFO("POWER Charging : %d - Power : %d", isCharging, isPowerPresent);
|
||||
// NRF_LOG_INFO("BATTERY " NRF_LOG_FLOAT_MARKER " %% - " NRF_LOG_FLOAT_MARKER " v", NRF_LOG_FLOAT(percentRemaining), NRF_LOG_FLOAT(voltage));
|
||||
// NRF_LOG_INFO("POWER Charging : %d - Power : %d", isCharging, isPowerPresent);
|
||||
}
|
||||
|
||||
void Battery::SaadcEventHandler(nrfx_saadc_evt_t const * event) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <DisplayApp/Screens/Meter.h>
|
||||
#include <DisplayApp/Screens/Gauge.h>
|
||||
#include <DisplayApp/Screens/Brightness.h>
|
||||
#include <DisplayApp/Screens/ScreenList.h>
|
||||
#include "../SystemTask/SystemTask.h"
|
||||
|
||||
using namespace Pinetime::Applications;
|
||||
|
@ -24,13 +25,15 @@ DisplayApp::DisplayApp(Pinetime::Drivers::St7789& lcd,
|
|||
Controllers::Battery &batteryController,
|
||||
Controllers::Ble &bleController,
|
||||
Controllers::DateTime &dateTimeController,
|
||||
Pinetime::Drivers::WatchdogView& watchdog,
|
||||
Pinetime::System::SystemTask& systemTask) :
|
||||
lcd{lcd},
|
||||
lvgl{lvgl},
|
||||
touchPanel{touchPanel},
|
||||
batteryController{batteryController},
|
||||
bleController{bleController},
|
||||
dateTimeController{dateTimeController},
|
||||
watchdog{watchdog},
|
||||
touchPanel{touchPanel},
|
||||
currentScreen{new Screens::Clock(this, dateTimeController, batteryController, bleController) },
|
||||
systemTask{systemTask} {
|
||||
msgQueue = xQueueCreate(queueSize, itemSize);
|
||||
|
@ -167,7 +170,8 @@ void DisplayApp::RunningState() {
|
|||
currentScreen.reset(new Screens::Clock(this, dateTimeController, batteryController, bleController));
|
||||
onClockApp = true;
|
||||
break;
|
||||
case Apps::Test: currentScreen.reset(new Screens::Message(this)); break;
|
||||
// case Apps::Test: currentScreen.reset(new Screens::Message(this)); break;
|
||||
case Apps::SysInfo: currentScreen.reset(new Screens::ScreenList(this, dateTimeController, batteryController, brightnessController, watchdog)); break;
|
||||
case Apps::Meter: currentScreen.reset(new Screens::Meter(this)); break;
|
||||
case Apps::Gauge: currentScreen.reset(new Screens::Gauge(this)); break;
|
||||
case Apps::Brightness : currentScreen.reset(new Screens::Brightness(this, brightnessController)); break;
|
||||
|
@ -221,3 +225,16 @@ TouchEvents DisplayApp::OnTouchEvent() {
|
|||
void DisplayApp::StartApp(DisplayApp::Apps app) {
|
||||
nextApp = app;
|
||||
}
|
||||
|
||||
void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
|
||||
switch(direction){
|
||||
case DisplayApp::FullRefreshDirections::Down:
|
||||
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down);
|
||||
break;
|
||||
case DisplayApp::FullRefreshDirections::Up:
|
||||
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "LittleVgl.h"
|
||||
#include <date/date.h>
|
||||
#include <DisplayApp/Screens/Clock.h>
|
||||
#include <drivers/Watchdog.h>
|
||||
#include "TouchEvents.h"
|
||||
|
||||
|
||||
|
@ -26,7 +27,9 @@ namespace Pinetime {
|
|||
class DisplayApp {
|
||||
public:
|
||||
enum class States {Idle, Running};
|
||||
enum class Messages : uint8_t {GoToSleep, GoToRunning, UpdateDateTime, UpdateBleConnection, UpdateBatteryLevel, TouchEvent, SwitchScreen,ButtonPushed} ;
|
||||
enum class Messages : uint8_t {GoToSleep, GoToRunning, UpdateDateTime, UpdateBleConnection, UpdateBatteryLevel, TouchEvent, SwitchScreen,ButtonPushed};
|
||||
enum class FullRefreshDirections { None, Up, Down };
|
||||
|
||||
|
||||
DisplayApp(Pinetime::Drivers::St7789& lcd,
|
||||
Pinetime::Components::LittleVgl& lvgl,
|
||||
|
@ -34,13 +37,15 @@ namespace Pinetime {
|
|||
Controllers::Battery &batteryController,
|
||||
Controllers::Ble &bleController,
|
||||
Controllers::DateTime& dateTimeController,
|
||||
Pinetime::Drivers::WatchdogView& watchdog,
|
||||
Pinetime::System::SystemTask& systemTask);
|
||||
void Start();
|
||||
void PushMessage(Messages msg);
|
||||
|
||||
enum class Apps {None, Launcher, Clock, Test, Meter, Gauge, Brightness};
|
||||
enum class Apps {None, Launcher, Clock, SysInfo, Meter, Gauge, Brightness};
|
||||
void StartApp(Apps app);
|
||||
|
||||
void SetFullRefresh(FullRefreshDirections direction);
|
||||
private:
|
||||
TaskHandle_t taskHandle;
|
||||
static void Process(void* instance);
|
||||
|
@ -60,6 +65,7 @@ namespace Pinetime {
|
|||
Pinetime::Controllers::Battery &batteryController;
|
||||
Pinetime::Controllers::Ble &bleController;
|
||||
Pinetime::Controllers::DateTime& dateTimeController;
|
||||
Pinetime::Drivers::WatchdogView& watchdog;
|
||||
|
||||
Pinetime::Drivers::Cst816S& touchPanel;
|
||||
TouchEvents OnTouchEvent();
|
||||
|
|
|
@ -37,23 +37,6 @@ Clock::Clock(DisplayApp* app,
|
|||
lv_img_set_src(bleIcon, BleIcon::GetIcon(false));
|
||||
lv_obj_align(bleIcon, batteryIcon, LV_ALIGN_OUT_LEFT_MID, 0, 0);
|
||||
|
||||
// label_battery = lv_label_create(lv_scr_act(), NULL);
|
||||
// lv_obj_align(label_battery, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -80, 0);
|
||||
|
||||
// labelStyle = const_cast<lv_style_t *>(lv_label_get_style(label_battery, LV_LABEL_STYLE_MAIN));
|
||||
// labelStyle->text.font = &jetbrains_mono_bold_20;
|
||||
//
|
||||
// lv_style_copy(&labelBigStyle, labelStyle);
|
||||
// labelBigStyle.text.font = &jetbrains_mono_extrabold_compressed;
|
||||
//
|
||||
// lv_label_set_style(label_battery, LV_LABEL_STYLE_MAIN, labelStyle);
|
||||
|
||||
// label_ble = lv_label_create(lv_scr_act(), NULL);
|
||||
|
||||
|
||||
// lv_label_set_style(label_ble, LV_LABEL_STYLE_MAIN, labelStyle);
|
||||
// lv_obj_align(label_ble, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 10, 0);
|
||||
|
||||
label_date = lv_label_create(lv_scr_act(), NULL);
|
||||
|
||||
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
|
||||
|
|
28
src/DisplayApp/Screens/Label.cpp
Normal file
28
src/DisplayApp/Screens/Label.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include <libs/lvgl/lvgl.h>
|
||||
#include "Label.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
|
||||
Label::Label(const char* text) : text{text} {
|
||||
|
||||
}
|
||||
|
||||
Label::~Label() {
|
||||
|
||||
}
|
||||
|
||||
void Label::Refresh() {
|
||||
|
||||
}
|
||||
|
||||
void Label::Show() {
|
||||
label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_LEFT);
|
||||
lv_obj_set_size(label, 240, 240);
|
||||
lv_label_set_text(label, text);
|
||||
}
|
||||
|
||||
void Label::Hide() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
24
src/DisplayApp/Screens/Label.h
Normal file
24
src/DisplayApp/Screens/Label.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "Screen.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
class Label {
|
||||
public:
|
||||
Label() = default;
|
||||
explicit Label(const char* text);
|
||||
~Label();
|
||||
void Refresh();
|
||||
|
||||
void Hide();
|
||||
void Show();
|
||||
private:
|
||||
lv_obj_t * label = nullptr;
|
||||
const char* text = nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
125
src/DisplayApp/Screens/ScreenList.cpp
Normal file
125
src/DisplayApp/Screens/ScreenList.cpp
Normal file
|
@ -0,0 +1,125 @@
|
|||
#include <libs/lvgl/lvgl.h>
|
||||
#include <DisplayApp/DisplayApp.h>
|
||||
#include "ScreenList.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
// TODO this class must be improved to receive the list of "sub screens" via pointer or
|
||||
// move operation.
|
||||
// It should accept many type of "sub screen" (it only supports Label for now).
|
||||
// The number of sub screen it supports must be dynamic.
|
||||
ScreenList::ScreenList(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::DateTime &dateTimeController,
|
||||
Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Drivers::WatchdogView& watchdog) :
|
||||
Screen(app),
|
||||
dateTimeController{dateTimeController}, batteryController{batteryController}, brightnessController{brightnessController}, watchdog{watchdog} {
|
||||
screens.reserve(3);
|
||||
|
||||
// TODO all of this is far too heavy (string processing). This should be improved.
|
||||
// TODO the info (battery, time,...) should be updated in the Refresh method.
|
||||
char t1[200];
|
||||
|
||||
auto batteryPercent = static_cast<int16_t>(batteryController.PercentRemaining());
|
||||
if(batteryPercent > 100) batteryPercent = 100;
|
||||
else if(batteryPercent < 0) batteryPercent = 0;
|
||||
|
||||
uint8_t brightness = 0;
|
||||
switch(brightnessController.Level()) {
|
||||
case Controllers::BrightnessController::Levels::Low: brightness = 1; break;
|
||||
case Controllers::BrightnessController::Levels::Medium: brightness = 2; break;
|
||||
case Controllers::BrightnessController::Levels::High: brightness = 3; break;
|
||||
}
|
||||
auto resetReason = [&watchdog]() {
|
||||
switch (watchdog.ResetReason()) {
|
||||
case Drivers::Watchdog::ResetReasons::Watchdog: return "wtdg";
|
||||
case Drivers::Watchdog::ResetReasons::HardReset: return "hardr";
|
||||
case Drivers::Watchdog::ResetReasons::NFC: return "nfc";
|
||||
case Drivers::Watchdog::ResetReasons::SoftReset: return "softr";
|
||||
case Drivers::Watchdog::ResetReasons::CpuLockup: return "cpulock";
|
||||
case Drivers::Watchdog::ResetReasons::SystemOff: return "off";
|
||||
case Drivers::Watchdog::ResetReasons::LpComp: return "lpcomp";
|
||||
case Drivers::Watchdog::ResetReasons::DebugInterface: return "dbg";
|
||||
case Drivers::Watchdog::ResetReasons::ResetPin: return "rst";
|
||||
default: return "?";
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
sprintf(t1, "Pinetime\n"
|
||||
"Version:%d.%d.%d\n"
|
||||
"Build: xx/xx/xxxx\n"
|
||||
"Time: %02d:%02d:%02d\n"
|
||||
"date: %02d/%02d/%04d\n"
|
||||
"Uptime: xd xxhxx:xx\n"
|
||||
"Battery: %d%%\n"
|
||||
"Backlight: %d/3\n"
|
||||
"Last reset: %s\n"
|
||||
"BLE MAC: \n AA:BB:CC:DD:EE:FF", Version::Major(), Version::Minor(), Version::Patch(),
|
||||
dateTimeController.Hours(), dateTimeController.Minutes(), dateTimeController.Seconds(),
|
||||
dateTimeController.Day(), dateTimeController.Month(), dateTimeController.Year(),
|
||||
batteryPercent, brightness, resetReason);
|
||||
/*
|
||||
auto t1 = "Pinetime\n"
|
||||
"Version:\n"
|
||||
"Build: 23/03/2020\n"
|
||||
"Time: 17:23:12\n"
|
||||
"date: 23/03/2020\n"
|
||||
"Uptime: 2d 13h52:21\n"
|
||||
"Battery: 3.56v/82%\n"
|
||||
"Backlight: 2/3\n"
|
||||
"Last reset: wtdg\n"
|
||||
"BLE MAC: \n AA:BB:CC:DD:EE:FF";*/
|
||||
screens.emplace_back(t1);
|
||||
|
||||
auto t2 = "Hello from\nthe developper!";
|
||||
screens.emplace_back(t2);
|
||||
|
||||
auto t3 = "Place holder\nin case we need\nmore room!";
|
||||
screens.emplace_back(t3);
|
||||
|
||||
auto &screen = screens[screenIndex];
|
||||
screen.Show();
|
||||
}
|
||||
|
||||
ScreenList::~ScreenList() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
bool ScreenList::Refresh() {
|
||||
auto &screen = screens[screenIndex];
|
||||
screen.Refresh();
|
||||
|
||||
return running;
|
||||
}
|
||||
|
||||
bool ScreenList::OnButtonPushed() {
|
||||
running = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScreenList::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||
switch (event) {
|
||||
case TouchEvents::SwipeDown:
|
||||
if (screenIndex > 0) {
|
||||
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
|
||||
auto &oldScreen = screens[screenIndex];
|
||||
oldScreen.Hide();
|
||||
screenIndex--;
|
||||
auto &newScreen = screens[screenIndex];
|
||||
newScreen.Show();
|
||||
}
|
||||
return true;
|
||||
case TouchEvents::SwipeUp:
|
||||
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up);
|
||||
if (screenIndex < screens.size() - 1) {
|
||||
auto &oldScreen = screens[screenIndex];
|
||||
oldScreen.Hide();
|
||||
screenIndex++;
|
||||
auto &newScreen = screens[screenIndex];
|
||||
newScreen.Show();
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
34
src/DisplayApp/Screens/ScreenList.h
Normal file
34
src/DisplayApp/Screens/ScreenList.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "Screen.h"
|
||||
#include "Label.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Applications {
|
||||
namespace Screens {
|
||||
class ScreenList : public Screen {
|
||||
public:
|
||||
explicit ScreenList(DisplayApp* app,
|
||||
Pinetime::Controllers::DateTime& dateTimeController,
|
||||
Pinetime::Controllers::Battery& batteryController,
|
||||
Pinetime::Controllers::BrightnessController& brightnessController,
|
||||
Pinetime::Drivers::WatchdogView& watchdog);
|
||||
~ScreenList() override;
|
||||
bool Refresh() override;
|
||||
bool OnButtonPushed() override;
|
||||
bool OnTouchEvent(TouchEvents event) override;
|
||||
private:
|
||||
bool running = true;
|
||||
uint8_t screenIndex = 0;
|
||||
|
||||
// TODO choose another container without dynamic alloc
|
||||
std::vector<Screens::Label> screens;
|
||||
Pinetime::Controllers::DateTime& dateTimeController;
|
||||
Pinetime::Controllers::Battery& batteryController;
|
||||
Pinetime::Controllers::BrightnessController& brightnessController;
|
||||
Pinetime::Drivers::WatchdogView& watchdog;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -126,7 +126,7 @@ void Tile::OnObjectEvent(lv_obj_t *obj, lv_event_t event, uint32_t buttonId) {
|
|||
modal->Show();
|
||||
break;
|
||||
case 4:
|
||||
tile->StartTestApp();
|
||||
tile->StartSysInfoApp();
|
||||
break;
|
||||
case 5:
|
||||
tile->StartBrightnessApp();
|
||||
|
@ -148,8 +148,8 @@ void Tile::StartClockApp() {
|
|||
running = false;
|
||||
}
|
||||
|
||||
void Tile::StartTestApp() {
|
||||
app->StartApp(DisplayApp::Apps::Test);
|
||||
void Tile::StartSysInfoApp() {
|
||||
app->StartApp(DisplayApp::Apps::SysInfo);
|
||||
running = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Pinetime {
|
|||
uint32_t clickCount = 0 ;
|
||||
uint32_t previousClickCount = 0;
|
||||
void StartClockApp();
|
||||
void StartTestApp();
|
||||
void StartSysInfoApp();
|
||||
void StartMeterApp();
|
||||
void StartGaugeApp();
|
||||
bool running = true;
|
||||
|
|
|
@ -13,7 +13,9 @@ SystemTask::SystemTask(Pinetime::Drivers::SpiMaster &spi, Pinetime::Drivers::St7
|
|||
Pinetime::Drivers::Cst816S &touchPanel, Pinetime::Components::LittleVgl &lvgl,
|
||||
Pinetime::Controllers::Battery &batteryController, Pinetime::Controllers::Ble &bleController,
|
||||
Pinetime::Controllers::DateTime& dateTimeController) :
|
||||
spi{spi}, lcd{lcd}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController}, bleController{bleController}, dateTimeController{dateTimeController} {
|
||||
spi{spi}, lcd{lcd}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController},
|
||||
bleController{bleController}, dateTimeController{dateTimeController},
|
||||
watchdog{}, watchdogView{watchdog}{
|
||||
systemTaksMsgQueue = xQueueCreate(10, 1);
|
||||
}
|
||||
|
||||
|
@ -42,7 +44,7 @@ void SystemTask::Work() {
|
|||
touchPanel.Init();
|
||||
batteryController.Init();
|
||||
|
||||
displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController, dateTimeController, *this));
|
||||
displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController, dateTimeController, watchdogView, *this));
|
||||
displayApp->Start();
|
||||
|
||||
batteryController.Update();
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace Pinetime {
|
|||
QueueHandle_t systemTaksMsgQueue;
|
||||
bool isSleeping = false;
|
||||
Pinetime::Drivers::Watchdog watchdog;
|
||||
Pinetime::Drivers::WatchdogView watchdogView;
|
||||
|
||||
|
||||
static constexpr uint8_t pinSpiSck = 2;
|
||||
|
|
|
@ -19,6 +19,8 @@ void Watchdog::Setup(uint8_t timeoutSeconds) {
|
|||
|
||||
/* Enable reload requests */
|
||||
NRF_WDT->RREN = (WDT_RREN_RR0_Enabled << WDT_RREN_RR0_Pos);
|
||||
|
||||
resetReason = ActualResetReason();
|
||||
}
|
||||
|
||||
void Watchdog::Start() {
|
||||
|
@ -29,18 +31,18 @@ void Watchdog::Kick() {
|
|||
NRF_WDT->RR[0] = WDT_RR_RR_Reload;
|
||||
}
|
||||
|
||||
Watchdog::ResetReasons Watchdog::ResetReason() {
|
||||
Watchdog::ResetReasons Watchdog::ActualResetReason() const {
|
||||
uint32_t resetReason;
|
||||
sd_power_reset_reason_get(&resetReason);
|
||||
sd_power_reset_reason_clr(0xFFFFFFFF);
|
||||
if(resetReason & 0x01) return ResetReasons::ResetPin;
|
||||
if((resetReason >> 1) & 0x01) return ResetReasons::Watchdog;
|
||||
if((resetReason >> 2) & 0x01) return ResetReasons::SoftReset;
|
||||
if((resetReason >> 3) & 0x01) return ResetReasons::CpuLockup;
|
||||
if((resetReason >> 16) & 0x01) return ResetReasons::SystemOff;
|
||||
if((resetReason >> 17) & 0x01) return ResetReasons::LpComp;
|
||||
if((resetReason >> 18) & 0x01) return ResetReasons::DebugInterface;
|
||||
if((resetReason >> 19) & 0x01) return ResetReasons::NFC;
|
||||
if(resetReason & 0x01u) return ResetReasons::ResetPin;
|
||||
if((resetReason >> 1u) & 0x01u) return ResetReasons::Watchdog;
|
||||
if((resetReason >> 2u) & 0x01u) return ResetReasons::SoftReset;
|
||||
if((resetReason >> 3u) & 0x01u) return ResetReasons::CpuLockup;
|
||||
if((resetReason >> 16u) & 0x01u) return ResetReasons::SystemOff;
|
||||
if((resetReason >> 17u) & 0x01u) return ResetReasons::LpComp;
|
||||
if((resetReason >> 18u) & 0x01u) return ResetReasons::DebugInterface;
|
||||
if((resetReason >> 19u) & 0x01u) return ResetReasons::NFC;
|
||||
return ResetReasons::HardReset;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,20 @@ namespace Pinetime {
|
|||
void Setup(uint8_t timeoutSeconds);
|
||||
void Start();
|
||||
void Kick();
|
||||
|
||||
ResetReasons ResetReason();
|
||||
ResetReasons ResetReason() const { return resetReason; }
|
||||
static const char* ResetReasonToString(ResetReasons reason);
|
||||
private:
|
||||
ResetReasons resetReason;
|
||||
ResetReasons ActualResetReason() const;
|
||||
};
|
||||
|
||||
class WatchdogView {
|
||||
public:
|
||||
WatchdogView(const Watchdog& watchdog) : watchdog{watchdog} { }
|
||||
Watchdog::ResetReasons ResetReason() const { return watchdog.ResetReason();}
|
||||
|
||||
private:
|
||||
const Watchdog& watchdog;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue