42 #if RUUVI_NRF5_SDK15_WATCHDOG_ENABLED
47 #include "nrf_drv_clock.h"
48 #include "nrf_drv_wdt.h"
51 nrf_drv_wdt_channel_id m_channel_id;
57 void wdt_event_handler (
void)
60 if (NULL != m_on_trigger)
84 uint32_t err_code = NRF_SUCCESS;
85 nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
86 config.reload_value = interval_ms;
87 err_code = nrf_drv_wdt_init (&config, wdt_event_handler);
89 if (NRF_SUCCESS == err_code)
91 err_code = nrf_drv_wdt_channel_alloc (&m_channel_id);
93 if (NRF_SUCCESS == err_code)
101 if (
false == nrf_drv_clock_init_check())
103 err_code |= nrf_drv_clock_init();
106 nrf_drv_clock_lfclk_request (NULL);
110 m_on_trigger = handler;
120 nrf_drv_wdt_channel_feed (m_channel_id);
uint32_t rd_status_t
bitfield for representing errors
rd_status_t ruuvi_nrf5_sdk15_to_ruuvi_error(const ret_code_t error)
convert nrf5 sdk15 error code into Ruuvi error code.
#define RD_SUCCESS
Internal Error.
void ri_log(const ri_log_severity_t severity, const char *const message)
Queues messages into log.
Header to enable and disable module compilation.
Ruuvi error codes and error check function.
rd_status_t ri_watchdog_init(const uint32_t interval_ms, const wdt_evt_handler_t handler)
void(* wdt_evt_handler_t)(void)
Enable implementation selected by application.
rd_status_t ri_watchdog_feed(void)