-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
101 lines (87 loc) · 2.04 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package gotogen
import (
"tinygo.org/x/drivers"
)
type Display interface {
drivers.Displayer
// CanUpdateNow indicates that the device is able to take a new frame right now. This is useful if the device is
// driven by a DMA transfer, and the previous transfer has not yet completed. Displays should still support Display
// being called before they are ready to update; in this case, they should block until the next update is possible.
CanUpdateNow() bool
}
type MenuButton uint8
const (
MenuButtonNone MenuButton = iota
MenuButtonMenu
MenuButtonBack
MenuButtonUp
MenuButtonDown
// MenuButtonDefault is for resetting a specific setting to its default value. Drivers may wish to require this
// button to be held down for a second before triggering it, or perhaps make it be a chord of up and down.
MenuButtonDefault
)
func (b MenuButton) String() string {
switch b {
case MenuButtonNone:
return "none"
case MenuButtonMenu:
return "menu"
case MenuButtonBack:
return "back"
case MenuButtonUp:
return "up"
case MenuButtonDown:
return "down"
case MenuButtonDefault:
return "default"
default:
return "INVALID"
}
}
// statusState indicates what mode the status screen is in.
type statusState uint8
const (
statusStateBoot statusState = iota
statusStateIdle
statusStateMenu
statusStateBlank
)
func (s statusState) String() string {
switch s {
case statusStateBoot:
return "boot"
case statusStateIdle:
return "idle"
case statusStateMenu:
return "menu"
case statusStateBlank:
return "blank"
default:
return "INVALID"
}
}
type faceState uint8
const (
faceStateBusy faceState = iota
faceStateDefault
faceStateAnimation // TODO maybe each animation type is defined here to make it easier?
)
func (s faceState) String() string {
switch s {
case faceStateBusy:
return "busy"
case faceStateDefault:
return "default"
case faceStateAnimation:
return "animation"
default:
return "INVALID"
}
}
type colorChannel uint8
const (
colorChannelNone colorChannel = iota
colorChannelRed
colorChannelGreen
colorChannelBlue
)