pin

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package pin declare well known pins.

pin is about physical pins, not about their logical function.

While not a protocol strictly speaking, these are "well known constants".

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicPin

type BasicPin struct {
	N string
}

BasicPin implements Pin as a non-functional pin.

Example
package main

import (
	"fmt"

	"github.com/pcjacobse/periph/conn/pin"
)

func main() {
	// Declare a basic pin, that is not a GPIO, for registration on an header.
	b := &pin.BasicPin{N: "Exotic"}
	fmt.Printf("%s\n", b)

}
Output:

Exotic
var (
	INVALID  *BasicPin // Either floating or invalid pin
	GROUND   *BasicPin // Ground
	V1_8     *BasicPin // 1.8V (filtered)
	V3_3     *BasicPin // 3.3V (filtered)
	V5       *BasicPin // 5V (filtered)
	DC_IN    *BasicPin // DC IN; this is normally the 5V input
	BAT_PLUS *BasicPin // LiPo Battery + connector
)

These are well known pins.

func (*BasicPin) Function

func (b *BasicPin) Function() string

Function returns "" as pin function.

func (*BasicPin) Name

func (b *BasicPin) Name() string

Name returns the pin name.

func (*BasicPin) Number

func (b *BasicPin) Number() int

Number returns -1 as pin number.

func (*BasicPin) String

func (b *BasicPin) String() string

String returns the pin name.

type Pin

type Pin interface {
	// String() typically returns the pin name and number, ex: "PD6(45)"
	String() string
	// Name returns the name of the pin.
	Name() string
	// Number returns the logical pin number or a negative number if the pin is
	// not a GPIO, e.g. GROUND, V3_3, etc.
	Number() int
	// Function returns a user readable string representation of what the pin is
	// configured to do. Common case is In and Out but it can be bus specific pin
	// name.
	Function() string
}

Pin is the minimal common interface shared between gpio.PinIO and analog.PinIO.

Directories

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

Jump to

Keyboard shortcuts

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