adc0832

package
v0.0.0-...-53472a3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package adc0832 provides a bit bashed device driver ADC0832s.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("closed")

ErrClosed indicates the ADC is closed.

Functions

This section is empty.

Types

type ADC0832

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

ADC0832 reads ADC values from a connected ADC0832.

func New

func New(c *gpiod.Chip, clk, csz, di, do int, options ...Option) (*ADC0832, error)

New creates a ADC0832.

func (*ADC0832) Close

func (adc *ADC0832) Close() error

Close releases all resources allocated by the ADC.

func (*ADC0832) Read

func (adc *ADC0832) Read(ch int) (uint8, error)

Read returns the value of a single channel read from the ADC.

func (*ADC0832) ReadDifferential

func (adc *ADC0832) ReadDifferential(ch int) (uint8, error)

ReadDifferential returns the value of a differential pair read from the ADC.

type Option

type Option func(*ADC0832)

Option specifies a construction option for the ADC.

func WithTclk

func WithTclk(tclk time.Duration) Option

WithTclk sets the clock period for the ADC.

Note that this is the half-cycle period.

func WithTset

func WithTset(tset time.Duration) Option

WithTset sets the settling period for the ADC.

Jump to

Keyboard shortcuts

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