NAME
Device::BusPirate::Chip
- base class for chip-specific adapters
DESCRIPTION
This base class is provided for implementations of chip-specific adapters, to provide specific code to interact with particular kinds of chip or other hardware attached to the Bus Pirate.
CONSTRUCTOR
$chip = Device::BusPirate::Chip->new( $bp, %opts )
Constructs a new instance of the chip adapter. The first argument is the Device::BusPirate object itself. The remaining arguments are not otherwise inspected by the base class; they are free for use by the specific subclasses.
METHODS
$pirate = $chip->pirate
Returns the Device::BusPirate instance.
$mode = $chip->mode
Returns the Device::BusPirate::Mode
instance being used to communicate with this chip. Normally this method would be used directly by the implementation subclass, rather than the end-user code calling it.
$chip = $chip->mount( $mode )->get
Called by the mount_chip
method on the Device::BusPirate
object, this method is intended for implementation subclasses to perform any initial configuration of the $mode
instance that they require; such as details of communication speed or settings.
MODE PASSTHROUGH METHODS
The following methods are passed through to the mode
instance
power
pullup
aux
IMPLEMENTATION METHODS
The following methods must be provided by specific implementations of this base class:
$chipname = Device::BusPirate::Chip->CHIP
Returns the name for this chip; the name that must be passed to the mount_chip
method on Device::BusPirate
in order to request this particular implementation. For ease of use, this name should match the name given by the hardware manufacturer to identify the chip. It does not need to be a valid Perl symbol; it may contain characters not normally allowed in symbol names.
$modename = $chip->MODE
Called after construction, this method should return a mode name that will be used to communicate with the chip. Normally this would be a constant, hence its capitalised name, but it is invoked on the instance, after construction, in case of chips with multiple possible access methods (e.g. dual SPI or I2C devices), allowing the method chance to inspect the constructor options to make this choice.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>