Device-BusPirate-Chip-AVR_HVSP

 view release on metacpan or  search on metacpan

lib/Device/BusPirate/Chip/AVR_HVSP.pm  view on Meta::CPAN

sub _transfer
{
   my $self = shift;

   my ( $sdi, $sii ) = @_;

   my $sdo = 0;
   my $mode = $self->mode;

   # A "byte" transfer consists of 11 clock transitions; idle low. Each bit is
   # clocked in from SDO on the falling edge of clocks 0 to 7, but clocked out
   # of SDI and SII on clocks 1 to 8.
   # We'll therefore toggle the clock 11 times; on each of the first 8 clocks
   # we raise it, then simultaneously lower it, writing out the next out bits
   # and reading in the input.
   # Serial transfer is MSB first in both directions
   #
   # We cheat massively here and rely on pipeline ordering of the actual
   # ->write calls, by writing all 22 of the underlying bytes to the Bus
   # Pirate serial port, then waiting on all 22 bytes to come back.



( run in 1.171 second using v1.01-cache-2.11-cpan-49f99fa48dc )