NAME

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

SYNOPSIS

       use Device::Chip::INA219;
       use Future::AsyncAwait;
    
       my $chip = Device::Chip::INA219->new;
       await $chip->mount( Device::Chip::Adapter::...->new );
    
       printf "Current bus voltage is %d mV, shunt voltage is %d uV\n",
          await $chip->read_bus_voltage, await $chip->read_shunt_voltage;

DESCRIPTION

    This Device::Chip subclass provides specific communication to a Texas
    Instruments INA219 attached to a computer via an I涎 adapter.

    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涎 address of the device. Can be specified in decimal, octal or
    hex with leading 0 or 0x prefixes.

METHODS

    The following methods documented in an await expression return Future
    instances.

 read_config

       $config = await $chip->read_config;

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

       RST        => BOOL
       BRNG       => "16V" | "32V"
       PG         => "40mV" | "80mV" | "160mV" | "320mV"
       BADC       => "9b" | "10b" | "11b" | "12b" | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128
       SADC       => as above
       MODE_CONT  => BOOL
       MODE_BUS   => BOOL
       MODE_SHUNT => BOOL

 change_config

       await $chip->change_config( %config );

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

 read_shunt_voltage

       $uv = await $chip->read_shunt_voltage;

    Returns the current shunt voltage reading scaled integer in microvolts.

 read_bus_voltage

       $mv = await $chip->read_bus_voltage;
    
       ( $mv, $ovf, $cnvr ) = await $chip->read_bus_voltage;

    Returns the current bus voltage reading, as a scaled integer in
    milivolts.

    The returned Future also yields the OVF and CNVR flags.

AUTHOR

    Paul Evans <leonerd@leonerd.org.uk>