WDT HAL

group nrf_wdt_hal

Hardware access layer for managing the Watchdog Timer (WDT) peripheral.

Defines

NRF_WDT_CHANNEL_NUMBER

Number of WDT channels.

NRF_WDT_RR_VALUE

WDT register reload value.

Enums

enum nrf_wdt_task_t

WDT tasks.

Values:

enumerator NRF_WDT_TASK_START

Task for starting WDT.

enum nrf_wdt_event_t

WDT events.

Values:

enumerator NRF_WDT_EVENT_TIMEOUT

Event from WDT time-out.

enum nrf_wdt_behaviour_t

WDT behavior in the SLEEP or HALT CPU modes.

Values:

enumerator NRF_WDT_BEHAVIOUR_RUN_SLEEP

WDT will run when CPU is in SLEEP mode.

enumerator NRF_WDT_BEHAVIOUR_RUN_HALT

WDT will run when CPU is in HALT mode.

enumerator NRF_WDT_BEHAVIOUR_RUN_SLEEP_HALT

WDT will run when CPU is in SLEEP or HALT mode.

enumerator NRF_WDT_BEHAVIOUR_PAUSE_SLEEP_HALT

WDT will be paused when CPU is in SLEEP or HALT mode.

enum nrf_wdt_rr_register_t

WDT reload request registers.

Values:

enumerator NRF_WDT_RR0

Reload request register 0.

enumerator NRF_WDT_RR1

Reload request register 1.

enumerator NRF_WDT_RR2

Reload request register 2.

enumerator NRF_WDT_RR3

Reload request register 3.

enumerator NRF_WDT_RR4

Reload request register 4.

enumerator NRF_WDT_RR5

Reload request register 5.

enumerator NRF_WDT_RR6

Reload request register 6.

enumerator NRF_WDT_RR7

Reload request register 7.

enum nrf_wdt_int_mask_t

WDT interrupts.

Values:

enumerator NRF_WDT_INT_TIMEOUT_MASK

WDT interrupt from time-out event.

Functions

NRF_STATIC_INLINE void nrf_wdt_behaviour_set(NRF_WDT_Type *p_reg, nrf_wdt_behaviour_t behaviour)

Function for configuring the watchdog behavior when the CPU is sleeping or halted.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • behaviour[in] Watchdog behavior when CPU is in SLEEP or HALT mode.

NRF_STATIC_INLINE void nrf_wdt_task_trigger(NRF_WDT_Type *p_reg, nrf_wdt_task_t task)

Function for starting the WDT task.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task.

NRF_STATIC_INLINE void nrf_wdt_event_clear(NRF_WDT_Type *p_reg, nrf_wdt_event_t event)

Function for clearing the WDT event register.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event.

NRF_STATIC_INLINE bool nrf_wdt_event_check(NRF_WDT_Type const *p_reg, nrf_wdt_event_t event)

Function for retrieving the state of the WDT event.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to be checked.

Return values
  • true – The event has been generated.

  • false – The event has not been generated.

NRF_STATIC_INLINE void nrf_wdt_int_enable(NRF_WDT_Type *p_reg, uint32_t mask)

Function for enabling the specified interrupt.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be enabled.

NRF_STATIC_INLINE uint32_t nrf_wdt_int_enable_check(NRF_WDT_Type const *p_reg, uint32_t mask)

Function for checking if the specified interrupts are enabled.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be checked.

Returns

Mask of enabled interrupts.

NRF_STATIC_INLINE void nrf_wdt_int_disable(NRF_WDT_Type *p_reg, uint32_t mask)

Function for disabling a specific interrupt.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be disabled.

NRF_STATIC_INLINE void nrf_wdt_subscribe_set(NRF_WDT_Type *p_reg, nrf_wdt_task_t task, uint8_t channel)

Function for setting the subscribe configuration for a given WDT task.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to set the configuration.

  • channel[in] Channel through which to subscribe events.

NRF_STATIC_INLINE void nrf_wdt_subscribe_clear(NRF_WDT_Type *p_reg, nrf_wdt_task_t task)

Function for clearing the subscribe configuration for a given WDT task.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to clear the configuration.

NRF_STATIC_INLINE void nrf_wdt_publish_set(NRF_WDT_Type *p_reg, nrf_wdt_event_t event, uint8_t channel)

Function for setting the publish configuration for a given WDT event.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to set the configuration.

  • channel[in] Channel through which to publish the event.

NRF_STATIC_INLINE void nrf_wdt_publish_clear(NRF_WDT_Type *p_reg, nrf_wdt_event_t event)

Function for clearing the publish configuration for a given WDT event.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to clear the configuration.

NRF_STATIC_INLINE uint32_t nrf_wdt_task_address_get(NRF_WDT_Type const *p_reg, nrf_wdt_task_t task)

Function for returning the address of a specific WDT task register.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task.

Returns

Address of requested task register

NRF_STATIC_INLINE uint32_t nrf_wdt_event_address_get(NRF_WDT_Type const *p_reg, nrf_wdt_event_t event)

Function for returning the address of a specific WDT event register.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event.

Returns

Address of requested event register

NRF_STATIC_INLINE bool nrf_wdt_started(NRF_WDT_Type const *p_reg)

Function for retrieving the watchdog status.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Return values
  • true – The watchdog is started.

  • false – The watchdog is not started.

NRF_STATIC_INLINE bool nrf_wdt_request_status(NRF_WDT_Type const *p_reg, nrf_wdt_rr_register_t rr_register)

Function for retrieving the watchdog reload request status.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • rr_register[in] Reload request register to be checked.

Return values
  • true – Reload request is running.

  • false – No reload requests are running.

NRF_STATIC_INLINE void nrf_wdt_reload_value_set(NRF_WDT_Type *p_reg, uint32_t reload_value)

Function for setting the watchdog reload value.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • reload_value[in] Watchdog counter initial value.

NRF_STATIC_INLINE uint32_t nrf_wdt_reload_value_get(NRF_WDT_Type const *p_reg)

Function for retrieving the watchdog reload value.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns

Reload value.

NRF_STATIC_INLINE void nrf_wdt_reload_request_enable(NRF_WDT_Type *p_reg, nrf_wdt_rr_register_t rr_register)

Function for enabling a specific reload request register.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • rr_register[in] Reload request register to be enabled.

NRF_STATIC_INLINE void nrf_wdt_reload_request_disable(NRF_WDT_Type *p_reg, nrf_wdt_rr_register_t rr_register)

Function for disabling a specific reload request register.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • rr_register[in] Reload request register to be disabled.

NRF_STATIC_INLINE bool nrf_wdt_reload_request_is_enabled(NRF_WDT_Type const *p_reg, nrf_wdt_rr_register_t rr_register)

Function for retrieving the status of a specific reload request register.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • rr_register[in] Reload request register to be checked.

Return values
  • true – The reload request register is enabled.

  • false – The reload request register is not enabled.

NRF_STATIC_INLINE void nrf_wdt_reload_request_set(NRF_WDT_Type *p_reg, nrf_wdt_rr_register_t rr_register)

Function for setting a specific reload request register.

Parameters
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • rr_register[in] Reload request register to set.