From 7cf698c5475ac6948d7a9d5c2a6e4ec9cb878d84 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 16 Oct 2014 09:35:27 +0200 Subject: uart: Emit databyte and bits list at the same time. This will allow for much simpler code in stacked PDs. Adapt stacked PDs to new API. --- decoders/midi/pd.py | 3 +++ decoders/pan1321/pd.py | 3 +++ decoders/uart/pd.py | 10 +++++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/decoders/midi/pd.py b/decoders/midi/pd.py index 296cee4..5915976 100644 --- a/decoders/midi/pd.py +++ b/decoders/midi/pd.py @@ -175,6 +175,9 @@ class Decoder(srd.Decoder): self.ss, self.es = ss, es + # We're only interested in the byte value (not individual bits). + pdata = pdata[0] + # Short MIDI overview: # - Status bytes are 0x80-0xff, data bytes are 0x00-0x7f. # - Most messages: 1 status byte, 1-2 data bytes. diff --git a/decoders/pan1321/pd.py b/decoders/pan1321/pd.py index 60e7549..b70defc 100644 --- a/decoders/pan1321/pd.py +++ b/decoders/pan1321/pd.py @@ -136,6 +136,9 @@ class Decoder(srd.Decoder): if ptype != 'DATA': return + # We're only interested in the byte value (not individual bits). + pdata = pdata[0] + # If this is the start of a command/reply, remember the start sample. if self.cmd[rxtx] == '': self.ss_block = ss diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index b8508a7..c342243 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -28,9 +28,9 @@ Packet: This is the list of s and their respective values: - 'STARTBIT': The data is the (integer) value of the start bit (0/1). - - 'DATA': The data is the (integer) value of the UART data. Valid values - range from 0 to 512 (as the data can be up to 9 bits in size). - - 'DATABITS': List of data bits and their ss/es numbers. + - ('DATA', 'DATABITS'): DATA is the (integer) value of the UART data. Valid + values range from 0 to 512 (as the data can be up to 9 bits in size). + 'DATABITS' is the list of individual data bits and their ss/es numbers. - 'PARITYBIT': The data is the (integer) value of the parity bit (0/1). - 'STOPBIT': The data is the (integer) value of the stop bit (0 or 1). - 'INVALID STARTBIT': The data is the (integer) value of the start bit (0/1). @@ -263,8 +263,8 @@ class Decoder(srd.Decoder): self.state[rxtx] = 'GET PARITY BIT' - self.putpx(rxtx, ['DATABITS', rxtx, self.databits[rxtx]]) - self.putpx(rxtx, ['DATA', rxtx, self.databyte[rxtx]]) + self.putpx(rxtx, ['DATA', rxtx, + (self.databyte[rxtx], self.databits[rxtx])]) b, f = self.databyte[rxtx], self.options['format'] if f == 'ascii': -- cgit v1.2.3-70-g09d2