periph: periph.io/x/periph/conn/gpio/gpiotest Index | Files

package gpiotest

import "periph.io/x/periph/conn/gpio/gpiotest"

Package gpiotest is meant to be used to test drivers using fake Pins.

Index

Package Files

gpiotest.go

type LogPinIO Uses

type LogPinIO struct {
    gpio.PinIO
}

LogPinIO logs when its state changes.

func (*LogPinIO) In Uses

func (p *LogPinIO) In(pull gpio.Pull, edge gpio.Edge) error

In implements gpio.PinIn.

func (*LogPinIO) Out Uses

func (p *LogPinIO) Out(l gpio.Level) error

Out implements gpio.PinOut.

func (*LogPinIO) PWM Uses

func (p *LogPinIO) PWM(duty gpio.Duty, f physic.Frequency) error

PWM implements gpio.PinOut.

func (*LogPinIO) Read Uses

func (p *LogPinIO) Read() gpio.Level

Read implements gpio.PinIn.

func (*LogPinIO) Real Uses

func (p *LogPinIO) Real() gpio.PinIO

Real implements gpio.RealPin.

func (*LogPinIO) WaitForEdge Uses

func (p *LogPinIO) WaitForEdge(timeout time.Duration) bool

WaitForEdge implements gpio.PinIn.

type Pin Uses

type Pin struct {
    // These should be immutable.
    N   string
    Num int
    Fn  string // TODO(maruel): pin.Func in v4.

    // Grab the Mutex before accessing the following members.
    sync.Mutex
    L         gpio.Level // Used for both input and output
    P         gpio.Pull
    EdgesChan chan gpio.Level  // Use it to fake edges
    D         gpio.Duty        // PWM duty
    F         physic.Frequency // PWM period
}

Pin implements gpio.PinIO.

Modify its members to simulate hardware events.

func (*Pin) DefaultPull Uses

func (p *Pin) DefaultPull() gpio.Pull

DefaultPull implements gpio.PinIn.

func (*Pin) Func Uses

func (p *Pin) Func() pin.Func

Func implements pin.PinFunc.

func (*Pin) Function Uses

func (p *Pin) Function() string

Function implements pin.Pin.

func (*Pin) Halt Uses

func (p *Pin) Halt() error

Halt implements conn.Resource.

It has no effect.

func (*Pin) In Uses

func (p *Pin) In(pull gpio.Pull, edge gpio.Edge) error

In implements gpio.PinIn.

func (*Pin) Name Uses

func (p *Pin) Name() string

Name implements pin.Pin.

func (*Pin) Number Uses

func (p *Pin) Number() int

Number implements pin.Pin.

func (*Pin) Out Uses

func (p *Pin) Out(l gpio.Level) error

Out implements gpio.PinOut.

func (*Pin) PWM Uses

func (p *Pin) PWM(duty gpio.Duty, f physic.Frequency) error

PWM implements gpio.PinOut.

func (*Pin) Pull Uses

func (p *Pin) Pull() gpio.Pull

Pull implements gpio.PinIn.

func (*Pin) Read Uses

func (p *Pin) Read() gpio.Level

Read implements gpio.PinIn.

func (*Pin) SetFunc Uses

func (p *Pin) SetFunc(f pin.Func) error

SetFunc implements pin.PinFunc.

func (*Pin) String Uses

func (p *Pin) String() string

String implements conn.Resource.

func (*Pin) SupportedFuncs Uses

func (p *Pin) SupportedFuncs() []pin.Func

SupportedFuncs implements pin.PinFunc.

func (*Pin) WaitForEdge Uses

func (p *Pin) WaitForEdge(timeout time.Duration) bool

WaitForEdge implements gpio.PinIn.

Package gpiotest imports 8 packages (graph) and is imported by 2 packages. Updated 2018-11-18. Refresh now. Tools for package owners.