gpio

package
v7.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: BSD-3-Clause Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 uint) (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

Dir returns the representation that sysfs likes to use.

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