nrfx 2.5
Modules | Data Structures | Macros | Typedefs | Functions
WDT driver

Watchdog Timer (WDT) peripheral driver. More...

Modules

 WDT peripheral driver configuration
 

Data Structures

struct  nrfx_wdt_t
 Data structure of the Watchdog (WDT) driver instance. More...
 
struct  nrfx_wdt_config_t
 Struct for WDT initialization. More...
 

Macros

#define NRFX_WDT_IRQ_CONFIG   .interrupt_priority = NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY
 WDT instance interrupt priority configuration.
 
#define NRFX_WDT_INSTANCE(id)
 Macro for creating an instance of the WDT driver. More...
 
#define NRFX_WDT_DEFAULT_CONFIG
 WDT driver default configuration. More...
 

Typedefs

typedef void(* nrfx_wdt_event_handler_t) (void)
 WDT event handler function type.
 
typedef nrf_wdt_rr_register_t nrfx_wdt_channel_id
 WDT channel ID type.
 

Functions

nrfx_err_t nrfx_wdt_init (nrfx_wdt_t const *p_instance, nrfx_wdt_config_t const *p_config, nrfx_wdt_event_handler_t wdt_event_handler)
 Function for initializing the WDT driver instance. More...
 
nrfx_err_t nrfx_wdt_channel_alloc (nrfx_wdt_t const *p_instance, nrfx_wdt_channel_id *p_channel_id)
 Function for allocating a watchdog channel. More...
 
void nrfx_wdt_enable (nrfx_wdt_t const *p_instance)
 Function for starting the watchdog. More...
 
void nrfx_wdt_feed (nrfx_wdt_t const *p_instance)
 Function for feeding the watchdog. More...
 
void nrfx_wdt_channel_feed (nrfx_wdt_t const *p_instance, nrfx_wdt_channel_id channel_id)
 Function for feeding an invidual watchdog channel. More...
 
NRFX_STATIC_INLINE uint32_t nrfx_wdt_task_address_get (nrfx_wdt_t const *p_instance, nrf_wdt_task_t task)
 Function for returning a requested task address for the WDT driver module. More...
 
NRFX_STATIC_INLINE uint32_t nrfx_wdt_event_address_get (nrfx_wdt_t const *p_instance, nrf_wdt_event_t event)
 Function for returning a requested event address for the WDT driver module. More...
 

Detailed Description

Watchdog Timer (WDT) peripheral driver.

Macro Definition Documentation

◆ NRFX_WDT_DEFAULT_CONFIG

#define NRFX_WDT_DEFAULT_CONFIG
Value:
{ \
.reload_value = 2000, \
NRFX_WDT_IRQ_CONFIG \
}
Definition: nrf_wdt.h:45

WDT driver default configuration.

This configuration sets up WDT with the following options:

  • run when CPU is in SLEEP mode, pause when in HALT mode
  • reload value: 2000 ms

◆ NRFX_WDT_INSTANCE

#define NRFX_WDT_INSTANCE (   id)
Value:
{ \
.p_reg = NRF_WDT##id, \
.drv_inst_idx = NRFX_CONCAT_3(NRFX_WDT, id, _INST_IDX), \
}
#define NRFX_CONCAT_3(p1, p2, p3)
Macro for concatenating three tokens in macro expansion.
Definition: nrfx_common.h:88

Macro for creating an instance of the WDT driver.

Function Documentation

◆ nrfx_wdt_channel_alloc()

nrfx_err_t nrfx_wdt_channel_alloc ( nrfx_wdt_t const *  p_instance,
nrfx_wdt_channel_id p_channel_id 
)

Function for allocating a watchdog channel.

Note
This function can not be called after nrfx_wdt_start().
Parameters
[in]p_instancePointer to the driver instance structure.
[out]p_channel_idID of granted channel.
Return values
NRFX_SUCCESSThe channel was successfully allocated.
NRFX_ERROR_NO_MEMThere is no available channel to be used.

◆ nrfx_wdt_channel_feed()

void nrfx_wdt_channel_feed ( nrfx_wdt_t const *  p_instance,
nrfx_wdt_channel_id  channel_id 
)

Function for feeding an invidual watchdog channel.

Parameters
[in]p_instancePointer to the driver instance structure.
[in]channel_idID of watchdog channel.

◆ nrfx_wdt_enable()

void nrfx_wdt_enable ( nrfx_wdt_t const *  p_instance)

Function for starting the watchdog.

Note
After calling this function the watchdog is started, so the user needs to feed all allocated watchdog channels to avoid reset. At least one watchdog channel must be allocated.
Parameters
[in]p_instancePointer to the driver instance structure.

◆ nrfx_wdt_event_address_get()

NRFX_STATIC_INLINE uint32_t nrfx_wdt_event_address_get ( nrfx_wdt_t const *  p_instance,
nrf_wdt_event_t  event 
)

Function for returning a requested event address for the WDT driver module.

Parameters
[in]p_instancePointer to the driver instance structure.
[in]eventOne of the WDT events.
Returns
Event address.

◆ nrfx_wdt_feed()

void nrfx_wdt_feed ( nrfx_wdt_t const *  p_instance)

Function for feeding the watchdog.

Function feeds all allocated watchdog channels.

Parameters
[in]p_instancePointer to the driver instance structure.

◆ nrfx_wdt_init()

nrfx_err_t nrfx_wdt_init ( nrfx_wdt_t const *  p_instance,
nrfx_wdt_config_t const *  p_config,
nrfx_wdt_event_handler_t  wdt_event_handler 
)

Function for initializing the WDT driver instance.

Parameters
[in]p_instancePointer to the driver instance structure.
[in]p_configPointer to the structure with the initial configuration.
[in]wdt_event_handlerEvent handler provided by the user. Ignored when NRFX_WDT_CONFIG_NO_IRQ option is enabled.
Return values
NRFX_SUCCESSInitialization was successful.
NRFX_ERROR_INVALID_STATEThe driver was already initialized.

◆ nrfx_wdt_task_address_get()

NRFX_STATIC_INLINE uint32_t nrfx_wdt_task_address_get ( nrfx_wdt_t const *  p_instance,
nrf_wdt_task_t  task 
)

Function for returning a requested task address for the WDT driver module.

Parameters
[in]p_instancePointer to the driver instance structure.
[in]taskOne of the WDT tasks.
Returns
Task address.

Documentation feedback | Developer Zone | Subscribe | Updated