Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:28:51 +01:00
1 parent 7b6db17870
commit 0295eb1ad2
125 files changed
+59376

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
package main
import (
"fmt"
"sync"
"git.maze.io/go/bragi/hardware/input"
"github.com/sirupsen/logrus"
)
func main() {
logrus.SetLevel(logrus.TraceLevel)
sources, err := input.Detect()
if err != nil {
panic(err)
}
var wait sync.WaitGroup
for _, s := range sources {
wait.Add(1)
go test(s, &wait)
}
wait.Wait()
}
func test(s input.Source, wait *sync.WaitGroup) {
defer wait.Done()
events, err := s.Events()
if err != nil {
panic(err)
}
for e := range events {
fmt.Println(e)
switch e.Type {
case input.RotaryClockwise:
println("clockwise")
case input.RotaryCounterClockwise:
println("counter clockwise")
}
}
}