File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -2,23 +2,30 @@ 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+ if buttonPin .Get () {
25+ println ("yes" )
26+ } else {
27+ println ("no" )
28+ }
29+ sleep (1 )
30+ }
2431}
You can’t perform that action at this time.
0 commit comments