Skip to content

Commit

Permalink
Merge pull request DotBots#328 from aabadie/reset_reason_enh
Browse files Browse the repository at this point in the history
projects/01bsp_wdt: enable reset reason support with nrf5340 net core
  • Loading branch information
aabadie authored Aug 22, 2024
2 parents f1f832f + e024baa commit de116f8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions projects/01bsp_wdt/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,32 @@

#define WDT_RELOAD_COUNT 5

#if defined(NRF5340_XXAA) && (NRF_APPLICATION)
#define NRF_RESET NRF_RESET_S
#else
#define NRF_RESET NRF_RESET_NS
#endif

static void _wdt_cb(void *ctx) {
(void)ctx;
db_gpio_toggle(&db_led1);
}

int main(void) {
printf("Starting watchdog timer\n");
#if defined(BOARD_NRF5340DK) && (NRF_APPLICATION)
#if defined(NRF5340_XXAA)
db_gpio_init(&db_led2, DB_GPIO_OUT);
db_gpio_set(&db_led2);
uint32_t resetreas = NRF_RESET_S->RESETREAS;
NRF_RESET_S->RESETREAS = NRF_RESET_S->RESETREAS;
uint32_t resetreas = NRF_RESET->RESETREAS;
NRF_RESET->RESETREAS = NRF_RESET->RESETREAS;
if (resetreas & RESET_RESETREAS_DOG0_Detected << RESET_RESETREAS_DOG0_Pos) {
db_gpio_clear(&db_led2);
}
#endif

db_timer_hf_init(0);
db_timer_hf_delay_s(0, 1);
#if defined(BOARD_NRF5340DK) && (NRF_APPLICATION)
#if defined(NRF5340_XXAA)
db_gpio_set(&db_led2);
#endif
db_gpio_init(&db_led1, DB_GPIO_OUT);
Expand Down

0 comments on commit de116f8

Please sign in to comment.