#include #include "nrf.h" #include "nrf_drv_wdt.h" #include "app_error.h" #include "wdg.h" #include "nrf_drv_clock.h" #include "app_util_platform.h" #include "app_timer.h" #include "timer.h" #define WDT_RELOAD_TIME 5000 #define WDT_FEED_INTERVAL 2000 static nrf_drv_wdt_channel_id m_channel_id; static void wdt_event_handler(void) { } static void watchdog_feed_timer_callback(void) { nrf_drv_wdt_channel_feed(m_channel_id); } void wdg_feed(void) { timer_register(watchdog_feed_timer_callback, WDT_FEED_INTERVAL); } void wdg_init(void) { ret_code_t err_code; nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG; config.reload_value = WDT_RELOAD_TIME; err_code = nrf_drv_wdt_init(&config, wdt_event_handler); APP_ERROR_CHECK(err_code); err_code = nrf_drv_wdt_channel_alloc(&m_channel_id); APP_ERROR_CHECK(err_code); nrf_drv_wdt_enable(); }