Documentation ¶
Index ¶
Constants ¶
View Source
const ( PW_ACTION_UNDEFINED = iota PW_ACTION_ON PW_ACTION_OFF PW_ACTION_TOGGLE PW_ACTION_BUTTONPRESS )
View Source
const PIN_OFF = 0x00
View Source
const PIN_ON = 0x01
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PinChangedEvent ¶
type PinChangedEvent struct { Pin string LastValue int Value int // contains filtered or unexported fields }
func (PinChangedEvent) Source ¶
func (p PinChangedEvent) Source() interface{}
type PinChangedFunc ¶
type PinChangedFunc func(ev PinChangedEvent) error
type PinFuncs ¶
type PinFuncs struct { Write PinWriteFunc Read PinReadFunc }
type PinReadFunc ¶
type PinWatcher ¶
type PinWatcher struct {
// contains filtered or unexported fields
}
func NewPinWatcher ¶
func NewPinWatcher(pin string, watchFuncs *WatchFuncs) *PinWatcher
NewPinWatcher creates a new watcher for value changes of GPIO pins
func (*PinWatcher) Name ¶
func (w *PinWatcher) Name() string
Name returns the name of the watcher and can be used in change handlers, for logging etc
func (*PinWatcher) Observe ¶
func (w *PinWatcher) Observe() error
Observe must be called periodically by the owner and detects changes in state.
func (*PinWatcher) SetName ¶
func (w *PinWatcher) SetName(name string)
SetName sets the name of the watcher and can be used in change handlers, for logging etc
type PinWriteAction ¶
type PinWriteAction struct {
// contains filtered or unexported fields
}
func NewPinWriteAction ¶
func NewPinWriteAction(pin string, action int, pinFuncs *PinFuncs) *PinWriteAction
func (PinWriteAction) Action ¶
func (ac PinWriteAction) Action() int
Action returns the action constant (i.e. PWACTION_TOGGLE etc)
func (*PinWriteAction) Execute ¶
func (ac *PinWriteAction) Execute() error
Execute is called by the owner when an acton on a pin must be executed
type PinWriteFunc ¶
type WatchFuncs ¶
type WatchFuncs struct { Read PinReadFunc Changed PinChangedFunc }
Click to show internal directories.
Click to hide internal directories.