pinwrappers

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package pinwrappers implements interfaces that wrap the basic board interface and return types, and expands them with new methods and interfaces for the built in board models. Current expands analog reader and digital interrupt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalogSmoother

type AnalogSmoother struct {
	Raw               board.Analog
	AverageOverMillis int
	SamplesPerSecond  int
	// contains filtered or unexported fields
}

An AnalogSmoother smooths the readings out from an underlying reader.

func SmoothAnalogReader

func SmoothAnalogReader(r board.Analog, c board.AnalogReaderConfig, logger logging.Logger) *AnalogSmoother

SmoothAnalogReader wraps the given reader in a smoother.

func (*AnalogSmoother) Close

func (as *AnalogSmoother) Close(ctx context.Context) error

Close stops the smoothing routine.

func (*AnalogSmoother) Read

func (as *AnalogSmoother) Read(ctx context.Context, extra map[string]interface{}) (board.AnalogValue, error)

Read returns the smoothed out reading.

func (*AnalogSmoother) Start

func (as *AnalogSmoother) Start()

Start begins the smoothing routine that reads from the underlying analog reader.

func (*AnalogSmoother) Write

func (as *AnalogSmoother) Write(ctx context.Context, value int, extra map[string]interface{}) error

Jump to

Keyboard shortcuts

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