forked from TFK1410/go-rpi-rgb-led-matrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix_other.go
34 lines (28 loc) · 664 Bytes
/
matrix_other.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
//go:build !linux
// +build !linux
package rgbmatrix
import "C"
import "fmt"
type uint32_t uint32
// NewRGBLedMatrix returns a new matrix using the given size and config
func NewRGBLedMatrix(config *HardwareConfig) (c Matrix, err error) {
defer func() {
if r := recover(); r != nil {
var ok bool
err, ok = r.(error)
if !ok {
err = fmt.Errorf("error creating matrix: %v", r)
}
}
}()
if isJulienEmulator() {
return buildJulienMatrix(config), nil
}
if isMatrixEmulator() {
return buildMatrixEmulator(config), nil
}
if isTerminalMatrixEmulator() {
return buildTerminalMatrixEmulator(config), nil
}
panic("No emulator found")
}