NAME
Device::Chip::ADS1115
- chip driver for ADS1115
SYNOPSIS
This Device::Chip subclass provides specific communications to a chip in the Texas Instruments ADS111x family, such as the ADS1113, ADS1114 or ADS1115.
The reader is presumed to be familiar with the general operation of this chip; the documentation here will not attempt to explain or define chip-specific concepts or features, only the use of this module to access them.
METHODS
The following methods documented with a trailing call to ->get
return Future instances.
read_config
$config = $chip->read_config->get
Returns a HASH
reference containing the chip's current configuration.
OS => 0 | 1
MUX => "0" | "1" | "2" | "3" # single-ended
| "0-1" | "0-3" | "1-3" | "2-3" # bipolar
PGA => "6.144V" | "4.096V" | "2.048V" | "1.024V" | "0.512V" | "0.256V"
MODE => "CONT" | "SINGLE"
DR => 8 | 16 | 32 | 64 | 128 | 250 | 475 | 860
COMP_MODE => "TRAD" | "WINDOW"
COMP_POL => "LOW" | "HIGH"
COMP_LAT => 0 | 1
COMP_QUE => 1 | 2 | 4 | "DIS"
change_config
$chip->change_config( %config ->get
Changes the configuration. Any field names not mentioned will be preserved at their existing values.
trigger
$chip->trigger->get
Set the OS
bit configuration bit, which will cause the chip to take a new reading of the currently-selected input channel when in single-shot mode.
read_adc
$value = $chip->read_adc->get
Reads the most recent reading from the result register on the chip. This method should be called after a suitable delay after the "trigger" method when in single-shot mode, or at any time when in continuous mode.
The reading is returned directly from the chip as a plain 16-bit signed integer. To convert this into voltage use the "read_adc_voltage" method.
read_adc_voltage
$voltage = $chip->read_adc_voltage->get
Reads the most recent reading as per "read_adc" and converts it into a voltage level by taking into account the current setting of the PGA
configuration option to scale it.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>