-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunicorn__darwin.go
More file actions
36 lines (29 loc) · 847 Bytes
/
unicorn__darwin.go
File metadata and controls
36 lines (29 loc) · 847 Bytes
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
package main
import "fmt"
// Unicorn contains the width and height of the Unicorn pHAT
type Unicorn struct {
Width int
Height int
}
// Init initializes the pHAT for writing to.
func (u *Unicorn) Init() error {
fmt.Println("OS X")
return nil
}
// SetPixel sets the color of the specified pixel in the display buffer.
func (u *Unicorn) SetPixel(x, y int, red, green, blue uint8) {
fmt.Printf("SetPixel(X:%d, Y:%d, R:%d, G:%d, B:%d)\n", x, y, red, green, blue)
}
// Show writes out the contents of the display buffer to the pHAT.
func (u *Unicorn) Show() error {
fmt.Println("Show")
return nil
}
// Clear turns off all the pixels on the pHAT and erases the display buffer.
func (u *Unicorn) Clear() {
fmt.Println("Clear")
}
// CleanUp clears the display and cleans up the GPIO.
func (u *Unicorn) CleanUp() {
fmt.Println("CleanUp")
}