]
def __init__(self, **kwargs):
+ self.samplerate = None
self.reset_variables()
- def start(self, metadata):
+ def start(self):
# self.out_proto = self.add(srd.OUTPUT_PROTO, 'can')
self.out_ann = self.add(srd.OUTPUT_ANN, 'can')
- self.samplerate = metadata['samplerate']
- self.bit_width = float(self.samplerate) / float(self.options['bitrate'])
- self.bitpos = (self.bit_width / 100.0) * self.options['sample_point']
+ def metadata(self, key, value):
+ if key == srd.SRD_CONF_SAMPLERATE:
+ self.samplerate = value
+ self.bit_width = float(self.samplerate) / float(self.options['bitrate'])
+ self.bitpos = (self.bit_width / 100.0) * self.options['sample_point']
def report(self):
pass
self.curbit += 1
def decode(self, ss, es, data):
+ if self.samplerate is None:
+ raise Exception("Cannot decode without samplerate.")
for (self.samplenum, pins) in data:
(can_rx,) = pins
]
def __init__(self, **kwargs):
+ self.samplerate = None
self.state = 'WAIT FOR RISING EDGE'
self.oldpins = None
self.oldval = None
self.bitcount = 0 # Counter for the DCF77 bits (0..58)
self.dcf77_bitnumber_is_known = 0
- def start(self, metadata):
- self.samplerate = metadata['samplerate']
+ def start(self):
# self.out_proto = self.add(srd.OUTPUT_PROTO, 'dcf77')
self.out_ann = self.add(srd.OUTPUT_ANN, 'dcf77')
+ def metadata(self, key, value):
+ if key == srd.SRD_CONF_SAMPLERATE:
+ self.samplerate = value
+
def report(self):
pass
raise Exception('Invalid DCF77 bit: %d' % c)
def decode(self, ss, es, data):
+ if self.samplerate is None:
+ raise Exception("Cannot decode without samplerate.")
for (self.samplenum, pins) in data:
# Ignore identical samples early on (for performance reasons).
]
def __init__(self, **kwargs):
+ self.samplerate = None
self.oldsck = 1
self.oldws = 1
self.bitcount = 0
self.start_sample = None
self.wordlength = -1
- def start(self, metadata):
- self.samplerate = metadata['samplerate']
+ def start(self):
self.out_proto = self.add(srd.OUTPUT_PROTO, 'i2s')
self.out_ann = self.add(srd.OUTPUT_ANN, 'i2s')
+ def metadata(self, key, value):
+ if key == srd.SRD_CONF_SAMPLERATE:
+ self.samplerate = value
+
def putpb(self, data):
self.put(self.start_sample, self.samplenum, self.out_proto, data)
(self.samplesreceived, self.wordlength, samplerate)
def decode(self, ss, es, data):
+ if self.samplerate is None:
+ raise Exception("Cannot decode without samplerate.")
for self.samplenum, (sck, ws, sd) in data:
# Ignore sample if the bit clock hasn't changed.
self.put(self.rise, self.samplenum, self.out_ann, data)
def __init__(self, **kwargs):
+ self.samplerate = None
self.samplenum = 0
self.state = 'WAIT FOR FALLING EDGE'
self.present = 0
self.fall = 0
self.rise = 0
- def start(self, metadata):
+ def start(self):
self.out_proto = self.add(srd.OUTPUT_PROTO, 'onewire_link')
self.out_ann = self.add(srd.OUTPUT_ANN, 'onewire_link')
- self.samplerate = metadata['samplerate']
+ def metadata(self, key, value):
+ if key != srd.SRD_CONF_SAMPLERATE:
+ return
+ self.samplerate = value
# Check if samplerate is appropriate.
if self.options['overdrive'] == 'yes':
pass
def decode(self, ss, es, data):
+ if self.samplerate is None:
+ raise Exception("Cannot decode without samplerate.")
for (self.samplenum, (owr, pwr)) in data:
# State machine.
if self.state == 'WAIT FOR FALLING EDGE':
self.put(s - halfbit, s + halfbit, self.out_proto, data)
def __init__(self, **kwargs):
+ self.samplerate = None
self.samplenum = 0
self.frame_start = [-1, -1]
self.startbit = [-1, -1]
self.oldbit = [1, 1]
self.oldpins = [1, 1]
- def start(self, metadata):
- self.samplerate = metadata['samplerate']
+ def start(self):
self.out_proto = self.add(srd.OUTPUT_PROTO, 'uart')
self.out_ann = self.add(srd.OUTPUT_ANN, 'uart')
- # The width of one UART bit in number of samples.
- self.bit_width = \
- float(self.samplerate) / float(self.options['baudrate'])
+ def metadata(self, key, value):
+ if key == srd.SRD_CONF_SAMPLERATE:
+ self.samplerate = value;
+ # The width of one UART bit in number of samples.
+ self.bit_width = float(self.samplerate) / float(self.options['baudrate'])
def report(self):
pass
self.putg([4, ['Stop bit', 'Stop', 'T']])
def decode(self, ss, es, data):
+ if self.samplerate is None:
+ raise Exception("Cannot decode without samplerate.")
# TODO: Either RX or TX could be omitted (optional probe).
for (self.samplenum, pins) in data:
]
def __init__(self):
+ self.samplerate = None
self.oldsym = 'J' # The "idle" state is J.
self.ss_sop = None
self.ss_block = None
self.consecutive_ones = 0
self.state = 'IDLE'
- def start(self, metadata):
+ def start(self):
self.out_proto = self.add(srd.OUTPUT_PROTO, 'usb_signalling')
self.out_ann = self.add(srd.OUTPUT_ANN, 'usb_signalling')
- self.bitrate = bitrates[self.options['signalling']]
- self.bitwidth = float(metadata['samplerate']) / float(self.bitrate)
- self.halfbit = int(self.bitwidth / 2)
+
+ def metadata(self, key, value):
+ if key == srd.SRD_CONF_SAMPLERATE:
+ self.samplerate = value
+ self.bitrate = bitrates[self.options['signalling']]
+ self.bitwidth = float(self.samplerate) / float(self.bitrate)
+ self.halfbit = int(self.bitwidth / 2)
def report(self):
pass
self.oldsym = sym
def decode(self, ss, es, data):
+ if self.samplerate is None:
+ raise Exception("Cannot decode without samplerate.")
for (self.samplenum, pins) in data:
# State machine.
if self.state == 'IDLE':