Watchdog timer control facilities. See also auto_watchdog.h.
watchdog.h | Watchdog timer control facilities. |
Macros | |
WATCHDOG_DISABLE_ON_MCU_RESET | Defines a watchdog-disabling routine that is executed automatically at MCU reset. |
WATCHDOG_DISABLE_ON_MCU_RESET_SAVE_FLAGS | Defines a watchdog-disabling routine that is executed automatically at MCU reset. |
Variables | |
watchdog_saved_mcu_reset_flags | When the watchdog is disabled via WATCHDOG_DISABLE_ON_MCU_RESET_SAVE_FLAGS, the contents of the MCUSR register are stored here before the register is cleared. |
Functions | |
watchdog_reset_mcu | Uses the watchdog timer to trigger a reset of the MCU. |
Defines a watchdog-disabling routine that is executed automatically at MCU reset. The routine is executed before main is called. The routine clears the MCUSR register to ensure that no reset flag that implicitly enables the watchdog timer remains set. After MCUSR has been cleared, the routine disables the watchdog timer and then firmware initialization continues. Function definition macro.
NOTE: This macro can be implicitly expanded in a code file by including the header auto_watchdog.h (with both WATCHDOG_AUTODISABLE_SAVE_FLAGS and WATCHDOG_DO_NOT_AUTODISABLE undefined).
Defines a watchdog-disabling routine that is executed automatically at MCU reset. The routine is executed before main is called. The routine first saves the contents of the MCUSR register in watchdog_saved_mcu_reset_flags, then clears the register to ensure that no reset flag that implicitly enables the watchdog timer remains set. After MCUSR has been cleared, the routine disables the watchdog timer and then firmware initialization continues. Function definition macro.
NOTE: This macro can be implicitly expanded in a code file by defining the macro WATCHDOG_AUTODISABLE_SAVE_FLAGS and then including the header auto_watchdog.h.
extern uint8_t watchdog_saved_mcu_reset_flags __attribute__ ( (address (RAMEND)) )
When the watchdog is disabled via WATCHDOG_DISABLE_ON_MCU_RESET_SAVE_FLAGS, the contents of the MCUSR register are stored here before the register is cleared.
void watchdog_reset_mcu( void ) __attribute__ ((noreturn))
Uses the watchdog timer to trigger a reset of the MCU. There is a delay of about 16 milliseconds before the reset happens, the function will disable interrupts and then busy-loop to wait out this delay.
CAUTION: The watchdog timer remains enabled after the MCU reset. To prevent repeated resets, the watchdog timer MUST be disabled (or reset or reconfigured) as soon as possible when the firmware is restarted after a call to this function (e.g. via WATCHDOG_DISABLE_ON_MCU_RESET).
When the watchdog is disabled via WATCHDOG_DISABLE_ON_MCU_RESET_SAVE_FLAGS, the contents of the MCUSR register are stored here before the register is cleared.
extern uint8_t watchdog_saved_mcu_reset_flags __attribute__ ( (address (RAMEND)) )
Uses the watchdog timer to trigger a reset of the MCU.
void watchdog_reset_mcu( void ) __attribute__ ((noreturn))