mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 03:03:27 +00:00
feat(machine/stm32): add STM32H7 and NUCLEO-H753ZI support
This commit is contained in:
committed by
Ron Evans
parent
40ed956d6c
commit
3797e89600
@@ -0,0 +1,11 @@
|
||||
//go:build stm32h7
|
||||
|
||||
package main
|
||||
|
||||
import "machine"
|
||||
|
||||
var (
|
||||
pwm = &machine.TIM1
|
||||
pinA = machine.PA8
|
||||
pinB = machine.PA9
|
||||
)
|
||||
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"machine"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
println("configuring window watchdog")
|
||||
config := machine.WindowWatchdogConfig{
|
||||
TimeoutMicros: 100000, // 100ms
|
||||
WindowPercent: 50, // 50ms to 100ms refresh window
|
||||
}
|
||||
|
||||
machine.WindowWatchdog.Configure(config)
|
||||
machine.WindowWatchdog.Start()
|
||||
|
||||
println("updating wwdg for 1 second")
|
||||
for i := 0; i < 10; i++ {
|
||||
time.Sleep(75 * time.Millisecond) // middle of the window
|
||||
machine.WindowWatchdog.Update()
|
||||
println("alive")
|
||||
}
|
||||
|
||||
println("entering tight loop (will reset)")
|
||||
for {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user