gopio

package module
v0.0.0-...-3e72665 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

README

GoDoc Report

gopio

Simple Golang GPIO API. Read more about GPIO Sysfs Interface.

Documentation

Overview

gopio package implements simple API in go to work with sysfs gpios. Read more about sysfs here: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pin

type Pin struct {
	Id int // Pin id
	// contains filtered or unexported fields
}

Pin struct represents gpio abstraction with methods associated.

func New

func New(id int) (pin *Pin, e error)

New function initializes gpio by pin id.

func (*Pin) Close

func (pin *Pin) Close() (e error)

Close function unexports pin socket.

func (*Pin) GetMode

func (pin *Pin) GetMode() (m string, e error)

GetMode returns current pin mode reading it from direction descriptor associated to the pin.

func (*Pin) GetValue

func (pin *Pin) GetValue() (v int, e error)

GetValue returns current pin value reading it from direction descriptor associated to the pin.

func (*Pin) SetMode

func (pin *Pin) SetMode(m string) (e error)

SetMode receives a string that contains new mode to set current pin. First check if received mode is valid and then write into the socket.

func (*Pin) SetValue

func (pin *Pin) SetValue(v int) (e error)

SetValue receives an int that contains new value to set current pin. First check if received value is valid and then write into the socket.

Jump to

Keyboard shortcuts

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