NAME

    Device::Chip - an abstraction of a hardware chip IO driver

DESCRIPTION

      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.

    It is suggested that a driver for a particular hardware chip or module
    provides a concrete class named within the Device::Chip heirarchy,
    adding the basic name of the chip or module as a suffix; for example
    the driver for a Maxim MAX7219 LED driver would be called:

       package Device::Chip::MAX7219;

    This package provides a base class that such a specific implementation
    class could use as a superclass, but it is not required to. The
    important detail is that it provides the interface described by this
    documentation.

 USING A CHIP DRIVER

    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 "connect" method. For example:

       my $chip = Device::Chip::MAX7219->new;
    
       my $adapter = Device::Chip::Adapter::FTDI->new;
    
       $chip->connect( $adapter )->get;

CONSTRUCTOR

 new

       $chip = Device::Chip->new

    Returns a new instance of a chip driver object.

METHODS

    The following methods documented with a trailing call to ->get 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.

 adapter

       $adapter = $chip->adapter

    Returns the current adapter that the chip is connected to. This will be
    some instance implementing the companion interface,
    Device::Chip::Adapter.

    This method is primarily used by the concrete driver subclass; it is
    unlikely to be useful to the containing application using the chip.

 protocol

       $protocol = $chip->protocol

    Returns the adapter protocol module that the chip driver code will use
    to actually communicate with the chip.

    This method is primarily used by the concrete driver subclass; it is
    unlikely to be useful to the containing application using the chip.

 connect

       $chip = $chip->connect( $adapter )->get

    Supplies the chip driver with the means to actually communicate with
    the connected device, via some electrical interface connected to the
    computer.

AUTHOR

    Paul Evans <leonerd@leonerd.org.uk>

