std1.0.0-beta-7 SafeC docs

std :: hal::watchdog

Struct std::Watchdog

#include <std/hal/watchdog.h> source

generic<C: WatchdogChip> struct Watchdog {
    &volatile unsigned int base;
    unsigned int timeout;
    C chip;
}

Fields

§&volatile unsigned int basesource

MMIO base address

§unsigned int timeoutsource

timeout period (chip-specific units, see above)

§C chipsource

Methods

§static struct Watchdog<C> new(&volatile unsigned int base, unsigned int timeout)source · definition

Initialize the watchdog at base with the given timeout; the chip type comes from the target.

§void enable()source · definition

Enable the watchdog timer (cannot be disabled on most hardware).

§void feed()source · definition

Feed (kick) the watchdog to prevent reset.

§int caused_reset() constsource · definition

Check if a watchdog reset occurred. Returns 1 if the previous reset was a WDT reset.