X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fuart%2Fuart.py;h=24551da6d03e177854e289178173512fa8704b98;hb=17db40087cb0b4ed76ee26cbc69458f598630fc6;hp=2bb61dd86ca546ad119360fedc589626f4f4ff85;hpb=2b7160383cc189f721600c04be17a980e216dfd6;p=libsigrokdecode.git diff --git a/decoders/uart/uart.py b/decoders/uart/uart.py index 2bb61dd..24551da 100644 --- a/decoders/uart/uart.py +++ b/decoders/uart/uart.py @@ -61,8 +61,7 @@ class Decoder(srd.Decoder): id = 'uart' name = 'UART' longname = 'Universal Asynchronous Receiver/Transmitter' - desc = 'Universal Asynchronous Receiver/Transmitter (UART)' - longdesc = 'TODO.' + desc = 'Asynchronous, serial bus.' license = 'gplv2+' inputs = ['logic'] outputs = ['uart'] @@ -102,11 +101,9 @@ class Decoder(srd.Decoder): self.paritybit = [-1, -1] self.stopbit1 = [-1, -1] self.startsample = [-1, -1] - - # Initial state. self.state = ['WAIT FOR START BIT', 'WAIT FOR START BIT'] - self.oldbit = [None, None] + self.oldpins = None def start(self, metadata): self.samplerate = metadata['samplerate'] @@ -269,10 +266,13 @@ class Decoder(srd.Decoder): def decode(self, ss, es, data): # TODO: Either RX or TX could be omitted (optional probe). - for (samplenum, (rx, tx)) in data: + for (self.samplenum, pins) in data: - # TODO: Start counting at 0 or 1? Increase before or after? - self.samplenum += 1 + # Note: Ignoring identical samples here for performance reasons + # is not possible for this PD, at least not in the current state. + # if self.oldpins == pins: + # continue + self.oldpins, (rx, tx) = pins, pins # First sample: Save RX/TX value. if self.oldbit[RX] == None: