22 lines
335 B
Go
22 lines
335 B
Go
|
package relay
|
||
|
|
||
|
import (
|
||
|
cc "rpirelay/internal/context"
|
||
|
|
||
|
"github.com/stianeikeland/go-rpio/v4"
|
||
|
)
|
||
|
|
||
|
func Initialize(pin rpio.Pin) *Relay {
|
||
|
return &Relay{pin: pin}
|
||
|
}
|
||
|
|
||
|
type Relay struct {
|
||
|
pin rpio.Pin
|
||
|
}
|
||
|
|
||
|
type Service interface {
|
||
|
SwitchOn(c *cc.C) (err error)
|
||
|
SwitchOff(c *cc.C) (err error)
|
||
|
GetState(c *cc.C) (open bool, err error)
|
||
|
}
|