Skip to content

Commit

Permalink
Add option to select path to tty.ledmatrix.
Browse files Browse the repository at this point in the history
  • Loading branch information
theojulienne committed Feb 27, 2015
1 parent 706e1e6 commit 3f80c21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion util/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ import (
"time"

"github.com/ninjasphere/go-ninja/logger"
"github.com/ninjasphere/go-ninja/config"
"github.com/ninjasphere/goserial"
)

var log = logger.GetLogger("led-matrix")

var ledPath = config.String("/dev/tty.ledmatrix", "led.tty")

// Attempts this first, then falls back to half.
const baudRate = 230400

Expand All @@ -36,7 +39,7 @@ func GetLEDConnectionAtRate(baudRate int) (io.ReadWriteCloser, error) {

log.Infof("Connecting to LED using baud rate: %d", baudRate)

c := &serial.Config{Name: "/dev/tty.ledmatrix", Baud: baudRate}
c := &serial.Config{Name: ledPath, Baud: baudRate}
s, err := serial.OpenPort(c)
if err != nil {
return nil, err
Expand Down

0 comments on commit 3f80c21

Please sign in to comment.