NAME

Device::BusPirate::Chip - base class for chip-specific adapters

DEPRECATION

Note: this package and its entire module name heirarchy are now deprecated in favour of the Device::Chip interface instead. Any existing chip implementations should be rewritten. They can continue to target the Bus Pirate by using Device::Chip::Adapter::BusPirate, but will therefore gain the ability to use any other implementation of Device::Chip::Adapter.

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

new

$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

$pirate = $chip->pirate

Returns the Device::BusPirate instance.

mode

$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.

mount

$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:

CHIP

$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.

MODE

$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>