Skip to content

Commit

Permalink
Merge "Add convenience functions for the muxPi"
Browse files Browse the repository at this point in the history
  • Loading branch information
amalinowsk2 authored and Gerrit Code Review committed Dec 5, 2017
2 parents 79e10de + 0094f78 commit 00e82f9
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions stm/stm.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ type STM struct {
mux *sync.Mutex
}

var muxPi *STM

func init() {
muxPi = NewSTM("/dev/ttyS2", 115200)
}

// NewSTM prepares STM structure with serial configuration.
func NewSTM(ttyPath string, baudrate int) *STM {
return &STM{
Expand Down Expand Up @@ -190,3 +196,43 @@ func (stm *STM) DUT() error {
func (stm *STM) TS() error {
return stm.executeCommand("ts")
}

// Open is a convenience function for default MuxPi settings.
func Open() error {
return muxPi.Open()
}

// Close is a convenience function for default MuxPi settings.
func Close() error {
return muxPi.Close()
}

// PowerTick is a convenience function for default MuxPi settings.
func PowerTick(d time.Duration) error {
return muxPi.PowerTick(d)
}

// SetLED is a convenience function for default MuxPi settings.
func SetLED(led LED, r, g, b uint8) error {
return muxPi.SetLED(led, r, g, b)
}

// ClearDisplay is a convenience function for default MuxPi settings.
func ClearDisplay() error {
return muxPi.ClearDisplay()
}

// PrintText is a convenience function for default MuxPi settings.
func PrintText(x, y uint, color Color, text string) error {
return muxPi.PrintText(x, y, color, text)
}

// DUT is a convenience function for default MuxPi settings.
func DUT() error {
return muxPi.DUT()
}

// TS is a convenience function for default MuxPi settings.
func TS() error {
return muxPi.TS()
}

0 comments on commit 00e82f9

Please sign in to comment.