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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user