Checkpoint
This commit is contained in:
160 files changed
+76293
-387
No files matched your search
+27
-1
@@ -1,12 +1,16 @@
|
||||
package hardware
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Input interface {
|
||||
Events() <-chan InputEvent
|
||||
}
|
||||
|
||||
type InputEvent interface {
|
||||
String() string
|
||||
}
|
||||
|
||||
type (
|
||||
@@ -19,10 +23,32 @@ type (
|
||||
RotaryPressEvent struct {
|
||||
Time time.Time
|
||||
Input Input
|
||||
Code int
|
||||
}
|
||||
|
||||
RotaryLongPressEvent struct {
|
||||
Time time.Time
|
||||
Input Input
|
||||
Code int
|
||||
}
|
||||
)
|
||||
|
||||
func (e RotaryEvent) String() string {
|
||||
return fmt.Sprintf("rotary event delta=%d", e.Delta)
|
||||
}
|
||||
|
||||
type RotaryHandler interface {
|
||||
Rotary(event RotaryEvent)
|
||||
}
|
||||
|
||||
func (e RotaryPressEvent) String() string {
|
||||
return "rotary press"
|
||||
}
|
||||
|
||||
type RotaryPressHandler interface {
|
||||
RotaryPress(event RotaryPressEvent)
|
||||
}
|
||||
|
||||
func (e RotaryLongPressEvent) String() string {
|
||||
return "rotary long press"
|
||||
}
|
||||
Reference in new issue
Block a user