dump pins without wiringpi mappings but with pcf8591
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 17 Jun 2016 08:08:31 +0000 (10:08 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 17 Jun 2016 08:08:31 +0000 (10:08 +0200)
gpio.pl [new file with mode: 0755]

diff --git a/gpio.pl b/gpio.pl
new file mode 100755 (executable)
index 0000000..9b97bc5
--- /dev/null
+++ b/gpio.pl
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+my @last;
+
+while(1) {
+
+my @o;
+my @pcf = `gpio -x pcf8591:120:0x48 readall`;
+my @gpio = `gpio -g readall`;
+foreach (@gpio) {
+       chomp;
+#      next unless /\d\s/;
+
+       # kill wiringpi mapping columns
+       s/^(.{8}).{6}/$1/;
+       s/.{6}(.{8})$/$1/;
+
+       s/([ \d]{2})(...GPIO.)../$1$2$1/;
+       s/(GPIO.)..(...)(\s*\d+)/$1$3$2$3/;
+
+       push @o, $_;
+       print $_, shift @pcf || "\n";
+}
+
+my $cmd = <STDIN>;
+
+} #/while
+