gpio

package
v6.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package gpio provides functions for interacting with GPIO pins via the GPIO Sysfs Interface for Userspace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export

func Export(pin int) error

Export enables access to the given gpio pin.

func GetPinID

func GetPinID(controller string, pin int) (int, error)

GetPinID computes the sysfs pin ID for a specific port on a specific GPIO controller chip. The controller arg is matched to a gpiochip's label in sysfs. GetPinID gets the base offset of that chip, and adds the specific pin number.

func SetOutputValue

func SetOutputValue(pin int, val Value) error

SetOutputValue configures the gpio as an output pin with the given value.

Types

type Value

type Value bool

Value represents the value of a gpio pin

const (
	Low  Value = false
	High Value = true
)

Gpio pin values can either be low (0) or high (1)

func ReadValue

func ReadValue(pin int) (Value, error)

ReadValue returns the value of the given gpio pin. If the read was unsuccessful, it returns a value of Low and the associated error.

func (Value) Dir

func (v Value) Dir() string

func (Value) String

func (v Value) String() string

Jump to

Keyboard shortcuts

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