my $openocd_remote = shift @ARGV || 'picam:4444';
+
my $bit2pin;
my $io2bit;
my $bits = shift;
$bits = reverse $bits; # make substr work as expected
+ return if $last_bits eq $bits;
+
print "pin off io___ ICO prv | " x 4, $openocd_remote,"\n";
foreach my $i ( 0 .. ($#$pin2io/4)-1 ) {
foreach my $j ( 0 .. 3 ) {
print "# diff_bits $diff\n";
}
-print "[press enter]\n";
-my $cmd = <STDIN>;
+my $cmd = '';
+if ( $ENV{SLEEP} ) {
+ sleep $ENV{SLEEP};
+ $cmd = <DATA>;
+ exit if ! $cmd;
+} else {
+ print "[press enter]\n";
+ $cmd = <STDIN>;
+}
chomp $cmd;
+
if ( $cmd =~ /(\d+)=(\d)/ ) {
my ( $pin, $v ) = ( $1, $2 );
warn "# pin $pin = $v\n";
my $io = $pin2io->[$pin];
my $bit = $io2bit->{$io}->[0];
- my $b = substr($BSR,0,$bit+1)
- . ( substr($BSR,$bit+1,1) ^ 1 )
+ my $old_bsr = reverse $BSR;
+
+ my $b = substr($old_bsr,0,$bit+1)
+ . ( substr($old_bsr,$bit+1,1) ^ 1 )
. ( $v & 1 )
- . substr($BSR,$bit+3)
+ . substr($old_bsr,$bit+3)
;
+ $b = reverse $b;
diff_bits( $BSR, $b ), $/;
}#while(1)
+
+__DATA__
+5=1
+a
+b
+c
+d
+e
+f
+a
+a
+a
+a
+a
+a
+a
+a
+a
+b
+c
+d
+e
+f
+b
+c
+d
+e
+f
+b
+c
+d
+e
+f
+b
+c
+d
+e
+f
+b
+c
+d
+e
+f
+b
+c
+d
+e
+f
+b
+c
+d
+e
+f
+b
+c
+d
+e
+f
+b
+c
+d
+e
+f
+5=0
+a
+b
+c
+d
+e
+f