dump pins without wiringpi mappings but with pcf8591
[x300-pci] / gpio.pl
1 #!/usr/bin/perl
2
3 my @last;
4
5 while(1) {
6
7 my @o;
8 my @pcf = `gpio -x pcf8591:120:0x48 readall`;
9 my @gpio = `gpio -g readall`;
10 foreach (@gpio) {
11         chomp;
12 #       next unless /\d\s/;
13
14         # kill wiringpi mapping columns
15         s/^(.{8}).{6}/$1/;
16         s/.{6}(.{8})$/$1/;
17
18         s/([ \d]{2})(...GPIO.)../$1$2$1/;
19         s/(GPIO.)..(...)(\s*\d+)/$1$3$2$3/;
20
21         push @o, $_;
22         print $_, shift @pcf || "\n";
23 }
24
25 my $cmd = <STDIN>;
26
27 } #/while
28