If someone can come up with an elegant way to support button hold events (similar to the Python lib's "repeat" concept), it might be nice to build that in. It can be approximated by doing something like:
pressA := shim.ButtonPressChan(buttonshim.ButtonA)
releaseA := shim.ButtonReleaseChan(buttonshim.ButtonA)
go func() {
for {
select {
case <-pressA:
println("Pressed!")
for {
select {
case <-time.After(time.Second):
println("Held!")
case <-releaseA:
println("Released!")
break
}
}
}
}
}()
... But that's quite verbose, and wanting to respond to a hold may be commonplace.
If someone can come up with an elegant way to support button hold events (similar to the Python lib's "repeat" concept), it might be nice to build that in. It can be approximated by doing something like:
... But that's quite verbose, and wanting to respond to a hold may be commonplace.