MySensors Library & Examples  2.3.2-62-ge298769
Macros
<avr/wdt.h>: Watchdog timer handling
+ Collaboration diagram for <avr/wdt.h>: Watchdog timer handling:

Detailed Description

#include <avr/wdt.h>

This header file declares the interface to some inline macros handling the watchdog timer like present in many AVR devices. In order to prevent the watchdog timer configuration from being accidentally altered by a crashing application, a special timed sequence is required in order to change it. The macros within this header file handle the required sequence automatically before changing any value. Interrupts will be disabled during the manipulation.

Macros

#define wdt_reset()   NRF_WDT->RR[0] = WDT_RR_RR_Reload
 
#define wdt_enable(timeout)
 
#define wdt_disable()
 
#define WDTO_15MS   15
 
#define WDTO_30MS   30
 
#define WDTO_60MS   60
 
#define WDTO_120MS   120
 
#define WDTO_250MS   250
 
#define WDTO_500MS   500
 
#define WDTO_1S   1000
 
#define WDTO_2S   2000
 
#define WDTO_4S   4000
 
#define WDTO_8S   8000
 

Macro Definition Documentation

◆ wdt_disable

#define wdt_disable ( )
Value:
NRF_WDT->CONFIG = NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Pause << WDT_CONFIG_SLEEP_Pos); \
NRF_WDT->CRV = 4294967295

Disable the watchdog timer. On nRF5 the timer cannot disabled. The period is set to 36h of CPU run time. The WDT is stopped in sleep mode.

Definition at line 89 of file wdt.h.

◆ wdt_enable

#define wdt_enable (   timeout)
Value:
NRF_WDT->CONFIG = NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos); \
NRF_WDT->CRV = (32768*timeout)/1000; \
NRF_WDT->RREN |= WDT_RREN_RR0_Msk; \
NRF_WDT->TASKS_START = 1

Enable the watchdog timer, configuring it for expiry after timeout (ms).

The WDT is running in sleep mode.

See also the symbolic constants WDTO_15MS et al.

Definition at line 78 of file wdt.h.

◆ wdt_reset

#define wdt_reset ( )    NRF_WDT->RR[0] = WDT_RR_RR_Reload

Reset the watchdog timer. When the watchdog timer is enabled, a call to this instruction is required before the timer expires, otherwise a watchdog-initiated device reset will occur.

Definition at line 67 of file wdt.h.

◆ WDTO_120MS

#define WDTO_120MS   120

See WDTO_15MS

Definition at line 120 of file wdt.h.

◆ WDTO_15MS

#define WDTO_15MS   15

Symbolic constants for the watchdog timeout.

Possible timeout values are: 15 ms, 30 ms, 60 ms, 120 ms, 250 ms, 500 ms, 1 s, 2 s, 4s, 8s. (Not all devices allow 4 s or 8 s.) Symbolic constants are formed by the prefix WDTO_, followed by the time.

Example that would select a watchdog timer expiry of approximately 500 ms:

Definition at line 108 of file wdt.h.

◆ WDTO_1S

#define WDTO_1S   1000

See WDTO_15MS

Definition at line 132 of file wdt.h.

◆ WDTO_250MS

#define WDTO_250MS   250

See WDTO_15MS

Definition at line 124 of file wdt.h.

◆ WDTO_2S

#define WDTO_2S   2000

See WDTO_15MS

Definition at line 136 of file wdt.h.

◆ WDTO_30MS

#define WDTO_30MS   30

See WDTO_15MS

Definition at line 112 of file wdt.h.

◆ WDTO_4S

#define WDTO_4S   4000

See WDTO_15MS Note: This is only available on the ATtiny2313, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861, ATmega48, ATmega88, ATmega168, ATmega48P, ATmega88P, ATmega168P, ATmega328P, ATmega164P, ATmega324P, ATmega644P, ATmega644, ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega8HVA, ATmega16HVA, ATmega32HVB, ATmega406, ATmega1284P, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, AT90PWM161, AT90USB82, AT90USB162, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATtiny48, ATtiny88, nRF51822, nRF52832

Definition at line 158 of file wdt.h.

◆ WDTO_500MS

#define WDTO_500MS   500

See WDTO_15MS

Definition at line 128 of file wdt.h.

◆ WDTO_60MS

#define WDTO_60MS   60

See WDTO_15MS

Definition at line 116 of file wdt.h.

◆ WDTO_8S

#define WDTO_8S   8000

See WDTO_15MS Note: This is only available on the ATtiny2313, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861, ATmega48, ATmega48A, ATmega48PA, ATmega88, ATmega168, ATmega48P, ATmega88P, ATmega168P, ATmega328P, ATmega164P, ATmega324P, ATmega644P, ATmega644, ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega8HVA, ATmega16HVA, ATmega32HVB, ATmega406, ATmega1284P, ATmega2564RFR2, ATmega256RFR2, ATmega1284RFR2, ATmega128RFR2, ATmega644RFR2, ATmega64RFR2 AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, AT90PWM161, AT90USB82, AT90USB162, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATtiny48, ATtiny88, ATxmega16a4u, ATxmega32a4u, ATxmega16c4, ATxmega32c4, ATxmega128c3, ATxmega192c3, ATxmega256c3, nRF51822, nRF52832

Definition at line 184 of file wdt.h.

WDTO_500MS
#define WDTO_500MS
Definition: wdt.h:128
wdt_enable
#define wdt_enable(timeout)
Definition: wdt.h:78