From: Bert Vermeulen Date: Thu, 14 Nov 2013 16:25:53 +0000 (+0100) Subject: Use the new Decoder.register() API X-Git-Tag: libsigrokdecode-0.3.0~236 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=be465111b552c7c2a2262ac49758a30a8bf1b1d5;p=libsigrokdecode.git Use the new Decoder.register() API --- diff --git a/decoders/avr_isp/pd.py b/decoders/avr_isp/pd.py index 27b5118..789a7f9 100644 --- a/decoders/avr_isp/pd.py +++ b/decoders/avr_isp/pd.py @@ -51,8 +51,8 @@ class Decoder(srd.Decoder): self.xx, self.yy, self.zz, self.mm = 0, 0, 0, 0 def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'avr_isp') - self.out_ann = self.add(srd.OUTPUT_ANN, 'avr_isp') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/can/pd.py b/decoders/can/pd.py index 2e58c0a..1495e5e 100644 --- a/decoders/can/pd.py +++ b/decoders/can/pd.py @@ -64,8 +64,8 @@ class Decoder(srd.Decoder): self.reset_variables() def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'can') - self.out_ann = self.add(srd.OUTPUT_ANN, 'can') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def metadata(self, key, value): if key == srd.SRD_CONF_SAMPLERATE: diff --git a/decoders/dcf77/pd.py b/decoders/dcf77/pd.py index 9a273b2..b708fbc 100644 --- a/decoders/dcf77/pd.py +++ b/decoders/dcf77/pd.py @@ -76,8 +76,8 @@ class Decoder(srd.Decoder): self.dcf77_bitnumber_is_known = 0 def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'dcf77') - self.out_ann = self.add(srd.OUTPUT_ANN, 'dcf77') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def metadata(self, key, value): if key == srd.SRD_CONF_SAMPLERATE: diff --git a/decoders/ds1307/pd.py b/decoders/ds1307/pd.py index 07bdebc..8652d1b 100644 --- a/decoders/ds1307/pd.py +++ b/decoders/ds1307/pd.py @@ -64,7 +64,7 @@ class Decoder(srd.Decoder): self.years = -1 def start(self): - self.out_ann = self.add(srd.OUTPUT_ANN, 'ds1307') + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/edid/pd.py b/decoders/edid/pd.py index 1f621b2..704f350 100644 --- a/decoders/edid/pd.py +++ b/decoders/edid/pd.py @@ -101,7 +101,7 @@ class Decoder(srd.Decoder): self.cache = [] def start(self): - self.out_ann = self.add(srd.OUTPUT_ANN, 'edid') + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/guess_bitrate/pd.py b/decoders/guess_bitrate/pd.py index 3eaa1e9..9acce50 100644 --- a/decoders/guess_bitrate/pd.py +++ b/decoders/guess_bitrate/pd.py @@ -51,8 +51,8 @@ class Decoder(srd.Decoder): def start(self, metadata): self.samplerate = metadata['samplerate'] - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'guess_bitrate') - self.out_ann = self.add(srd.OUTPUT_ANN, 'guess_bitrate') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/i2cdemux/pd.py b/decoders/i2cdemux/pd.py index 1e1d09c..d86c597 100644 --- a/decoders/i2cdemux/pd.py +++ b/decoders/i2cdemux/pd.py @@ -68,8 +68,8 @@ class Decoder(srd.Decoder): # We're never seen this slave, add a new stream. self.slaves.append(databyte) - self.out_proto.append(self.add(srd.OUTPUT_PYTHON, - 'i2c-%s' % hex(databyte))) + self.out_proto.append(self.register(srd.OUTPUT_PYTHON, + proto_id='i2c-%s' % hex(databyte))) self.stream = self.streamcount self.streamcount += 1 elif cmd == 'STOP': diff --git a/decoders/i2cfilter/pd.py b/decoders/i2cfilter/pd.py index 4586cf7..4fe3a9c 100644 --- a/decoders/i2cfilter/pd.py +++ b/decoders/i2cfilter/pd.py @@ -48,7 +48,7 @@ class Decoder(srd.Decoder): self.packets = [] # Local cache of I2C packets def start(self): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'i2c') + self.out_proto = self.register(srd.OUTPUT_PYTHON, proto_id='i2c') if self.options['address'] not in range(0, 127 + 1): raise Exception('Invalid slave (must be 0..127).') if self.options['direction'] not in ('both', 'read', 'write'): diff --git a/decoders/i2s/pd.py b/decoders/i2s/pd.py index 292a4c4..ea147de 100644 --- a/decoders/i2s/pd.py +++ b/decoders/i2s/pd.py @@ -69,8 +69,8 @@ class Decoder(srd.Decoder): self.wordlength = -1 def start(self): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'i2s') - self.out_ann = self.add(srd.OUTPUT_ANN, 'i2s') + self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def metadata(self, key, value): if key == srd.SRD_CONF_SAMPLERATE: diff --git a/decoders/jtag/pd.py b/decoders/jtag/pd.py index e327d32..5d4ee8e 100644 --- a/decoders/jtag/pd.py +++ b/decoders/jtag/pd.py @@ -57,8 +57,8 @@ class Decoder(srd.Decoder): self.bits_tdo = [] def start(self): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'jtag') - self.out_ann = self.add(srd.OUTPUT_ANN, 'jtag') + self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/jtag_stm32/pd.py b/decoders/jtag_stm32/pd.py index fee2088..3daa024 100644 --- a/decoders/jtag_stm32/pd.py +++ b/decoders/jtag_stm32/pd.py @@ -141,8 +141,8 @@ class Decoder(srd.Decoder): # self.state = 'BYPASS' def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'jtag_stm32') - self.out_ann = self.add(srd.OUTPUT_ANN, 'jtag_stm32') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/lm75/pd.py b/decoders/lm75/pd.py index de1a0da..6bbc5d8 100644 --- a/decoders/lm75/pd.py +++ b/decoders/lm75/pd.py @@ -78,8 +78,8 @@ class Decoder(srd.Decoder): self.avgvalues = [] def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'lm75') - self.out_ann = self.add(srd.OUTPUT_ANN, 'lm75') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): # TODO: print() or self.put() or return xyz, or... ? diff --git a/decoders/lpc/pd.py b/decoders/lpc/pd.py index b4adb5b..313b7d2 100644 --- a/decoders/lpc/pd.py +++ b/decoders/lpc/pd.py @@ -151,8 +151,8 @@ class Decoder(srd.Decoder): self.ss_block = self.es_block = None def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'lpc') - self.out_ann = self.add(srd.OUTPUT_ANN, 'lpc') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/maxim_ds28ea00/pd.py b/decoders/maxim_ds28ea00/pd.py index ed020d4..69ace69 100644 --- a/decoders/maxim_ds28ea00/pd.py +++ b/decoders/maxim_ds28ea00/pd.py @@ -65,7 +65,7 @@ class Decoder(srd.Decoder): self.rom = 0x0000000000000000 def start(self): - self.out_ann = self.add(srd.OUTPUT_ANN, 'maxim_ds28ea00') + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/midi/pd.py b/decoders/midi/pd.py index 371bcd5..6f2f1c7 100644 --- a/decoders/midi/pd.py +++ b/decoders/midi/pd.py @@ -52,8 +52,8 @@ class Decoder(srd.Decoder): self.es_block = None def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'midi') - self.out_ann = self.add(srd.OUTPUT_ANN, 'midi') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/mlx90614/pd.py b/decoders/mlx90614/pd.py index 67a852c..f0bed5c 100644 --- a/decoders/mlx90614/pd.py +++ b/decoders/mlx90614/pd.py @@ -44,8 +44,8 @@ class Decoder(srd.Decoder): self.data = [] def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'mlx90614') - self.out_ann = self.add(srd.OUTPUT_ANN, 'mlx90614') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/mx25lxx05d/pd.py b/decoders/mx25lxx05d/pd.py index 856497b..68335d4 100644 --- a/decoders/mx25lxx05d/pd.py +++ b/decoders/mx25lxx05d/pd.py @@ -111,8 +111,8 @@ class Decoder(srd.Decoder): self.data = [] def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'mx25lxx05d') - self.out_ann = self.add(srd.OUTPUT_ANN, 'mx25lxx05d') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/mxc6225xu/pd.py b/decoders/mxc6225xu/pd.py index e707b75..de7efaf 100644 --- a/decoders/mxc6225xu/pd.py +++ b/decoders/mxc6225xu/pd.py @@ -83,8 +83,8 @@ class Decoder(srd.Decoder): self.state = 'IDLE' def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'mxc6225xu') - self.out_ann = self.add(srd.OUTPUT_ANN, 'mxc6225xu') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/nunchuk/pd.py b/decoders/nunchuk/pd.py index 544802e..78eacea 100644 --- a/decoders/nunchuk/pd.py +++ b/decoders/nunchuk/pd.py @@ -48,8 +48,8 @@ class Decoder(srd.Decoder): self.init_seq = [] def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'nunchuk') - self.out_ann = self.add(srd.OUTPUT_ANN, 'nunchuk') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/onewire_link/pd.py b/decoders/onewire_link/pd.py index 34cd4f4..bc44ce9 100644 --- a/decoders/onewire_link/pd.py +++ b/decoders/onewire_link/pd.py @@ -92,8 +92,8 @@ class Decoder(srd.Decoder): self.rise = 0 def start(self): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'onewire_link') - self.out_ann = self.add(srd.OUTPUT_ANN, 'onewire_link') + self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def metadata(self, key, value): if key != srd.SRD_CONF_SAMPLERATE: diff --git a/decoders/onewire_network/pd.py b/decoders/onewire_network/pd.py index 1099bdc..6ab8f8e 100644 --- a/decoders/onewire_network/pd.py +++ b/decoders/onewire_network/pd.py @@ -62,8 +62,8 @@ class Decoder(srd.Decoder): self.rom = 0x0000000000000000 def start(self): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'onewire_network') - self.out_ann = self.add(srd.OUTPUT_ANN, 'onewire_network') + self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/pan1321/pd.py b/decoders/pan1321/pd.py index 42cace2..d9700b2 100644 --- a/decoders/pan1321/pd.py +++ b/decoders/pan1321/pd.py @@ -49,8 +49,8 @@ class Decoder(srd.Decoder): self.ss_block = None def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'pan1321') - self.out_ann = self.add(srd.OUTPUT_ANN, 'pan1321') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/parallel/pd.py b/decoders/parallel/pd.py index 2de9dde..9c20354 100644 --- a/decoders/parallel/pd.py +++ b/decoders/parallel/pd.py @@ -99,8 +99,8 @@ class Decoder(srd.Decoder): self.state = 'IDLE' def start(self, metadata): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'parallel') - self.out_ann = self.add(srd.OUTPUT_ANN, 'parallel') + self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/rtc8564/pd.py b/decoders/rtc8564/pd.py index e7ae036..3abd1d8 100644 --- a/decoders/rtc8564/pd.py +++ b/decoders/rtc8564/pd.py @@ -56,8 +56,8 @@ class Decoder(srd.Decoder): self.years = -1 def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'rtc8564') - self.out_ann = self.add(srd.OUTPUT_ANN, 'rtc8564') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/sdcard_spi/pd.py b/decoders/sdcard_spi/pd.py index 0d93d16..de3adbd 100644 --- a/decoders/sdcard_spi/pd.py +++ b/decoders/sdcard_spi/pd.py @@ -98,8 +98,8 @@ class Decoder(srd.Decoder): self.read_buf = [] def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'sdcard_spi') - self.out_ann = self.add(srd.OUTPUT_ANN, 'sdcard_spi') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py index b18d021..21012c1 100644 --- a/decoders/spi/pd.py +++ b/decoders/spi/pd.py @@ -106,8 +106,8 @@ class Decoder(srd.Decoder): self.samplerate = value def start(self): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'spi') - self.out_ann = self.add(srd.OUTPUT_ANN, 'spi') + self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) self.out_bitrate = self.register(srd.OUTPUT_META, meta=(int, 'Bitrate', 'Bitrate during transfers')) diff --git a/decoders/tlc5620/pd.py b/decoders/tlc5620/pd.py index 313adca..395267d 100644 --- a/decoders/tlc5620/pd.py +++ b/decoders/tlc5620/pd.py @@ -65,8 +65,8 @@ class Decoder(srd.Decoder): self.dac_select = self.gain = self.dac_value = None def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'tlc5620') - self.out_ann = self.add(srd.OUTPUT_ANN, 'tlc5620') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/transitioncounter/pd.py b/decoders/transitioncounter/pd.py index 45446e2..09164c0 100644 --- a/decoders/transitioncounter/pd.py +++ b/decoders/transitioncounter/pd.py @@ -43,8 +43,8 @@ class Decoder(srd.Decoder): self.lastsample = None def start(self): - # self.out_proto = self.add(srd.OUTPUT_PYTHON, 'transitioncounter') - self.out_ann = self.add(srd.OUTPUT_ANN, 'transitioncounter') + # self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index 32568da..8902780 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -132,8 +132,8 @@ class Decoder(srd.Decoder): self.oldpins = [1, 1] def start(self): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'uart') - self.out_ann = self.add(srd.OUTPUT_ANN, 'uart') + self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def metadata(self, key, value): if key == srd.SRD_CONF_SAMPLERATE: diff --git a/decoders/usb_packet/pd.py b/decoders/usb_packet/pd.py index 5b3c5e6..8e981ee 100644 --- a/decoders/usb_packet/pd.py +++ b/decoders/usb_packet/pd.py @@ -176,8 +176,8 @@ class Decoder(srd.Decoder): self.put(self.ss_packet, self.es_packet, self.out_ann, data) def start(self): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'usb_packet') - self.out_ann = self.add(srd.OUTPUT_ANN, 'usb_packet') + self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def report(self): pass diff --git a/decoders/usb_signalling/pd.py b/decoders/usb_signalling/pd.py index 0d21d22..3760dea 100644 --- a/decoders/usb_signalling/pd.py +++ b/decoders/usb_signalling/pd.py @@ -109,8 +109,8 @@ class Decoder(srd.Decoder): self.state = 'IDLE' def start(self): - self.out_proto = self.add(srd.OUTPUT_PYTHON, 'usb_signalling') - self.out_ann = self.add(srd.OUTPUT_ANN, 'usb_signalling') + self.out_proto = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def metadata(self, key, value): if key == srd.SRD_CONF_SAMPLERATE: diff --git a/decoders/xfp/pd.py b/decoders/xfp/pd.py index abbf626..6230523 100644 --- a/decoders/xfp/pd.py +++ b/decoders/xfp/pd.py @@ -277,7 +277,7 @@ class Decoder(srd.Decoder): } def start(self): - self.out_ann = self.add(srd.OUTPUT_ANN, 'xfp') + self.out_ann = self.register(srd.OUTPUT_ANN) def decode(self, ss, es, data): cmd, data = data