pcf8591

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: BSD-3-Clause Imports: 3 Imported by: 1

Documentation

Overview

Package pcf8591 implements a driver for the PCF8591 Analog to Digital/Digital to Analog Converter.

Datasheet: https://www.nxp.com/docs/en/data-sheet/PCF8591.pdf

Index

Constants

View Source
const PCF8591_ENABLE_DAC = 0x40

control bit for DAC

Variables

This section is empty.

Functions

This section is empty.

Types

type ADCPin

type ADCPin struct {
	machine.Pin
	// contains filtered or unexported fields
}

ADCPin is the implementation of the ADConverter interface.

func (ADCPin) Configure

func (p ADCPin) Configure()

Configure here just for interface compatibility.

func (ADCPin) Get

func (p ADCPin) Get() uint16

Get the current reading for a specific ADCPin.

type Device

type Device struct {
	Address uint16
	CH0     ADCPin
	CH1     ADCPin
	CH2     ADCPin
	CH3     ADCPin
	// contains filtered or unexported fields
}

Device wraps PCF8591 ADC functions.

func New

func New(b drivers.I2C) *Device

New returns a new PCF8591 driver. Pass in a fully configured I2C bus.

func (*Device) Configure

func (d *Device) Configure()

Configure here just for interface compatibility.

func (*Device) GetADC

func (d *Device) GetADC(ch int) ADCPin

GetADC returns an ADC for a specific channel.

func (*Device) Read

func (d *Device) Read(ch int) (uint16, error)

Read analog data from channel

Jump to

Keyboard shortcuts

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