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']
self.startsample = [-1, -1]
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']
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: