ads1x15

package
v0.0.0-...-13dad8c Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_UINT = ^uint(0)
	MIN_UINT = 0
	MAX_INT  = int(MAX_UINT >> 1)
	MIN_INT  = -MAX_INT - 1

	// Error codes
	ADS1x15_READ_FAIL = MIN_INT
)
View Source
const (
	ADS1x15_DEFAULT_ADDRESS        = 0x48
	ADS1x15_POINTER_CONVERSION     = 0x00
	ADS1x15_POINTER_CONFIG         = 0x01
	ADS1x15_POINTER_LOW_THRESHOLD  = 0x02
	ADS1x15_POINTER_HIGH_THRESHOLD = 0x03
	ADS1x15_CONFIG_OS_SINGLE       = 0x8000
	ADS1x15_CONFIG_MUX_OFFSET      = 12
)

Register and other configuration values:

View Source
const (
	ADS1x15_CONFIG_MODE_CONTINUOUS = 0x0000
	ADS1x15_CONFIG_MODE_SINGLE     = 0x0100
)
View Source
const (
	ADS1x15_CONFIG_COMP_WINDOW      = 0x0010
	ADS1x15_CONFIG_COMP_ACTIVE_HIGH = 0x0008
	ADS1x15_CONFIG_COMP_LATCHING    = 0x0004
)
View Source
const ADS1115_CONFIG_DR_DEFAULT = 128

Mapping of data/sample rate to config register values for ADS1115 (slower).

View Source
const ADS1x15_CONFIG_COMP_QUE_DISABLE = 0x0003

Variables

View Source
var ADS1115_CONFIG_DR = map[int]int{
	8:   0x0000,
	16:  0x0020,
	32:  0x0040,
	64:  0x0060,
	128: 0x0080,
	250: 0x00A0,
	475: 0x00C0,
	860: 0x00E0,
}
View Source
var ADS1x15_CONFIG_COMP_QUE = map[int]int{
	1: 0x0000,
	2: 0x0001,
	4: 0x0002,
}
View Source
var ADS1x15_CONFIG_GAIN = map[int]int{
	2 / 3: 0x0000,
	1:     0x0200,
	2:     0x0400,
	4:     0x0600,
	8:     0x0800,
	16:    0x0A00,
}

Maping of gain values to config register values.

Functions

func NewADS1115

func NewADS1115(addr byte, bus embd.I2CBus) *ads1x15

NewADS1115 creates a new object capable of communicating with a NewADS1115 chip over I2C

Types

This section is empty.

Jump to

Keyboard shortcuts

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