diff options
author | Xo Wang <xow@google.com> | 2017-01-09 16:21:08 -0800 |
---|---|---|
committer | Xo Wang <xow@google.com> | 2017-01-10 17:36:40 -0800 |
commit | f35a7ddf30c27b796b969acc9f125b82e2de89bf (patch) | |
tree | f1aaad9042c854b25f0e0a93413adfeb9e8445ba /pysystemmgr | |
parent | cae038e513ecd57e5360d4e2d668153d28ae5e24 (diff) | |
download | talos-skeleton-f35a7ddf30c27b796b969acc9f125b82e2de89bf.tar.gz talos-skeleton-f35a7ddf30c27b796b969acc9f125b82e2de89bf.zip |
obmc-mgr-system: Support GPIOs in AA, AB, AC
Add support for two letter GPIO names that start with A.
Signed-off-by: Xo Wang <xow@google.com>
Change-Id: Ie3a063f476f0ba84e2c8ad0415d7a6db59e8bda0
Diffstat (limited to 'pysystemmgr')
-rw-r--r-- | pysystemmgr/obmc/system/__init__.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pysystemmgr/obmc/system/__init__.py b/pysystemmgr/obmc/system/__init__.py index 8799b69..9a2a50a 100644 --- a/pysystemmgr/obmc/system/__init__.py +++ b/pysystemmgr/obmc/system/__init__.py @@ -1,9 +1,10 @@ GPIO_BASE = 320 def convertGpio(name): - name = name.upper() - c = name[0:1] - offset = int(name[1:]) - a = ord(c)-65 - base = a*8+GPIO_BASE - return base+offset + offset = int(filter(str.isdigit, name)) + port = filter(str.isalpha, name.upper()) + a = ord(port[-1]) - ord('A') + if len(port) > 1: + a += 26 + base = a * 8 + GPIO_BASE + return base + offset |