Skip to content

Commit 36896f2

Browse files
committed
visor and backpack: add Off() synonym for API consistency
Signed-off-by: Ron Evans <[email protected]>
1 parent 591862b commit 36896f2

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

backpack.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ func (b *BackpackDevice) Show() {
3131
b.WriteColors(b.LED)
3232
}
3333

34+
// Off turns off all the LEDs.
35+
func (b *BackpackDevice) Off() {
36+
b.Clear()
37+
}
38+
3439
// Clear clears the Backpack LEDs.
3540
func (b *BackpackDevice) Clear() {
3641
b.SetColor(color.RGBA{R: 0x00, G: 0x00, B: 0x00})

examples/blink-all/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ func main() {
2121
time.Sleep(500 * time.Millisecond)
2222

2323
antenna.Off()
24-
visor.Clear()
25-
backpack.Clear()
24+
visor.Off()
25+
backpack.Off()
2626
time.Sleep(500 * time.Millisecond)
2727
}
2828
}

visor.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ func (v *VisorDevice) Show() {
3333
v.WriteColors(v.LED)
3434
}
3535

36+
// Off turns off all the LEDs.
37+
func (v *VisorDevice) Off() {
38+
v.Clear()
39+
}
40+
3641
// Clear clears the visor.
3742
func (v *VisorDevice) Clear() {
3843
for i := range v.LED {

0 commit comments

Comments
 (0)