aboutsummaryrefslogtreecommitdiff
path: root/redbutton.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-10-13 00:33:30 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-10-13 00:33:30 +0200
commit66996dc337ce7f8a20814da28f39b6e6dc435be0 (patch)
tree1c86d8e9c5afa976faf6e7c7333003c1f249aa66 /redbutton.go
parent4956d12bc59a9f5d95ac6d5daab5070f92e7c5ad (diff)
stringer
Diffstat (limited to 'redbutton.go')
-rw-r--r--redbutton.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/redbutton.go b/redbutton.go
index 15b1a4e..7de6e72 100644
--- a/redbutton.go
+++ b/redbutton.go
@@ -1,5 +1,7 @@
package redbutton
+//go:generate stringer -type=Button
+
import (
"time"
@@ -20,17 +22,6 @@ const (
Armed
)
-var state = map[Button]string{
- Unknown: "Unknown",
- Closed: "Closed",
- Pressed: "Pressed",
- Armed: "Armed",
-}
-
-func (b Button) String() string {
- return state[b]
-}
-
func State(dev *hid.Device) (Button, bool) {
buf := make([]byte, 8)
buf[0] = 0x01