gpiotest

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pin

type Pin struct {
	N   string // Should be immutable
	Num int    // Should be immutable
	Fn  string // Should be immutable

	sync.Mutex            // Grab the Mutex before modifying the members to keep it concurrent safe
	L          gpio.Level // Used for both input and output
	P          gpio.Pull
	EdgesChan  chan gpio.Level // Use it to fake edges
}

Pin implements gpio.Pin.

Modify its members to simulate hardware events.

func (*Pin) Function

func (p *Pin) Function() string

Function return the value of the Fn field of the pin.

func (*Pin) Halt

func (p *Pin) Halt() error

Halt implements conn.Resource.

It has no effect.

func (*Pin) In

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

In is concurrent safe.

func (*Pin) Name

func (p *Pin) Name() string

Name returns the name of the pin.

func (*Pin) Number

func (p *Pin) Number() int

Number returns the pin number.

func (*Pin) Out

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

Out is concurrent safe.

func (*Pin) Pull

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

Pull implements gpio.PinIn.

func (*Pin) Read

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

Read is concurrent safe.

func (*Pin) String

func (p *Pin) String() string

func (*Pin) WaitForEdge

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

WaitForEdge implements gpio.PinIn.

Jump to

Keyboard shortcuts

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