WatchdogController Class
Namespace: GHIElectronics.TinyCLR.Devices.Watchdog · Assembly: GHIElectronics.TinyCLR.Devices.Watchdog
Independent watchdog timer. Enable(uint) with a timeout and call Reset periodically — if the timer ever expires without being reset, the chip reboots. Useful as a failsafe against firmware lockups.
public class WatchdogController : IDisposable
Properties
Provider
public IWatchdogControllerProvider Provider { get; }
The low-level provider backing this controller.
GetMaxTimeout
public uint GetMaxTimeout { get; }
Largest legal value (in milliseconds) for the Enable(uint) timeout argument.
IsEnabled
public bool IsEnabled { get; }
True once Enable(uint) has been called.
Methods
GetDefault()
public static WatchdogController GetDefault()
Returns the default watchdog for this device.
Returns WatchdogController
FromName(string name)
public static WatchdogController FromName(string name)
Returns a watchdog identified by its native API name.
| Parameter | Type | Description |
|---|---|---|
name | string |
Returns WatchdogController
FromProvider(IWatchdogControllerProvider provider)
public static WatchdogController FromProvider(IWatchdogControllerProvider provider)
Creates a controller from a custom IWatchdogControllerProvider.
| Parameter | Type | Description |
|---|---|---|
provider | IWatchdogControllerProvider |
Returns WatchdogController
Dispose()
public void Dispose()
Releases the underlying provider.
Enable(uint timeout)
public void Enable(uint timeout)
Starts the watchdog. From this point on, Reset must be called more often than timeout or the device will reboot. On many chips the watchdog cannot be disabled once enabled.
| Parameter | Type | Description |
|---|---|---|
timeout | uint | Timeout in milliseconds (must be > 0 and ≤ GetMaxTimeout). |
Disable()
public void Disable()
Disables the watchdog (only supported on hardware that allows it).
Reset()
public void Reset()
Re-arms the watchdog. Must be called before the timeout elapses.