diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2017-03-14 15:35:27 +0100 |
---|---|---|
committer | Gerhard Sittig <gerhard.sittig@gmx.net> | 2017-03-14 19:26:21 +0100 |
commit | 1078af01aeee50c9ad9633dd477e9de575521012 (patch) | |
tree | dae38ca7de57f356abb1c23f13265b566a995b5e /decoders | |
parent | cf60d0bc17b1a8e316ab5ef054f07a5fa59d1585 (diff) | |
download | libsigrokdecode-1078af01aeee50c9ad9633dd477e9de575521012.tar.gz libsigrokdecode-1078af01aeee50c9ad9633dd477e9de575521012.zip |
uart: Immediately skip reception of parity bits when not applicable
When the UART frame does not contain a parity bit, then immediately
advance to reception of stop bits after all data bits were received.
This eliminates the necessity to run the parity check routine when
parity does not apply in the first place. Without this change, some
"dummy" sample needs to get inspected for correct operation of the
state machine.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/uart/pd.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index 070a2f4..51b0504 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -263,7 +263,11 @@ class Decoder(srd.Decoder): self.cur_data_bit[rxtx] += 1 return + # Skip to either reception of the parity bit, or reception of + # the STOP bits if parity is not applicable. self.state[rxtx] = 'GET PARITY BIT' + if self.options['parity_type'] == 'none': + self.state[rxtx] = 'GET STOP BITS' self.putpx(rxtx, ['DATA', rxtx, (self.datavalue[rxtx], self.databits[rxtx])]) @@ -322,11 +326,6 @@ class Decoder(srd.Decoder): return None def get_parity_bit(self, rxtx, signal): - # If no parity is used/configured, skip to the next state immediately. - if self.options['parity_type'] == 'none': - self.state[rxtx] = 'GET STOP BITS' - return - # Skip samples until we're in the middle of the parity bit. if not self.reached_bit(rxtx, self.options['num_data_bits'] + 1): return |