nrfx_err_t nrfx_wdt_init(nrfx_wdt_config_t const * p_config, nrfx_wdt_event_handler_t wdt_event_handler) { NRFX_ASSERT(p_config); NRFX_ASSERT(wdt_event_handler != NULL); nrfx_err_t err_code; m_wdt_event_handler = wdt_event_handler; if (m_state == NRFX_DRV_STATE_UNINITIALIZED) { m_state = NRFX_DRV_STATE_INITIALIZED; } else { err_code = NRFX_ERROR_INVALID_STATE; NRFX_LOG_WARNING("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code)); return err_code; } nrf_wdt_behaviour_set(p_config->behaviour); nrf_wdt_reload_value_set((p_config->reload_value * 32768) / 1000); NRFX_IRQ_PRIORITY_SET(WDT_IRQn, p_config->interrupt_priority); NRFX_IRQ_ENABLE(WDT_IRQn); err_code = NRFX_SUCCESS; NRFX_LOG_INFO("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code)); return err_code; }
When the value of reload_value is too large, the calculation will exceed the maximum allowed by uint32_t。