Device::Chip - an abstraction of a hardware chip IO driver
Note: this document is currently under heavy development. Details will be added, changed, and evolved as it progresses. Be warned that currently anything may be changed from one version to the next.
This package describes an interface that classes can use to implement a driver to talk to a specific hardware chip or module. An instance implementing this interface would communicate with the actual hardware device via some instance of the related interface, Device::Chip::Adapter.
The documentation in this file is aimed primarily at users of Device::Chip subclasses. For more information on authoring such a module, see instead Device::Chip::Authoring.
To actually use a chip driver to talk to a specific piece of hardware that is connected to the computer, an adapter must be supplied. This will be an instance of some class that satisfies the Device::Chip::Adapter interface. The chip driver will use this adapter instance to access the underlying hardware port used to electrically connect to the chip and communicate with it. This is supplied by invoking the "mount" method. For example:
my $chip = Device::Chip::MAX7219->new;
my $adapter = Device::Chip::Adapter::FTDI->new;
await $chip->mount( $adapter );
$chip = Device::Chip->new;
Returns a new instance of a chip driver object.
The following methods documented in an await expression return Future instances.
This allows them to easily be used as a simple synchronous method by using the trailing "get" in Future call. Alternatively, if the underlying adapter allows a fully asynchronous mode of operation, they can be combined in the usual ways for futures to provide more asynchronous use of the device.
$chip = await $chip->mount( $adapter, %params );
Supplies the chip driver with the means to actually communicate with the connected device, via some electrical interface connected to the computer.
The parameters given in %params will vary depending on the specific chip in question, and should be documented there.
$chip = await $chip->mount_from_paramstr( $adapter, $paramstr );
A variant of "mount" that parses its options from the given string. This string should be a comma-separated list of parameters, where each is given as a name and value separated by equals sign. If there is no equals sign, the value is implied as true, as a convenience for parameters that are simple boolean flags.
Paul Evans <firstname.lastname@example.org>
To install Device::Chip, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.