def __init__(self, **kwargs):
self.state = 'WAIT FOR RISING EDGE'
+ self.oldpins = None
self.oldval = None
self.oldpon = None
self.samplenum = 0
raise Exception('Invalid DCF77 bit: %d' % c)
def decode(self, ss, es, data):
- for (self.samplenum, (val, pon)) in data:
+ for (self.samplenum, pins) in data:
+
+ # Ignore identical samples early on (for performance reasons).
+ if self.oldpins == pins:
+ continue
+ self.oldpins, (val, pon) = pins, pins
# Always remember the old PON state.
if self.oldpon != pon:
self.state = 'FIND START'
self.oldscl = None
self.oldsda = None
+ self.oldpins = None
def start(self, metadata):
self.out_proto = self.add(srd.OUTPUT_PROTO, 'i2c')
super(Decoder, self).put(self.startsample, self.samplenum, output_id, data)
def decode(self, ss, es, data):
- for (self.samplenum, (scl, sda)) in data:
+ for (self.samplenum, pins) in data:
+
+ # Ignore identical samples early on (for performance reasons).
+ if self.oldpins == pins:
+ continue
+ self.oldpins, (scl, sda) = pins, pins
# First sample: Save SCL/SDA value.
if self.oldscl == None:
self.samplenum = -1
self.cs_was_deasserted_during_data_word = 0
self.oldcs = -1
+ self.oldpins = None
def start(self, metadata):
self.out_proto = self.add(srd.OUTPUT_PROTO, 'spi')
def decode(self, ss, es, data):
# TODO: Either MISO or MOSI could be optional. CS# is optional.
- for (self.samplenum, (miso, mosi, sck, cs)) in data:
+ for (self.samplenum, pins) in data:
+
+ # Ignore identical samples early on (for performance reasons).
+ if self.oldpins == pins:
+ continue
+ self.oldpins, (miso, mosi, sck, cs) = pins, pins
if self.oldcs != cs:
# Send all CS# pin value changes.
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 (self.samplenum, (rx, tx)) in data:
+ for (self.samplenum, pins) in data:
+
+ # Ignore identical samples early on (for performance reasons).
+ if self.oldpins == pins:
+ continue
+ self.oldpins, (rx, tx) = pins, pins
# First sample: Save RX/TX value.
if self.oldbit[RX] == None:
self.scount = 0
self.packet = ''
self.syms = []
+ self.oldpins = None
def start(self, metadata):
self.samplerate = metadata['samplerate']
pass
def decode(self, ss, es, data):
- for (self.samplenum, (dp, dm)) in data:
+ for (self.samplenum, pins) in data:
# Note: self.samplenum is the absolute sample number, whereas
# self.scount only counts the number of samples since the
# last change in the D+/D- lines.
self.scount += 1
+ # Ignore identical samples early on (for performance reasons).
+ if self.oldpins == pins:
+ continue
+ self.oldpins, (dp, dm) = pins, pins
+
if self.options['signalling'] == 'low-speed':
sym = symbols_ls[dp, dm]
elif self.options['signalling'] == 'full-speed':