util

package
v0.0.0-...-f2f0a72 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2016 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Center

func Center(text string, width int, padWith rune) string

Center pads `text` to with by placing it in the middle and padding the rest of the string with the `padWith` rune.

func Closer

func Closer(c io.Closer)

Closer closes c. If that fails, it will log the error. The intended usage is for convinient defer calls only! It gives only little knowledge about where the error is, but it's slightly better than a bare defer xyz.Close()

Types

type Rotary

type Rotary struct {
	// Button is a channel that gets triggered when the button was on (true) and
	// when it has been released again (false)
	Button chan bool

	// Pressed is a channel that gets triggered when the user presses the rotary
	// switch. The duration passed is the time how long he holds it.
	Pressed chan time.Duration

	// Value is triggerd when the knob was turned.
	Value chan int
	// contains filtered or unexported fields
}

Rotary reads the protocol generated by the radio-rotary driver and provides a convinient API around it.

func NewRotary

func NewRotary() (*Rotary, error)

NewRotary returns a new rotary handling utility.

func (*Rotary) Close

func (rty *Rotary) Close() error

Close frees all resources and closes all channels.

Jump to

Keyboard shortcuts

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