fix(pkg/logfile): description of functions
This commit is contained in:
@ -7,10 +7,13 @@ import (
|
||||
"github.com/stianeikeland/go-rpio"
|
||||
)
|
||||
|
||||
// DefaultRGBLED is a RGBLED which implement all functions of the interface
|
||||
// RGBLED
|
||||
type DefaultRGBLED struct {
|
||||
*types.RGBLED
|
||||
}
|
||||
|
||||
// Blue makes the RGBLED shine in blue
|
||||
func (rgbled *DefaultRGBLED) Blue() error {
|
||||
gpios := []*types.GPIO{
|
||||
rgbled.BaseColorsToGPIO[types.BaseColorBlue],
|
||||
@ -27,6 +30,7 @@ func (rgbled *DefaultRGBLED) Blue() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Green makes the RGBLED shine in green
|
||||
func (rgbled *DefaultRGBLED) Green() error {
|
||||
|
||||
gpios := []*types.GPIO{
|
||||
@ -45,6 +49,7 @@ func (rgbled *DefaultRGBLED) Green() error {
|
||||
|
||||
}
|
||||
|
||||
// Off turns on the RGBLED off
|
||||
func (rgbled *DefaultRGBLED) Off() error {
|
||||
|
||||
gpios := []*types.GPIO{
|
||||
@ -60,10 +65,12 @@ func (rgbled *DefaultRGBLED) Off() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// On turns on the RGBLED
|
||||
func (rgbled *DefaultRGBLED) On() error {
|
||||
return rgbled.White()
|
||||
}
|
||||
|
||||
// Purple makes the RGBLED shine in purple
|
||||
func (rgbled *DefaultRGBLED) Purple() error {
|
||||
gpios := []*types.GPIO{
|
||||
rgbled.BaseColorsToGPIO[types.BaseColorBlue],
|
||||
@ -81,6 +88,7 @@ func (rgbled *DefaultRGBLED) Purple() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Red makes the RGBLED shine in red
|
||||
func (rgbled *DefaultRGBLED) Red() error {
|
||||
gpios := []*types.GPIO{
|
||||
rgbled.BaseColorsToGPIO[types.BaseColorRed],
|
||||
@ -97,6 +105,7 @@ func (rgbled *DefaultRGBLED) Red() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Turquoise makes the RGBLED shine in turquoise
|
||||
func (rgbled *DefaultRGBLED) Turquoise() error {
|
||||
gpios := []*types.GPIO{
|
||||
rgbled.BaseColorsToGPIO[types.BaseColorBlue],
|
||||
@ -114,6 +123,7 @@ func (rgbled *DefaultRGBLED) Turquoise() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// White makes the RGBLED shine in white
|
||||
func (rgbled *DefaultRGBLED) White() error {
|
||||
gpios := []*types.GPIO{
|
||||
rgbled.BaseColorsToGPIO[types.BaseColorBlue],
|
||||
@ -132,6 +142,7 @@ func (rgbled *DefaultRGBLED) White() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Yellow makes the RGBLED shine in yellow
|
||||
func (rgbled *DefaultRGBLED) Yellow() error {
|
||||
gpios := []*types.GPIO{
|
||||
rgbled.BaseColorsToGPIO[types.BaseColorGreen],
|
||||
@ -149,22 +160,27 @@ func (rgbled *DefaultRGBLED) Yellow() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Error makes the RGBLED shine in the error specified color
|
||||
func (rgbled *DefaultRGBLED) Error() error {
|
||||
return rgbled.switchColorBasedOnAction(rgbled.ActionMapping[types.LEDActionError])
|
||||
}
|
||||
|
||||
// Logfile makes the RGBLED shine in the logfile specified color
|
||||
func (rgbled *DefaultRGBLED) Logfile() error {
|
||||
return rgbled.switchColorBasedOnAction(rgbled.ActionMapping[types.LEDActionLogfile])
|
||||
}
|
||||
|
||||
// Sync makes the RGBLED shine in the sync specified color
|
||||
func (rgbled *DefaultRGBLED) Sync() error {
|
||||
return rgbled.switchColorBasedOnAction(rgbled.ActionMapping[types.LEDActionSync])
|
||||
}
|
||||
|
||||
// Warn makes the RGBLED shine in the warn specified color
|
||||
func (rgbled *DefaultRGBLED) Warn() error {
|
||||
return rgbled.switchColorBasedOnAction(rgbled.ActionMapping[types.LEDActionWarn])
|
||||
}
|
||||
|
||||
// Run makes the RGBLED shine in the run specified color
|
||||
func (rgbled *DefaultRGBLED) Run() error {
|
||||
return rgbled.switchColorBasedOnAction(rgbled.ActionMapping[types.LEDActionRun])
|
||||
}
|
@ -1,10 +1,6 @@
|
||||
package rgbled
|
||||
|
||||
type LED interface {
|
||||
On() error
|
||||
Off() error
|
||||
}
|
||||
|
||||
// RGBLED is an interface that discribes all needed functions for a RGBLED
|
||||
type RGBLED interface {
|
||||
Blue() error
|
||||
Green() error
|
||||
|
@ -139,6 +139,8 @@ func operate(rgbLEDs []RGBLED, color types.LEDColor) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Error makes all RGB-LEDs which are passed as parameters light up in their
|
||||
// error specified color.
|
||||
func Error(rgbLEDs []RGBLED) error {
|
||||
errorChannel := make(chan error, len(rgbLEDs))
|
||||
|
||||
@ -164,6 +166,8 @@ func Error(rgbLEDs []RGBLED) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Logfile makes all RGB-LEDs which are passed as parameters light up in their
|
||||
// logfile specified color.
|
||||
func Logfile(rgbLEDs []RGBLED) error {
|
||||
errorChannel := make(chan error, len(rgbLEDs))
|
||||
|
||||
@ -189,6 +193,8 @@ func Logfile(rgbLEDs []RGBLED) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Run makes all RGB-LEDs which are passed as parameters light up in their run
|
||||
// specified color.
|
||||
func Run(rgbLEDs []RGBLED) error {
|
||||
errorChannel := make(chan error, len(rgbLEDs))
|
||||
|
||||
@ -214,6 +220,8 @@ func Run(rgbLEDs []RGBLED) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Sync makes all RGB-LEDs which are passed as parameters light up in their sync
|
||||
// specified color.
|
||||
func Sync(rgbLEDs []RGBLED) error {
|
||||
errorChannel := make(chan error, len(rgbLEDs))
|
||||
|
||||
@ -239,6 +247,8 @@ func Sync(rgbLEDs []RGBLED) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Warn makes all RGB-LEDs which are passed as parameters light up in their
|
||||
// warn specified color.
|
||||
func Warn(rgbLEDs []RGBLED) error {
|
||||
errorChannel := make(chan error, len(rgbLEDs))
|
||||
|
||||
|
Reference in New Issue
Block a user