NAME

Device::Chip::TMP102 - chip driver for an TMP102

SYNOPSIS

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;

DESCRIPTION

This Device::Chip subclass provides specific communication to a Texas Instruments TMP102 attached to a computer via an I²C adapter.

Only a subset of the chip's capabilities are currently accessible through this driver.

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.

MOUNT PARAMETERS

addr

The I²C address of the device. Can be specified in decimal, octal or hex with leading 0 or 0x prefixes.

METHODS

The following methods documented with a trailing call to ->get return Future instances.

read_config

$config = $chip->read_config->get

Reads and returns the current chip configuration as a HASH reference.

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"

change_config

$chip->change_config( %config )->get

Changes the configuration. Any field names not mentioned will be preserved.

read_temp

$temp = $chip->read_temp->get

Returns the temperature in degrees Celsius.

write_temp_low

$chip->write_temp_low( $temp )->get

Changes the low temperature threshold in degrees Celsius.

read_temp_low

$temp = $chip->read_temp_low->get

Returns the low temperature threshold in degrees Celsius.

write_temp_high

$chip->write_temp_high( $temp )->get

Changes the high temperature threshold in degrees Celsius.

read_temp_high

$temp = $chip->read_temp_high->get

Returns the high temperature threshold in degrees Celsius.