File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -2,23 +2,26 @@ package main
22
33import (
44 "unsafe"
5+ _ "unsafe"
6+
7+ "github.com/goplus/lib/emb/machine"
58)
69
710//go:linkname StoreUint32 llgo.atomicStore
811func StoreUint32 (addr * uint32 , val uint32 )
912
1013//go:linkname sleep sleep
11- func sleep (tm int )
14+ func sleep (n int )
1215
1316func main () {
1417 StoreUint32 ((* uint32 )(unsafe .Pointer (uintptr (0x3ff480A4 ))), 0x50D83AA1 )
1518 StoreUint32 ((* uint32 )(unsafe .Pointer (uintptr (0x3ff4808C ))), 0 )
1619 StoreUint32 ((* uint32 )(unsafe .Pointer (uintptr (0x3ff5f048 ))), 0 )
1720 buttonPin := machine .GPIO34
1821 buttonPin .Configure (machine.PinConfig {Mode : machine .PinInput })
19- println ( buttonPin . Get ())
20- sleep ( 2 )
21- println (buttonPin .Get ())
22- println ( buttonState )
23- // time.Sleep(200 * time.Millisecond)
22+
23+ for i := 0 ; i < 10 ; i ++ {
24+ println (buttonPin .Get ())
25+ sleep ( 1 )
26+ }
2427}
You can’t perform that action at this time.
0 commit comments