WatchdogController Class
Package: GHIElectronics.Endpoint.Devices.Watchdog
Namespace: GHIElectronics.Endpoint.Devices.Watchdog
Endpoint's watchdog, with the same API as TinyCLR. After WatchdogController.Enable, WatchdogController.Reset must be called more often than the timeout, or the board restarts. The watchdog cannot be stopped once it runs. WatchdogController.Disable hands it to the system, which then keeps it fed. If the program ends or crashes without WatchdogController.Disable, the board restarts after the timeout, also when debugging stops.
class WatchdogController(IDisposable): ...
Properties
IsEnabled
IsEnabled: bool # @property
Whether this controller has enabled the watchdog (and not disabled it)
Returns bool
MaxTimeout
MaxTimeout: datetime.timedelta # @property
The longest timeout the hardware supports.
Returns TimeSpan
Methods
Disable()
def Disable(self) -> None:
Stops watching this program: the system keeps the watchdog fed from now on (the chip's watchdog itself cannot stop)
Dispose()
def Dispose(self) -> None:
Releases the controller. An enabled watchdog stays enabled: with nobody to reset it, the board restarts after the timeout. Call WatchdogController.Disable first to avoid that.
Enable(TimeSpan timeout)
def Enable(self, timeout: datetime.timedelta) -> None:
Starts the watchdog, or changes its timeout. The system counts whole seconds, so the timeout is rounded up to the next second.
| Parameter | Type | Description |
|---|---|---|
timeout | TimeSpan | More than 0 and at most WatchdogController.MaxTimeout |
FromName(string name)
@staticmethod
def FromName(name: str) -> WatchdogController:
The watchdog named name: EPM815.Watchdog.Id, EPN256.Watchdog.Id, or EPN128.Watchdog.Id.
Returns WatchdogController
GetDefault()
@staticmethod
def GetDefault() -> WatchdogController:
The board's watchdog
Returns WatchdogController
Reset()
def Reset(self) -> None:
Starts the timeout again. Call it more often than the timeout.