diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2019-11-29 21:15:48 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2019-11-29 23:19:54 +0100 |
commit | 5ef0a979ca0553d43077390ea54837d3161c0ad5 (patch) | |
tree | 4266c1fc282ccdc0dee0027ca0bf9db7d46746fb /decoders/uart | |
parent | 048545adcdb75f29e24e021beb09248ea2cd7da5 (diff) | |
download | libsigrokdecode-5ef0a979ca0553d43077390ea54837d3161c0ad5.tar.gz libsigrokdecode-5ef0a979ca0553d43077390ea54837d3161c0ad5.zip |
uart: support 'ignore' parity type, remove unsupported 'check_parity' option
The previous UART decoder implementation announced a 'check_parity'
option which took no effect (support code was missing). Remove it. Add
another 'ignore' parity choice instead, which consumes the parity bit's
position yet always passes the check.
Diffstat (limited to 'decoders/uart')
-rw-r--r-- | decoders/uart/pd.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index 802c593..7a43ee4 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -58,6 +58,9 @@ TX = 1 # 'none' is _not_ allowed as value for 'parity_type'. def parity_ok(parity_type, parity_bit, data, num_data_bits): + if parity_type == 'ignore': + return True + # Handle easy cases first (parity bit is always 1 or 0). if parity_type == 'zero': return parity_bit == 0 @@ -100,9 +103,7 @@ class Decoder(srd.Decoder): {'id': 'num_data_bits', 'desc': 'Data bits', 'default': 8, 'values': (5, 6, 7, 8, 9)}, {'id': 'parity_type', 'desc': 'Parity type', 'default': 'none', - 'values': ('none', 'odd', 'even', 'zero', 'one')}, - {'id': 'parity_check', 'desc': 'Check parity?', 'default': 'yes', - 'values': ('yes', 'no')}, + 'values': ('none', 'odd', 'even', 'zero', 'one', 'ignore')}, {'id': 'num_stop_bits', 'desc': 'Stop bits', 'default': 1.0, 'values': (0.0, 0.5, 1.0, 1.5)}, {'id': 'bit_order', 'desc': 'Bit order', 'default': 'lsb-first', |