summaryrefslogtreecommitdiff
path: root/decoders/uart/pd.py
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2014-09-15 11:50:09 -0500
committerBert Vermeulen <bert@biot.com>2014-09-15 19:00:08 +0200
commit4eafeeefc716a617837f1d69c040753b0b8d71f7 (patch)
tree3291965d46ec7414084b9feeff87f507da187e23 /decoders/uart/pd.py
parentf38da319741c74b83b4d2146f872d05cbd8e2f3c (diff)
downloadlibsigrokdecode-4eafeeefc716a617837f1d69c040753b0b8d71f7.tar.gz
libsigrokdecode-4eafeeefc716a617837f1d69c040753b0b8d71f7.zip
uart: Implement signal inversion
Diffstat (limited to 'decoders/uart/pd.py')
-rw-r--r--decoders/uart/pd.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py
index d13a119..b8508a7 100644
--- a/decoders/uart/pd.py
+++ b/decoders/uart/pd.py
@@ -102,7 +102,10 @@ class Decoder(srd.Decoder):
'values': ('lsb-first', 'msb-first')},
{'id': 'format', 'desc': 'Data format', 'default': 'ascii',
'values': ('ascii', 'dec', 'hex', 'oct', 'bin')},
- # TODO: Options to invert the signal(s).
+ {'id': 'invert_rx', 'desc': 'Invert RX?', 'default': 'no',
+ 'values': ('yes', 'no')},
+ {'id': 'invert_tx', 'desc': 'Invert TX?', 'default': 'no',
+ 'values': ('yes', 'no')},
)
annotations = (
('rx-data', 'RX data'),
@@ -336,6 +339,11 @@ class Decoder(srd.Decoder):
# continue
self.oldpins, (rx, tx) = pins, pins
+ if self.options['invert_rx'] == 'yes':
+ rx = not rx
+ if self.options['invert_tx'] == 'yes':
+ tx = not tx
+
# Either RX or TX (but not both) can be omitted.
has_pin = [rx in (0, 1), tx in (0, 1)]
if has_pin == [False, False]: