periph: Index | Files

package pinreg

import ""

Package pinreg is a registry for the physical headers (made up of pins) on a host.


Package Files

doc.go pinreg.go

func All Uses

func All() map[string][][]pin.Pin

All contains all the on-board headers on a micro computer.

The map key is the header name, e.g. "P1" or "EULER" and the value is a slice of slice of pin.Pin. For a 2x20 header, it's going to be a slice of [20][2]pin.Pin.

func IsConnected Uses

func IsConnected(p pin.Pin) bool

IsConnected returns true if the pin is on a header.

func Position Uses

func Position(p pin.Pin) (string, int)

Position returns the position on a pin if found.

The header and the pin number. Pin numbers are 1-based.

Returns "", 0 if not connected.

func Register Uses

func Register(name string, allPins [][]pin.Pin) error

Register registers a physical header.

It automatically registers all gpio pins to gpioreg.

func Unregister Uses

func Unregister(name string) error

Unregister removes a previously registered header.

This can happen when an USB device, which exposed an header, is unplugged. This is also useful for unit testing.

Package pinreg imports 6 packages (graph) and is imported by 26 packages. Updated 2018-08-04. Refresh now. Tools for package owners.