Skip to content

Commit

Permalink
[nrf noup] [nrfconnect] Align nrf_power calls to new scheme
Browse files Browse the repository at this point in the history
Now the API to manage GPREGRET register is unified for all devices
having one or more GPREGRET entries.

Signed-off-by: Nikodem Kastelik <[email protected]>
  • Loading branch information
nika-nordic authored and kkasperczyk-no committed Nov 5, 2023
1 parent b56e8a9 commit 4914da5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/platform/nrfconnect/Reboot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SoftwareRebootReason GetSoftwareRebootReason()

#else

using RetainedReason = decltype(nrf_power_gpregret_get(NRF_POWER));
using RetainedReason = decltype(nrf_power_gpregret_get(NRF_POWER, 0));

constexpr RetainedReason EncodeReason(SoftwareRebootReason reason)
{
Expand All @@ -56,17 +56,17 @@ void Reboot(SoftwareRebootReason reason)
{
const RetainedReason retainedReason = EncodeReason(reason);

nrf_power_gpregret_set(NRF_POWER, retainedReason);
nrf_power_gpregret_set(NRF_POWER, 0, retainedReason);

sys_reboot(retainedReason);
}

SoftwareRebootReason GetSoftwareRebootReason()
{
switch (nrf_power_gpregret_get(NRF_POWER))
switch (nrf_power_gpregret_get(NRF_POWER, 0))
{
case EncodeReason(SoftwareRebootReason::kSoftwareUpdate):
nrf_power_gpregret_set(NRF_POWER, 0);
nrf_power_gpregret_set(NRF_POWER, 0, 0);
return SoftwareRebootReason::kSoftwareUpdate;
default:
return SoftwareRebootReason::kOther;
Expand Down

0 comments on commit 4914da5

Please sign in to comment.