Browse Source

add wdg

master
zhaohe 1 year ago
parent
commit
2e93f83bd4
  1. 3
      include/znordic.h
  2. 19
      src/znordic.c

3
include/znordic.h

@ -44,6 +44,9 @@
*******************************************************************************/ *******************************************************************************/
typedef struct tm ztm_t; typedef struct tm ztm_t;
void wd_init();
void wd_feed();
void znordic_init(); void znordic_init();
void znordic_loop(); void znordic_loop();

19
src/znordic.c

@ -13,6 +13,23 @@
#include "nrf_log_ctrl.h" #include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h" #include "nrf_log_default_backends.h"
#include "nrfx_rtc.h" #include "nrfx_rtc.h"
/*********************************************************************
* INCLUDES
*/
#include "nrf_drv_wdt.h"
nrf_drv_wdt_channel_id m_channel_id;
void wd_init() {
// WDT_CONFIG_RELOAD_VALUE ,ms
nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
config.reload_value = WDT_CONFIG_RELOAD_VALUE;
ret_code_t err_code = nrf_drv_wdt_init(&config, NULL);
ZERROR_CHECK(err_code);
err_code = nrf_drv_wdt_channel_alloc(&m_channel_id);
ZERROR_CHECK(err_code);
nrf_drv_wdt_enable();
}
void wd_feed() { nrfx_wdt_feed(); }
/******************************************************************************* /*******************************************************************************
* RTC * * RTC *
@ -24,7 +41,7 @@ static void rtcCallbackFunc(nrf_drv_rtc_int_type_t interruptType)
* CODE * * CODE *
*******************************************************************************/ *******************************************************************************/
void znordic_init() { void znordic_init() {
{
{
/******************************************************************************* /*******************************************************************************
* ?? * * ?? *
*******************************************************************************/ *******************************************************************************/

Loading…
Cancel
Save