From 5f19f689f9ebe1b00f3f7da22b20fb2700811375 Mon Sep 17 00:00:00 2001 From: JF Date: Sun, 30 Apr 2023 15:56:13 +0200 Subject: Refactor, document and fix the Watchdog driver (#1710) * Refactor and document the Watchdog driver to make it more readable. Fix the configuration of the behaviours configuration that was not properly implemented (but it didn't cause any side effect since the correct value was eventually set in NRF_WDT->CONFIG). Fix the wrong interpretation of the reset reasons caused by implicit conversions of int to bool. --- src/systemtask/SystemTask.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/systemtask/SystemTask.cpp') diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 0621c6ef..b199d53f 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -99,9 +99,9 @@ void SystemTask::Process(void* instance) { void SystemTask::Work() { BootErrors bootError = BootErrors::None; - watchdog.Setup(7); + watchdog.Setup(7, Drivers::Watchdog::SleepBehaviour::Run, Drivers::Watchdog::HaltBehaviour::Pause); watchdog.Start(); - NRF_LOG_INFO("Last reset reason : %s", Pinetime::Drivers::Watchdog::ResetReasonToString(watchdog.ResetReason())); + NRF_LOG_INFO("Last reset reason : %s", Pinetime::Drivers::ResetReasonToString(watchdog.GetResetReason())); APP_GPIOTE_INIT(2); spi.Init(); @@ -403,7 +403,7 @@ void SystemTask::Work() { dateTimeController.UpdateTime(systick_counter); NoInit_BackUpTime = dateTimeController.CurrentDateTime(); if (nrf_gpio_pin_read(PinMap::Button) == 0) { - watchdog.Kick(); + watchdog.Reload(); } } #pragma clang diagnostic pop -- cgit v1.2.3-70-g09d2