From: Gerhard Sittig Date: Fri, 29 Nov 2019 20:15:48 +0000 (+0100) Subject: uart: support 'ignore' parity type, remove unsupported 'check_parity' option X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=5ef0a979ca0553d43077390ea54837d3161c0ad5 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. --- 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',