Device::Chip::TMP102 - chip driver for a TMP102
Device::Chip::TMP102
use Device::Chip::TMP102; my $chip = Device::Chip::TMP102->new; $chip->mount( Device::Chip::Adapter::...->new )->get; printf "Temperature is %2.2f C\n", $chip->read_temp->get;
This Device::Chip subclass provides specific communication to a Texas Instruments TMP102 attached to a computer via an I²C adapter.
Not all of the chip's capabilities are currently accessible through this driver. Extended mode is supported.
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.
The I²C address of the device. Can be specified in decimal, octal or hex with leading 0 or 0x prefixes.
0
0x
The following methods documented with a trailing call to ->get return Future instances.
->get
$config = $chip->read_config->get
Reads and returns the current chip configuration as a HASH reference.
HASH
SD => 0 | 1 TM => 0 | 1 POL => 0 | 1 F => "1" | "2" | "4" | "6" R0 => 0 | 1 (read only) R1 => 0 | 1 (read only) OS => 0 | 1 EM => 0 | 1 AL => 0 | 1 CR => "0.25Hz" | "1Hz" | "4Hz" | "8Hz"
$chip->change_config( %config )->get
Changes the configuration. Any field names not mentioned will be preserved.
$temp = $chip->read_temp->get
Returns the temperature in degrees Celsius.
$chip->write_temp_low( $temp )->get
Changes the low temperature threshold in degrees Celsius.
$temp = $chip->read_temp_low->get
Returns the low temperature threshold in degrees Celsius.
$chip->write_temp_high( $temp )->get
Changes the high temperature threshold in degrees Celsius.
$temp = $chip->read_temp_high->get
Returns the high temperature threshold in degrees Celsius.
To install Device::Chip::TMP102, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::Chip::TMP102
CPAN shell
perl -MCPAN -e shell install Device::Chip::TMP102
For more information on module installation, please visit the detailed CPAN module installation guide.