bsp_wdt.c 806 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "sdk_common.h"
  2. #include "SEGGER_RTT.h"
  3. #include "nrf_drv_pwm.h"
  4. #include "usr_config.h"
  5. #include "nrf_drv_wdt.h"
  6. #if WATCHDOG_ENANBLE
  7. nrf_drv_wdt_channel_id m_channel_id;
  8. void feed_watchdog(void)
  9. {
  10. nrf_drv_wdt_channel_feed(m_channel_id);
  11. }
  12. /**
  13. * @brief WDT events handler.
  14. */
  15. void wdt_event_handler(void)
  16. {
  17. SEGGER_RTT_printf(0,"wdt_event_handler!!!!!!!!!!!!!!...\n");
  18. }
  19. void watchdog_init(void){
  20. uint32_t err_code;
  21. nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
  22. config.interrupt_priority = WDT_IRQ_PRIORITY;
  23. config.reload_value = WDT_RELOAD_VALUE;
  24. err_code = nrf_drv_wdt_init(&config, wdt_event_handler);
  25. APP_ERROR_CHECK(err_code);
  26. err_code = nrf_drv_wdt_channel_alloc(&m_channel_id);
  27. APP_ERROR_CHECK(err_code);
  28. nrf_drv_wdt_enable();
  29. }
  30. #endif