15 Dec 2020 15:03:16 UTC
- Distribution: Device-Chip-INA219
- Module version: 0.07
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (2)
- Testers (12 / 0 / 0)
- KwaliteeBus factor: 1
- 95.51% Coverage
- License: perl_5
- Perl: v5.26.0
- Activity24 month
- Download (13.31KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionPEVANS Paul Evans
- MOUNT PARAMETERS
Device::Chip::INA219- chip driver for an INA219
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;
This Device::Chip subclass provides specific communication to a Texas Instruments INA219 attached to a computer via an I²C 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.
The I²C address of the device. Can be specified in decimal, octal or hex with leading
The following methods documented in an
awaitexpression return Future instances.
$config = await $chip->read_config;
Reads and returns the current chip configuration as a
await $chip->change_config( %config );
Changes the configuration. Any field names not mentioned will be preserved.
$uv = await $chip->read_shunt_voltage;
Returns the current shunt voltage reading scaled integer in microvolts.
$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.
Paul Evans <email@example.com>
Module Install Instructions
To install Device::Chip::INA219, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Device::Chip::INA219
For more information on module installation, please visit the detailed CPAN module installation guide.