aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/machine/watchdog.go
blob: d1516350d7fb5724d7e3a2a622861691395deef1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//go:build nrf52840 || nrf52833 || rp2040 || atsamd51 || atsame5x || stm32

package machine

// WatchdogConfig holds configuration for the watchdog timer.
type WatchdogConfig struct {
	// The timeout (in milliseconds) before the watchdog fires.
	//
	// If the requested timeout exceeds `MaxTimeout` it will be rounded
	// down.
	TimeoutMillis uint32
}

// watchdog must be implemented by any platform supporting watchdog functionality
type watchdog interface {
	// Configure the watchdog.
	//
	// This method should not be called after the watchdog is started and on
	// some platforms attempting to reconfigure after starting the watchdog
	// is explicitly forbidden / will not work.
	Configure(config WatchdogConfig) error

	// Starts the watchdog.
	Start() error

	// Update the watchdog, indicating that the app is healthy.
	Update()
}

// Ensure required public symbols var exists and meets interface spec
var _ = watchdog(Watchdog)

// Ensure required public constants exist
const _ = WatchdogMaxTimeout