bsp_wdt.c 654 B

12345678910111213141516171819202122232425262728293031
  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. }
  18. void watchdog_init(void){
  19. uint32_t err_code;
  20. nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
  21. err_code = nrf_drv_wdt_init(&config, wdt_event_handler);
  22. APP_ERROR_CHECK(err_code);
  23. err_code = nrf_drv_wdt_channel_alloc(&m_channel_id);
  24. APP_ERROR_CHECK(err_code);
  25. nrf_drv_wdt_enable();
  26. }
  27. #endif