X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fuart%2Fpd.py;h=b8508a72c74b7338e7a1039ce6e265e84badda2c;hb=95d11271b46a46788d497481d03177e883c8554e;hp=d13a11958b70c508e2860e681d542ec089cdd466;hpb=f04964c696336f5699a099bbd64785f199d91f4c;p=libsigrokdecode.git 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]: