summaryrefslogtreecommitdiff
path: root/it2gpio
diff options
context:
space:
mode:
Diffstat (limited to 'it2gpio')
-rwxr-xr-xit2gpio20
1 files changed, 11 insertions, 9 deletions
diff --git a/it2gpio b/it2gpio
index f6b5e7b..1723f48 100755
--- a/it2gpio
+++ b/it2gpio
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
-import sys, re
+import sys
-regs = []
def main():
+ regs = []
+
for line in sys.stdin:
line = line.strip()
parts = line.split(' ')
@@ -12,16 +13,17 @@ def main():
regs.append(int(val, 16))
if not regs:
- raise Error("regs is empty")
+ raise Exception("regs is empty")
for k, reg in enumerate(regs):
for i in range(32):
- num = (32 * k) + i
- index = int(num / 32)
- bit = num % 32
- status = (reg >> bit) & 1
- print("GPIO%d = %d" % (num, status))
+ gpio_num = (32 * k) + i
+ if gpio_num > 75:
+ break
+ bit = gpio_num % 32
+ gpio_val = (reg >> bit) & 1
+ print("GPIO%d = %d" % (gpio_num, gpio_val))
+
if __name__ == '__main__':
main()
-