=encoding UTF-8

=head1 NAME

C<Device::Chip::ADT7470> - chip driver for an F<ADT7470>

=head1 SYNOPSIS

 use Device::Chip::ADT7470;

 my $chip = Device::Chip::ADT7470->new;
 $chip->mount( Device::Chip::Adapter::...->new )->get;

 printf "Current fan 1 speed is %d rpm\n", $chip->read_fan_rpm( 1 )->get;

=head1 DESCRIPTION

This L<Device::Chip> subclass provides specific communication to a
F<Analog Devices> F<ADT7470> 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.


=cut

=head1 MOUNT PARAMETERS

=head2 addr

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


=cut

=head1 METHODS

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


=cut

=head2 read_config

   $config = $chip->read_config->get

Returns a C<HASH> reference of the contents of the user register.

   STRT    => 0 | 1
   TODIS   => 0 | 1
   LOCK    => 0 | 1  (power cycle to unlock)
   FST_TCH => 0 | 1
   HF_LF   => 0 | 1
   T05_STB => 0 | 1


=cut

=head2 change_config

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

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


=cut

=head2 read_duty

   $duty = $chip->read_duty( $fan )->get

Returns the pwm duty cycle for the specified fan (1-4).


=cut

=head2 read_duty_percent

   $duty = $chip->read_duty_percent( $fan )->get

Returns the pwm duty cycle as a percentage for the specified fan (1-4).


=cut

=head2 write_duty

   $duty = $chip->write_duty( $fan, $duty )->get

Writes the pwm duty cycle for the specified fan.


=cut

=head2 write_duty_percent

   $duty = $chip->write_duty_percent( $fan, $percent )->get

Writes the pwm duty cycle as a percentage for the specified fan.


=cut

=head2 read_fan_rpm

   $rpm = $chip->read_fan_rpm( $fan )->get

Read the fan rpm for the specified fan.


=cut

