Device::BusPirate::Mode::BB - use Device::BusPirate in bit-banging mode
Device::BusPirate::Mode::BB
Device::BusPirate
use Device::BusPirate; my $pirate = Device::BusPirate->new; my $bb = $pirate->enter_mode( "BB" )->get; my $count = 0; while(1) { $bb->write( miso => $count == 0, cs => $count == 1, mosi => $count == 2, clk => $count == 3, aux => $count == 4, )->then( sub { $pirate->sleep( 0.5 ) }) ->get; $count++; $count = 0 if $count >= 5; }
This object is returned by a Device::BusPirate instance when switching it into BB mode. It provides methods to configure the hardware, and interact with the five basic IO lines in bit-banging mode.
BB
Change configuration options. The following options exist; all of which are simple true/false booleans.
If enabled, a "high" output pin will be set as an input; i.e. hi-Z. When disabled (default), a "high" output pin will be driven by 3.3V. A "low" output will be driven to GND in either case.
Set an output pin to the given logical state. Uses the open_drain configuration setting to determine whether high should be hi-Z or 3.3V.
open_drain
Sets the state of multiple output pins at the same time.
Set a pin to input direction and read its current state.
Returns a HASH containing the current state of all the pins currently configured as inputs. More efficient than calling multiple read_* methods when more than one pin is being read at the same time.
read_*
Combines the effects of write and read in a single operation; sets the output state of any pins in %out_pins then returns the input state of the pins currently set as inputs.
write
read
%out_pins
Enable or disable the VREG 5V and 3.3V power outputs.
VREG
Enable or disable the IO pin pullup resistors from Vpu. These are connected to the MISO, CLK, MOSI and CS pins.
Vpu
MISO
CLK
MOSI
CS
Paul Evans <leonerd@leonerd.org.uk>
To install Device::BusPirate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::BusPirate
CPAN shell
perl -MCPAN -e shell install Device::BusPirate
For more information on module installation, please visit the detailed CPAN module installation guide.