goAD7705

package module
v0.0.0-...-11eeb60 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2017 License: GPL-3.0 Imports: 4 Imported by: 0

README

goAD7705

AD7705/AD7706 userland library for SPI connected ADC converter. Primary targer raspberry/bananapi written in go

5.1.2017, release just for my blog. Some issues are not debugged due lacking analog parts.

Documentation

Index

Constants

View Source
const (
	REG_COMMUNICATION = 0
	REG_SETUP         = 1
	REG_CLOCK         = 2
	REG_DATA          = 3
	REG_TEST          = 4
	REG_NOP           = 5
	REG_OFFSET        = 6
	REG_GAIN          = 7
)
View Source
const (
	CH_AIN1        = 0
	CH_AIN2        = 1
	CH_AIN1_COMMON = 2
	CH_AIN2_COMMON = 3
)
View Source
const (
	OPMODE_NORMAL  = 0
	OPMODE_SELFCAL = 1
	OPMODE_ZEROCAL = 2
	OPMODE_FULLCAL = 3
)
View Source
const (
	GAINSEL_1   = 0
	GAINSEL_2   = 1
	GAINSEL_4   = 2
	GAINSEL_8   = 3
	GAINSEL_16  = 4
	GAINSEL_32  = 5
	GAINSEL_64  = 6
	GAINSEL_128 = 7
)
View Source
const (
	ODRXTAL_20  = 0
	ODRXTAL_25  = 1
	ODRXTAL_100 = 2
	ODRXTAL_200 = 3
	ODROSC_50   = 0
	ODROSC_60   = 1
	ODROSC_250  = 2
	ODROSC_500  = 3
)

Variables

This section is empty.

Functions

func GainInNumber

func GainInNumber(g Gainsel) float64

Types

type AD7705

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

func InitAD7705

func InitAD7705(spidevice string, readypin int, xtal bool, clkdiv bool, setup ChSetup) (AD7705, error)

Clockdiv and xtal settings depend on pcb.. not adjustable during run

func (*AD7705) BusReset

func (p *AD7705) BusReset() error

func (*AD7705) ReadData

func (p *AD7705) ReadData(chSelection Chsel) (uint16, error)

func (*AD7705) SelfCal

func (p *AD7705) SelfCal(chSelection Chsel, setup ChSetup, mode Opmode) error

func (*AD7705) Set

func (p *AD7705) Set(ch Chsel, setup ChSetup) error

func (*AD7705) WaitDataReady

func (p *AD7705) WaitDataReady(chSelection Chsel) error

func (*AD7705) WriteRegister

func (p *AD7705) WriteRegister(chSelection Chsel, register RegSel, data byte) (byte, error)

func (*AD7705) WriteRegister24

func (p *AD7705) WriteRegister24(chSelection Chsel, register RegSel, data uint32) (uint32, error)

type ChSetup

type ChSetup struct {
	//For setup register
	Gain     Gainsel `json:"gain"`
	Unipolar bool    `json:"unipolar"`
	Buffered bool    `json:"buffered"`
	Filtsync bool    `json:"filtsync"`
	//For clock register Clk and clkdiv are set on setup... only filter is adjusted
	Odr ODR `json:"odr"`
}

func (*ChSetup) ParseSetup

func (p *ChSetup) ParseSetup(settings map[string]float64)

type Chsel

type Chsel byte

type Gainsel

type Gainsel byte

func PickGain

func PickGain(gain float64) Gainsel

func PickRightGainFor

func PickRightGainFor(voltage float64) Gainsel

type ODR

type ODR byte

type Opmode

type Opmode byte

type RegSel

type RegSel byte

Jump to

Keyboard shortcuts

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