acpin

package
v0.0.0-...-8eca4bf Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package acpin presents the gpio.PinIn interface to handle consistent software detection of AC voltage on a named GPIO pin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PinIn

type PinIn struct {
	// contains filtered or unexported fields
}

PinIn implements gpio.PinIn to represent voltage on an AC GPIO pin

func ByName

func ByName(name string) *PinIn

ByName returns a PinIn associated with GPIO pin described by name. It will return gpio.High when it has detected AC voltage.

This function duplicates gpioreg.ByName signature to simplify code that interacts with both types of pins.

func (*PinIn) Halt

func (p *PinIn) Halt() error

Halt stops the gorouting watching the pin for AC voltage.

func (*PinIn) In

func (p *PinIn) In(pull gpio.Pull, _ gpio.Edge) error

In configures the pin for detecting AC voltage. It always sets edge detection only to RisingEdge, to reduce interrupt rate.

func (*PinIn) Name

func (p *PinIn) Name() string

Name returns the name of the pin.

func (*PinIn) Read

func (p *PinIn) Read() gpio.Level

Read returns the Level of the pin. It is High if the pin has seen an AC cycle in the last 3 seconds.

Jump to

Keyboard shortcuts

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