mcp3w0c

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: MIT Imports: 3 Imported by: 2

Documentation

Overview

Package mcp3w0c provides device drivers for MCP3004/3008/3204/3208 SPI ADCs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MCP3w0c

type MCP3w0c struct {
	spi.SPI
	// contains filtered or unexported fields
}

MCP3w0c reads ADC values from a connected Microchip MCP3xxx family device.

Supported variants are MCP3004/3008/3204/3208. The w indicates the width of the device (0 => 10, 2 => 12) and the c the number of channels. The two data pins, di and do, may be tied and connected to a single GPIO pin.

func New

func New(tclk time.Duration, clk, csz, di, do int, width uint) *MCP3w0c

New creates a MCP3w0c.

func NewMCP3008

func NewMCP3008(tclk time.Duration, clk, csz, di, do int) *MCP3w0c

NewMCP3008 creates a MCP3008.

func NewMCP3208

func NewMCP3208(tclk time.Duration, clk, csz, di, do int) *MCP3w0c

NewMCP3208 creates a MCP3208.

func (*MCP3w0c) Read

func (adc *MCP3w0c) Read(ch int) uint16

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

func (*MCP3w0c) ReadDifferential

func (adc *MCP3w0c) ReadDifferential(ch int) uint16

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

Jump to

Keyboard shortcuts

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