Skip to content

Commit

Permalink
Merge pull request DotBots#326 from aabadie/wdt_resetreas
Browse files Browse the repository at this point in the history
projects/01bsp_wdt: use reset reason
  • Loading branch information
aabadie authored Aug 22, 2024
2 parents aaca261 + 62b1cee commit f1f832f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions projects/01bsp_wdt/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,21 @@ static void _wdt_cb(void *ctx) {

int main(void) {
printf("Starting watchdog timer\n");
#if defined(BOARD_NRF5340DK) && (NRF_APPLICATION)
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;
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)
db_gpio_set(&db_led2);
#endif
db_gpio_init(&db_led1, DB_GPIO_OUT);
db_wdt_init(2, _wdt_cb, NULL);
db_wdt_start();
Expand Down

0 comments on commit f1f832f

Please sign in to comment.