Skip to content

Commit

Permalink
Update ./targets
Browse files Browse the repository at this point in the history
  • Loading branch information
sago35 committed Jan 30, 2024
1 parent 5c87b85 commit 2c00291
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion targets/macropad-rp2040/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func run() error {
return err
}
ws.WriteColors(wsLeds[:])
time.Sleep(10 * time.Millisecond)
time.Sleep(1 * time.Millisecond)
}

return nil
Expand Down
16 changes: 10 additions & 6 deletions targets/sg48key/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,22 @@ func run() error {
cont := true
x := NewADCDevice(ax, 0x2000, 0xDC00, true)
y := NewADCDevice(ay, 0x2400, 0xD400, true)
ticker := time.Tick(1 * time.Millisecond)
cnt := 0
for cont {
<-ticker
err := d.Tick()
if err != nil {
return err
}

xx := x.Get2()
yy := y.Get2()
//fmt.Printf("%04X %04X %4d %4d %4d %4d\n", x.RawValue, y.RawValue, xx, yy, x.Get(), y.Get())
m.Move(int(xx), int(yy))

time.Sleep(10 * time.Millisecond)
if cnt%10 == 0 {
xx := x.Get2()
yy := y.Get2()
//fmt.Printf("%04X %04X %4d %4d %4d %4d\n", x.RawValue, y.RawValue, xx, yy, x.Get(), y.Get())
m.Move(int(xx), int(yy))
}
cnt++
}

return nil
Expand Down
17 changes: 10 additions & 7 deletions targets/sgh60/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,22 @@ func run() error {
cont := true
x := NewADCDevice(ax, 0x3400, 0xD400, true)
y := NewADCDevice(ay, 0x3800, 0xE990, true)
ticker := time.Tick(1 * time.Millisecond)
cnt := 0
for cont {
<-ticker
err := d.Tick()
if err != nil {
return err
}

xx := x.Get2()
yy := y.Get2()

fmt.Printf("%04X %04X %4d %4d %4d %4d\n", x.RawValue, y.RawValue, xx, yy, x.Get(), y.Get())
m.Move(int(xx), int(yy))

time.Sleep(10 * time.Millisecond)
if cnt%10 == 0 {
xx := x.Get2()
yy := y.Get2()
//fmt.Printf("%04X %04X %4d %4d %4d %4d\n", x.RawValue, y.RawValue, xx, yy, x.Get(), y.Get())
m.Move(int(xx), int(yy))
}
cnt++
}

return nil
Expand Down
12 changes: 8 additions & 4 deletions targets/xiao-kb01/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,21 @@ func run() error {
}

cont := true
ticker := time.Tick(4 * time.Millisecond)
ticker := time.Tick(1 * time.Millisecond)
cnt := 0
for cont {
<-ticker
err := d.Tick()
if err != nil {
return err
}
if changed.Get() != 0 {
ws.WriteColors(wsLeds[:])
changed.Set(0)
if cnt%4 == 0 {
if changed.Get() != 0 {
ws.WriteColors(wsLeds[:])
changed.Set(0)
}
}
cnt++
}

return nil
Expand Down

0 comments on commit 2c00291

Please sign in to comment.