Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions drivers/hwinfo/hwinfo_nrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@
| RESET_SOFTWARE
| RESET_CPU_LOCKUP
| RESET_LOW_POWER_WAKE
#if NRFX_RESET_REASON_HAS_VBUS

Check notice on line 210 in drivers/hwinfo/hwinfo_nrf.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/hwinfo/hwinfo_nrf.c:210 - *supported = (RESET_PIN - | RESET_WATCHDOG - | RESET_SOFTWARE - | RESET_CPU_LOCKUP - | RESET_LOW_POWER_WAKE + *supported = (RESET_PIN | RESET_WATCHDOG | RESET_SOFTWARE | RESET_CPU_LOCKUP | + RESET_LOW_POWER_WAKE
| RESET_POR
#endif
#if NRFX_RESET_REASON_HAS_GRTC
| RESET_CLOCK
#endif
#if defined(NRFX_RESET_REASON_TAMPC_MASK) || defined(NRFX_RESET_REASON_SECTAMPER_MASK)
| RESET_SECURITY
#endif
| RESET_DEBUG);

return 0;
Expand Down
20 changes: 18 additions & 2 deletions samples/boards/nordic/system_off/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@
static const struct device *comp_dev = DEVICE_DT_GET(DT_NODELABEL(comp));
#endif

void print_reset_cause(uint32_t reset_cause)
int print_reset_cause(uint32_t reset_cause)
{
int32_t ret;
uint32_t supported;

ret = hwinfo_get_supported_reset_cause((uint32_t *) &supported);

Check notice on line 40 in samples/boards/nordic/system_off/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

samples/boards/nordic/system_off/src/main.c:40 - ret = hwinfo_get_supported_reset_cause((uint32_t *) &supported); + ret = hwinfo_get_supported_reset_cause((uint32_t *)&supported);
if (ret || !(reset_cause & supported)) {
return -ENOTSUP;
}

if (reset_cause & RESET_DEBUG) {
printf("Reset by debugger.\n");
} else if (reset_cause & RESET_CLOCK) {
Expand All @@ -42,6 +51,8 @@
} else {
printf("Other wake up cause 0x%08X.\n", reset_cause);
}

return 0;
}

int main(void)
Expand All @@ -57,7 +68,12 @@

printf("\n%s system off demo\n", CONFIG_BOARD);
hwinfo_get_reset_cause(&reset_cause);
print_reset_cause(reset_cause);
rc = print_reset_cause(reset_cause);

if (rc < 0) {
printf("Reset cause not supported.\n");
return 0;
}

if (IS_ENABLED(CONFIG_APP_USE_RETAINED_MEM)) {
bool retained_ok = retained_validate();
Expand Down
Loading