resistive

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: BSD-3-Clause Imports: 2 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FourWire

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

FourWire represents a resistive touchscreen with a four-wire interface as described in http://ww1.microchip.com/downloads/en/Appnotes/doc8091.pdf

func (*FourWire) Configure

func (res *FourWire) Configure(config *FourWireConfig) error

Configure should be called once before starting to read the device

func (*FourWire) ReadTouchPoint

func (res *FourWire) ReadTouchPoint() (p touch.Point)

ReadTouchPoint reads a single touch.Point from the device. If the device was configured with ReadSamples > 1, each value will be sampled that many times and averaged to smooth over spurious results of the analog reads.

func (*FourWire) ReadX

func (res *FourWire) ReadX() uint16

ReadX reads the "raw" X-value on a 16-bit scale without multiple sampling

func (*FourWire) ReadY

func (res *FourWire) ReadY() uint16

ReadY reads the "raw" Y-value on a 16-bit scale without multiple sampling

func (*FourWire) ReadZ

func (res *FourWire) ReadZ() uint16

ReadZ reads the "raw" Z-value on a 16-bit scale without multiple sampling

type FourWireConfig

type FourWireConfig struct {

	// Y+ pin, must be capable of analog reads
	YP machine.Pin

	// Y- pin, must be capable of analog reads
	YM machine.Pin

	// X+ pin, must be capable of analog reads
	XP machine.Pin

	// X- pin, must be capable of analog reads
	XM machine.Pin

	// If set, each call to ReadTouchPoint() will sample the X, Y, and Z values
	// and average them.  This can help smooth out spurious readings, for example
	// ones that result from the capacitance of a TFT under the touchscreen
	ReadSamples int
}

FourWireConfig is passed to the Configure method. All of the pins must be specified for this to be a valid configuration. ReadSamples is optional, and if not set with default to 2.

Jump to

Keyboard shortcuts

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