gpio

package
v0.0.0-...-372e3a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BusyOutAdapter

type BusyOutAdapter struct {
	// contains filtered or unexported fields
}

BusyOutAdapter implements signal.BusyOut over a PinOut.

func NewBusyOutAdapter

func NewBusyOutAdapter(pin PinOut, targetLevel gpio.Level) *BusyOutAdapter

func (*BusyOutAdapter) Out

func (a *BusyOutAdapter) Out(ctx context.Context) error

Out sets the PinOut to the targetLevel and returns, but sets it back to the opposite level when the context is done.

func (*BusyOutAdapter) String

func (a *BusyOutAdapter) String() string

type BusyOutAdapterFactory

type BusyOutAdapterFactory struct {
	PinName   *PinName
	TargetLow bool
}

func (*BusyOutAdapterFactory) New

type Edges

type Edges int
const (
	RisingEdges  Edges = 1
	FallingEdges Edges = 2
	BothEdges    Edges = 3
)

func (Edges) String

func (e Edges) String() string

type EmitterAdapter

type EmitterAdapter struct {
	// contains filtered or unexported fields
}

EmitterAdapter implements signal.Emitter over a PinIn.

func NewEmitterAdapter

func NewEmitterAdapter(pin PinIn, detectedEdges Edges, waitTimeout time.Duration) *EmitterAdapter

func (*EmitterAdapter) Signal

func (a *EmitterAdapter) Signal(ctx context.Context) <-chan signal.Level

Signal returns a new channel, then repeatedly calls WaitForEdge on the pin, writing its current Level to the channel as soon as an edge is detected. The channel is closed after the context is done, with a delay of up to waitTimeout.

func (*EmitterAdapter) String

func (a *EmitterAdapter) String() string

type EmitterAdapterFactory

type EmitterAdapterFactory struct {
	PinName *PinName
	PullUp  bool
	Falling bool
	Rising  bool
}

func (*EmitterAdapterFactory) New

type PinIn

type PinIn interface {
	String() string
	WaitForEdge(duration time.Duration) bool
	Read() gpio.Level
}

PinIn is a simplified version of gpio.PinIn.

type PinName

type PinName string

PinName implements flag.Value, validating the name by using it to look up the pin in the gpio library's registry.

func NewPinName

func NewPinName(defaultName string) *PinName

func (*PinName) IsZero

func (pn *PinName) IsZero() bool

func (*PinName) Set

func (pn *PinName) Set(s string) error

func (*PinName) String

func (pn *PinName) String() string

func (*PinName) Type

func (pn *PinName) Type() string

type PinOut

type PinOut interface {
	String() string
	Out(level gpio.Level) error
}

PinOut is a simplified version of gpio.PinOut.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL