summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2017-02-20 21:37:05 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2017-12-22 12:21:54 +0100
commit10aeb8ea8b183394cebc0033f048f49f4262b57d (patch)
treef58f049342dd6fce239514ed5dfffdbc573e3ce1
parentecb0b96d4a4d0021b41ffebec0df219338aa3724 (diff)
downloadlibsigrokdecode-10aeb8ea8b183394cebc0033f048f49f4262b57d.tar.gz
libsigrokdecode-10aeb8ea8b183394cebc0033f048f49f4262b57d.zip
all decoders: introduce a reset() method
Move initialization code of protocol decoders from the constructor to a new reset() helper method. The libsigrokdecode backend could run this method several times to clear the decoder's internal state, before new data from another acquisition gets fed to decode() calls.
-rw-r--r--decoders/ade77xx/pd.py3
-rw-r--r--decoders/adf435x/pd.py3
-rw-r--r--decoders/adns5020/pd.py3
-rw-r--r--decoders/am230x/pd.py3
-rw-r--r--decoders/arm_etmv3/pd.py3
-rw-r--r--decoders/arm_itm/pd.py3
-rw-r--r--decoders/arm_tpiu/pd.py3
-rw-r--r--decoders/aud/pd.py3
-rw-r--r--decoders/avr_isp/pd.py3
-rw-r--r--decoders/avr_pdi/pd.py3
-rw-r--r--decoders/can/pd.py3
-rw-r--r--decoders/dali/pd.py3
-rw-r--r--decoders/dcf77/pd.py3
-rw-r--r--decoders/dmx512/pd.py3
-rw-r--r--decoders/ds1307/pd.py3
-rw-r--r--decoders/ds243x/pd.py3
-rw-r--r--decoders/ds28ea00/pd.py3
-rw-r--r--decoders/dsi/pd.py3
-rw-r--r--decoders/edid/pd.py3
-rw-r--r--decoders/eeprom24xx/pd.py3
-rw-r--r--decoders/eeprom93xx/pd.py3
-rw-r--r--decoders/em4100/pd.py3
-rw-r--r--decoders/em4305/pd.py3
-rw-r--r--decoders/gpib/pd.py3
-rw-r--r--decoders/graycode/pd.py3
-rw-r--r--decoders/guess_bitrate/pd.py3
-rw-r--r--decoders/i2c/pd.py3
-rw-r--r--decoders/i2cdemux/pd.py3
-rw-r--r--decoders/i2cfilter/pd.py3
-rw-r--r--decoders/i2s/pd.py3
-rw-r--r--decoders/iec/pd.py3
-rw-r--r--decoders/ir_nec/pd.py3
-rw-r--r--decoders/ir_rc5/pd.py3
-rw-r--r--decoders/jitter/pd.py3
-rw-r--r--decoders/jtag/pd.py3
-rw-r--r--decoders/jtag_stm32/pd.py3
-rw-r--r--decoders/lm75/pd.py3
-rw-r--r--decoders/lpc/pd.py3
-rw-r--r--decoders/maple_bus/pd.py3
-rw-r--r--decoders/mdio/pd.py3
-rw-r--r--decoders/midi/pd.py3
-rw-r--r--decoders/mlx90614/pd.py3
-rw-r--r--decoders/modbus/pd.py3
-rw-r--r--decoders/morse/pd.py3
-rw-r--r--decoders/mrf24j40/pd.py3
-rw-r--r--decoders/mxc6225xu/pd.py3
-rw-r--r--decoders/nrf24l01/pd.py3
-rw-r--r--decoders/nunchuk/pd.py3
-rw-r--r--decoders/onewire_link/pd.py3
-rw-r--r--decoders/onewire_network/pd.py3
-rw-r--r--decoders/pan1321/pd.py3
-rw-r--r--decoders/parallel/pd.py3
-rw-r--r--decoders/ps2/pd.py3
-rw-r--r--decoders/pwm/pd.py3
-rw-r--r--decoders/qi/pd.py3
-rw-r--r--decoders/rfm12/pd.py3
-rw-r--r--decoders/rgb_led_spi/pd.py3
-rw-r--r--decoders/rgb_led_ws281x/pd.py3
-rw-r--r--decoders/rtc8564/pd.py3
-rw-r--r--decoders/sdcard_sd/pd.py3
-rw-r--r--decoders/sdcard_spi/pd.py3
-rw-r--r--decoders/spdif/pd.py3
-rw-r--r--decoders/spi/pd.py3
-rw-r--r--decoders/spiflash/pd.py3
-rw-r--r--decoders/ssi32/pd.py3
-rw-r--r--decoders/stepper_motor/pd.py3
-rw-r--r--decoders/swd/pd.py3
-rw-r--r--decoders/t55xx/pd.py3
-rw-r--r--decoders/tca6408a/pd.py3
-rw-r--r--decoders/timing/pd.py3
-rw-r--r--decoders/tlc5620/pd.py3
-rw-r--r--decoders/uart/pd.py3
-rw-r--r--decoders/usb_packet/pd.py3
-rw-r--r--decoders/usb_power_delivery/pd.py3
-rw-r--r--decoders/usb_request/pd.py3
-rw-r--r--decoders/usb_signalling/pd.py3
-rw-r--r--decoders/wiegand/pd.py3
-rw-r--r--decoders/xfp/pd.py3
-rw-r--r--decoders/z80/pd.py3
79 files changed, 237 insertions, 0 deletions
diff --git a/decoders/ade77xx/pd.py b/decoders/ade77xx/pd.py
index 32a431b..0dfd7c8 100644
--- a/decoders/ade77xx/pd.py
+++ b/decoders/ade77xx/pd.py
@@ -50,6 +50,9 @@ class Decoder(srd.Decoder):
self.mosi_bytes, self.miso_bytes = [], []
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ss_cmd, self.es_cmd = 0, 0
self.reset_data()
diff --git a/decoders/adf435x/pd.py b/decoders/adf435x/pd.py
index a17eb84..dcc08de 100644
--- a/decoders/adf435x/pd.py
+++ b/decoders/adf435x/pd.py
@@ -105,6 +105,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.bits = []
def start(self):
diff --git a/decoders/adns5020/pd.py b/decoders/adns5020/pd.py
index 0ee3f8b..55f6853 100644
--- a/decoders/adns5020/pd.py
+++ b/decoders/adns5020/pd.py
@@ -59,6 +59,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ss_cmd, self.es_cmd = 0, 0
self.mosi_bytes = []
diff --git a/decoders/am230x/pd.py b/decoders/am230x/pd.py
index 0e4eac8..81c1f28 100644
--- a/decoders/am230x/pd.py
+++ b/decoders/am230x/pd.py
@@ -122,6 +122,9 @@ class Decoder(srd.Decoder):
return checksum % 256
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.reset_variables()
diff --git a/decoders/arm_etmv3/pd.py b/decoders/arm_etmv3/pd.py
index 8a2a8bb..8de3ce2 100644
--- a/decoders/arm_etmv3/pd.py
+++ b/decoders/arm_etmv3/pd.py
@@ -170,6 +170,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.buf = []
self.syncbuf = []
self.prevsample = 0
diff --git a/decoders/arm_itm/pd.py b/decoders/arm_itm/pd.py
index 15ffe72..5970f27 100644
--- a/decoders/arm_itm/pd.py
+++ b/decoders/arm_itm/pd.py
@@ -80,6 +80,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.buf = []
self.syncbuf = []
self.swpackets = {}
diff --git a/decoders/arm_tpiu/pd.py b/decoders/arm_tpiu/pd.py
index efacb27..f50af65 100644
--- a/decoders/arm_tpiu/pd.py
+++ b/decoders/arm_tpiu/pd.py
@@ -42,6 +42,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.buf = []
self.syncbuf = []
self.prevsample = 0
diff --git a/decoders/aud/pd.py b/decoders/aud/pd.py
index baa920e..30c32f5 100644
--- a/decoders/aud/pd.py
+++ b/decoders/aud/pd.py
@@ -46,6 +46,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ncnt = 0
self.nmax = 0
self.addr = 0
diff --git a/decoders/avr_isp/pd.py b/decoders/avr_isp/pd.py
index 9c8647d..2530e8c 100644
--- a/decoders/avr_isp/pd.py
+++ b/decoders/avr_isp/pd.py
@@ -51,6 +51,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.mosi_bytes, self.miso_bytes = [], []
self.ss_cmd, self.es_cmd = 0, 0
diff --git a/decoders/avr_pdi/pd.py b/decoders/avr_pdi/pd.py
index fcb73af..7fedbbd 100644
--- a/decoders/avr_pdi/pd.py
+++ b/decoders/avr_pdi/pd.py
@@ -154,6 +154,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.clear_state()
diff --git a/decoders/can/pd.py b/decoders/can/pd.py
index 5be3e99..056736b 100644
--- a/decoders/can/pd.py
+++ b/decoders/can/pd.py
@@ -65,6 +65,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.reset_variables()
diff --git a/decoders/dali/pd.py b/decoders/dali/pd.py
index 904adc7..5dd577d 100644
--- a/decoders/dali/pd.py
+++ b/decoders/dali/pd.py
@@ -56,6 +56,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.samplenum = None
self.edges, self.bits, self.ss_es_bits = [], [], []
diff --git a/decoders/dcf77/pd.py b/decoders/dcf77/pd.py
index a4e87f6..7b180ce 100644
--- a/decoders/dcf77/pd.py
+++ b/decoders/dcf77/pd.py
@@ -65,6 +65,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.state = 'WAIT FOR RISING EDGE'
self.ss_bit = self.ss_bit_old = self.es_bit = self.ss_block = 0
diff --git a/decoders/dmx512/pd.py b/decoders/dmx512/pd.py
index f250a3b..1bcca20 100644
--- a/decoders/dmx512/pd.py
+++ b/decoders/dmx512/pd.py
@@ -52,6 +52,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.sample_usec = None
self.run_start = -1
diff --git a/decoders/ds1307/pd.py b/decoders/ds1307/pd.py
index 560d94d..414da65 100644
--- a/decoders/ds1307/pd.py
+++ b/decoders/ds1307/pd.py
@@ -75,6 +75,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.hours = -1
self.minutes = -1
diff --git a/decoders/ds243x/pd.py b/decoders/ds243x/pd.py
index 05313dc..c7869a8 100644
--- a/decoders/ds243x/pd.py
+++ b/decoders/ds243x/pd.py
@@ -77,6 +77,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
# Bytes for function command.
self.bytes = []
self.family_code = None
diff --git a/decoders/ds28ea00/pd.py b/decoders/ds28ea00/pd.py
index 2ae9469..a792d95 100644
--- a/decoders/ds28ea00/pd.py
+++ b/decoders/ds28ea00/pd.py
@@ -48,6 +48,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.trn_beg = 0
self.trn_end = 0
self.state = 'ROM'
diff --git a/decoders/dsi/pd.py b/decoders/dsi/pd.py
index 5b473be..c5d9bf9 100644
--- a/decoders/dsi/pd.py
+++ b/decoders/dsi/pd.py
@@ -51,6 +51,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.samplenum = None
self.edges, self.bits, self.ss_es_bits = [], [], []
diff --git a/decoders/edid/pd.py b/decoders/edid/pd.py
index baf2263..e73884e 100644
--- a/decoders/edid/pd.py
+++ b/decoders/edid/pd.py
@@ -91,6 +91,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = None
# Received data items, used as an index into samplenum/data
self.cnt = 0
diff --git a/decoders/eeprom24xx/pd.py b/decoders/eeprom24xx/pd.py
index e7b344c..49c586d 100644
--- a/decoders/eeprom24xx/pd.py
+++ b/decoders/eeprom24xx/pd.py
@@ -73,6 +73,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.reset_variables()
def start(self):
diff --git a/decoders/eeprom93xx/pd.py b/decoders/eeprom93xx/pd.py
index 82c1ae8..d76b869 100644
--- a/decoders/eeprom93xx/pd.py
+++ b/decoders/eeprom93xx/pd.py
@@ -43,6 +43,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.frame = []
def start(self):
diff --git a/decoders/em4100/pd.py b/decoders/em4100/pd.py
index 711c0fa..778cfd1 100644
--- a/decoders/em4100/pd.py
+++ b/decoders/em4100/pd.py
@@ -62,6 +62,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.oldpin = None
self.last_samplenum = None
diff --git a/decoders/em4305/pd.py b/decoders/em4305/pd.py
index 895ee15..9fac9c6 100644
--- a/decoders/em4305/pd.py
+++ b/decoders/em4305/pd.py
@@ -65,6 +65,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.last_samplenum = None
self.state = 'FFS_SEARCH'
diff --git a/decoders/gpib/pd.py b/decoders/gpib/pd.py
index 01801bc..d131cb9 100644
--- a/decoders/gpib/pd.py
+++ b/decoders/gpib/pd.py
@@ -61,6 +61,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.items = []
self.itemcount = 0
self.saved_item = None
diff --git a/decoders/graycode/pd.py b/decoders/graycode/pd.py
index f500c83..1211c69 100644
--- a/decoders/graycode/pd.py
+++ b/decoders/graycode/pd.py
@@ -101,6 +101,9 @@ class Decoder(srd.Decoder):
annotation_rows = tuple((u, v, (i,)) for i, (u, v) in enumerate(annotations))
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.num_channels = 0
self.samplerate = None
self.last_n = deque()
diff --git a/decoders/guess_bitrate/pd.py b/decoders/guess_bitrate/pd.py
index e8390c6..7a3121a 100644
--- a/decoders/guess_bitrate/pd.py
+++ b/decoders/guess_bitrate/pd.py
@@ -42,6 +42,9 @@ class Decoder(srd.Decoder):
self.put(self.ss_edge, self.samplenum, self.out_ann, data)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ss_edge = None
def start(self):
diff --git a/decoders/i2c/pd.py b/decoders/i2c/pd.py
index d0c2ea7..7f8960d 100644
--- a/decoders/i2c/pd.py
+++ b/decoders/i2c/pd.py
@@ -108,6 +108,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.ss = self.es = self.ss_byte = -1
self.bitcount = 0
diff --git a/decoders/i2cdemux/pd.py b/decoders/i2cdemux/pd.py
index c6ab53d..2495e84 100644
--- a/decoders/i2cdemux/pd.py
+++ b/decoders/i2cdemux/pd.py
@@ -30,6 +30,9 @@ class Decoder(srd.Decoder):
outputs = [] # TODO: Only known at run-time.
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.packets = [] # Local cache of I²C packets
self.slaves = [] # List of known slave addresses
self.stream = -1 # Current output stream
diff --git a/decoders/i2cfilter/pd.py b/decoders/i2cfilter/pd.py
index af09c49..1dc7fd1 100644
--- a/decoders/i2cfilter/pd.py
+++ b/decoders/i2cfilter/pd.py
@@ -39,6 +39,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.curslave = -1
self.curdirection = None
self.packets = [] # Local cache of I²C packets
diff --git a/decoders/i2s/pd.py b/decoders/i2s/pd.py
index beee079..91801b4 100644
--- a/decoders/i2s/pd.py
+++ b/decoders/i2s/pd.py
@@ -60,6 +60,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.oldws = 1
self.bitcount = 0
diff --git a/decoders/iec/pd.py b/decoders/iec/pd.py
index 0b34391..06fdc7a 100644
--- a/decoders/iec/pd.py
+++ b/decoders/iec/pd.py
@@ -55,6 +55,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.saved_ATN = False
self.saved_EOI = False
self.ss_item = self.es_item = None
diff --git a/decoders/ir_nec/pd.py b/decoders/ir_nec/pd.py
index 84b2e70..0362609 100644
--- a/decoders/ir_nec/pd.py
+++ b/decoders/ir_nec/pd.py
@@ -99,6 +99,9 @@ class Decoder(srd.Decoder):
'%s' % btn[1]]])
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.ss_bit = self.ss_start = self.ss_other_edge = self.ss_remote = 0
self.data = self.count = self.active = None
diff --git a/decoders/ir_rc5/pd.py b/decoders/ir_rc5/pd.py
index edb29bd..60a9416 100644
--- a/decoders/ir_rc5/pd.py
+++ b/decoders/ir_rc5/pd.py
@@ -56,6 +56,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.samplenum = None
self.edges, self.bits, self.ss_es_bits = [], [], []
diff --git a/decoders/jitter/pd.py b/decoders/jitter/pd.py
index 04a2577..f492a9f 100644
--- a/decoders/jitter/pd.py
+++ b/decoders/jitter/pd.py
@@ -63,6 +63,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'CLK'
self.samplerate = None
self.oldclk, self.oldsig = 0, 0
diff --git a/decoders/jtag/pd.py b/decoders/jtag/pd.py
index 4ad11c4..7f784eb 100644
--- a/decoders/jtag/pd.py
+++ b/decoders/jtag/pd.py
@@ -88,6 +88,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
# self.state = 'TEST-LOGIC-RESET'
self.state = 'RUN-TEST/IDLE'
self.oldstate = None
diff --git a/decoders/jtag_stm32/pd.py b/decoders/jtag_stm32/pd.py
index 4cc39e0..d27a557 100644
--- a/decoders/jtag_stm32/pd.py
+++ b/decoders/jtag_stm32/pd.py
@@ -156,6 +156,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.samplenums = None
diff --git a/decoders/lm75/pd.py b/decoders/lm75/pd.py
index d65fb4d..29237d7 100644
--- a/decoders/lm75/pd.py
+++ b/decoders/lm75/pd.py
@@ -62,6 +62,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.reg = 0x00 # Currently selected register
self.databytes = []
diff --git a/decoders/lpc/pd.py b/decoders/lpc/pd.py
index c737544..7242208 100644
--- a/decoders/lpc/pd.py
+++ b/decoders/lpc/pd.py
@@ -136,6 +136,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.oldlclk = -1
self.samplenum = 0
diff --git a/decoders/maple_bus/pd.py b/decoders/maple_bus/pd.py
index 861b3f8..8306061 100644
--- a/decoders/maple_bus/pd.py
+++ b/decoders/maple_bus/pd.py
@@ -73,6 +73,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
pass
def start(self):
diff --git a/decoders/mdio/pd.py b/decoders/mdio/pd.py
index 7c2fc5f..3580acc 100644
--- a/decoders/mdio/pd.py
+++ b/decoders/mdio/pd.py
@@ -62,6 +62,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.illegal_bus = 0
self.samplenum = -1
self.clause45_addr = -1 # Clause 45 is context sensitive.
diff --git a/decoders/midi/pd.py b/decoders/midi/pd.py
index c2d3f72..feb581c 100644
--- a/decoders/midi/pd.py
+++ b/decoders/midi/pd.py
@@ -44,6 +44,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.status_byte = 0
self.explicit_status_byte = False
diff --git a/decoders/mlx90614/pd.py b/decoders/mlx90614/pd.py
index 1f627e6..60927f7 100644
--- a/decoders/mlx90614/pd.py
+++ b/decoders/mlx90614/pd.py
@@ -34,6 +34,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IGNORE START REPEAT'
self.data = []
diff --git a/decoders/modbus/pd.py b/decoders/modbus/pd.py
index 2404312..d2307b9 100644
--- a/decoders/modbus/pd.py
+++ b/decoders/modbus/pd.py
@@ -847,6 +847,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ADUSc = None # Start off with empty slave -> client ADU.
self.ADUCs = None # Start off with empty client -> slave ADU.
diff --git a/decoders/morse/pd.py b/decoders/morse/pd.py
index 588394d..a1e3c23 100644
--- a/decoders/morse/pd.py
+++ b/decoders/morse/pd.py
@@ -137,6 +137,9 @@ class Decoder(srd.Decoder):
annotation_rows = tuple((u, v, (i,)) for i, (u, v) in enumerate(annotations))
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
def metadata(self, key, value):
diff --git a/decoders/mrf24j40/pd.py b/decoders/mrf24j40/pd.py
index e195b18..8ccf473 100644
--- a/decoders/mrf24j40/pd.py
+++ b/decoders/mrf24j40/pd.py
@@ -43,6 +43,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ss_cmd, self.es_cmd = 0, 0
self.mosi_bytes = []
self.miso_bytes = []
diff --git a/decoders/mxc6225xu/pd.py b/decoders/mxc6225xu/pd.py
index 34482cd..1e90455 100644
--- a/decoders/mxc6225xu/pd.py
+++ b/decoders/mxc6225xu/pd.py
@@ -72,6 +72,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
def start(self):
diff --git a/decoders/nrf24l01/pd.py b/decoders/nrf24l01/pd.py
index 02cdddb..221b968 100644
--- a/decoders/nrf24l01/pd.py
+++ b/decoders/nrf24l01/pd.py
@@ -94,6 +94,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.next()
self.requirements_met = True
self.cs_was_released = False
diff --git a/decoders/nunchuk/pd.py b/decoders/nunchuk/pd.py
index de6e157..4f006f2 100644
--- a/decoders/nunchuk/pd.py
+++ b/decoders/nunchuk/pd.py
@@ -47,6 +47,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.sx = self.sy = self.ax = self.ay = self.az = self.bz = self.bc = -1
self.databytecount = 0
diff --git a/decoders/onewire_link/pd.py b/decoders/onewire_link/pd.py
index ca32415..72aea83 100644
--- a/decoders/onewire_link/pd.py
+++ b/decoders/onewire_link/pd.py
@@ -118,6 +118,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.state = 'INITIAL'
self.present = 0
diff --git a/decoders/onewire_network/pd.py b/decoders/onewire_network/pd.py
index 323da0b..5d850b5 100644
--- a/decoders/onewire_network/pd.py
+++ b/decoders/onewire_network/pd.py
@@ -45,6 +45,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ss_block = 0
self.es_block = 0
self.state = 'COMMAND'
diff --git a/decoders/pan1321/pd.py b/decoders/pan1321/pd.py
index c1a3bea..ecaa680 100644
--- a/decoders/pan1321/pd.py
+++ b/decoders/pan1321/pd.py
@@ -39,6 +39,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.cmd = ['', '']
self.ss_block = None
diff --git a/decoders/parallel/pd.py b/decoders/parallel/pd.py
index c8ac2b0..140b7b8 100644
--- a/decoders/parallel/pd.py
+++ b/decoders/parallel/pd.py
@@ -88,6 +88,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.items = []
self.itemcount = 0
self.saved_item = None
diff --git a/decoders/ps2/pd.py b/decoders/ps2/pd.py
index 1a7f0be..6ed04c8 100644
--- a/decoders/ps2/pd.py
+++ b/decoders/ps2/pd.py
@@ -53,6 +53,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.bits = []
self.samplenum = 0
self.bitcount = 0
diff --git a/decoders/pwm/pd.py b/decoders/pwm/pd.py
index 444b417..2301523 100644
--- a/decoders/pwm/pd.py
+++ b/decoders/pwm/pd.py
@@ -49,6 +49,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ss_block = self.es_block = None
def metadata(self, key, value):
diff --git a/decoders/qi/pd.py b/decoders/qi/pd.py
index 779cafa..cb46dba 100644
--- a/decoders/qi/pd.py
+++ b/decoders/qi/pd.py
@@ -73,6 +73,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.reset_variables()
diff --git a/decoders/rfm12/pd.py b/decoders/rfm12/pd.py
index 3148a57..e709696 100644
--- a/decoders/rfm12/pd.py
+++ b/decoders/rfm12/pd.py
@@ -43,6 +43,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.mosi_bytes, self.miso_bytes = [], []
self.mosi_bits, self.miso_bits = [], []
self.row_pos = [0, 0, 0]
diff --git a/decoders/rgb_led_spi/pd.py b/decoders/rgb_led_spi/pd.py
index 95cbf19..d087556 100644
--- a/decoders/rgb_led_spi/pd.py
+++ b/decoders/rgb_led_spi/pd.py
@@ -33,6 +33,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ss_cmd, self.es_cmd = 0, 0
self.mosi_bytes = []
diff --git a/decoders/rgb_led_ws281x/pd.py b/decoders/rgb_led_ws281x/pd.py
index 5cf2124..b4f7c58 100644
--- a/decoders/rgb_led_ws281x/pd.py
+++ b/decoders/rgb_led_ws281x/pd.py
@@ -46,6 +46,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.oldpin = None
self.ss_packet = None
diff --git a/decoders/rtc8564/pd.py b/decoders/rtc8564/pd.py
index 8560ac7..3a9dca0 100644
--- a/decoders/rtc8564/pd.py
+++ b/decoders/rtc8564/pd.py
@@ -52,6 +52,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.hours = -1
self.minutes = -1
diff --git a/decoders/sdcard_sd/pd.py b/decoders/sdcard_sd/pd.py
index 2382a15..9402f7e 100644
--- a/decoders/sdcard_sd/pd.py
+++ b/decoders/sdcard_sd/pd.py
@@ -61,6 +61,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'GET COMMAND TOKEN'
self.token = []
self.is_acmd = False # Indicates CMD vs. ACMD
diff --git a/decoders/sdcard_spi/pd.py b/decoders/sdcard_spi/pd.py
index 478dfc8..7c59634 100644
--- a/decoders/sdcard_spi/pd.py
+++ b/decoders/sdcard_spi/pd.py
@@ -46,6 +46,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.ss, self.es = 0, 0
self.ss_bit, self.es_bit = 0, 0
diff --git a/decoders/spdif/pd.py b/decoders/spdif/pd.py
index 0c535e4..add2834 100644
--- a/decoders/spdif/pd.py
+++ b/decoders/spdif/pd.py
@@ -58,6 +58,9 @@ class Decoder(srd.Decoder):
self.put(self.ss_edge, self.samplenum, self.out_ann, data)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'GET FIRST PULSE WIDTH'
self.ss_edge = None
self.first_edge = True
diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py
index 7b979f0..32fe8da 100644
--- a/decoders/spi/pd.py
+++ b/decoders/spi/pd.py
@@ -121,6 +121,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.bitcount = 0
self.misodata = self.mosidata = 0
diff --git a/decoders/spiflash/pd.py b/decoders/spiflash/pd.py
index 8e2b041..07934c5 100644
--- a/decoders/spiflash/pd.py
+++ b/decoders/spiflash/pd.py
@@ -98,6 +98,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.device_id = -1
self.on_end_transaction = None
self.end_current_transaction()
diff --git a/decoders/ssi32/pd.py b/decoders/ssi32/pd.py
index dbcdf64..f2685e2 100644
--- a/decoders/ssi32/pd.py
+++ b/decoders/ssi32/pd.py
@@ -46,6 +46,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.ss_cmd, self.es_cmd = 0, 0
self.mosi_bytes = []
self.miso_bytes = []
diff --git a/decoders/stepper_motor/pd.py b/decoders/stepper_motor/pd.py
index 52e3e63..9ddc645 100644
--- a/decoders/stepper_motor/pd.py
+++ b/decoders/stepper_motor/pd.py
@@ -50,6 +50,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.oldstep = None
self.ss_prev_step = None
self.pos = 0
diff --git a/decoders/swd/pd.py b/decoders/swd/pd.py
index 22aad45..0f7bc22 100644
--- a/decoders/swd/pd.py
+++ b/decoders/swd/pd.py
@@ -92,6 +92,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
# SWD data/clock state
self.state = 'UNKNOWN'
self.sample_edge = RISING
diff --git a/decoders/t55xx/pd.py b/decoders/t55xx/pd.py
index 5a7611a..07df9c2 100644
--- a/decoders/t55xx/pd.py
+++ b/decoders/t55xx/pd.py
@@ -66,6 +66,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.last_samplenum = None
self.lastlast_samplenum = None
diff --git a/decoders/tca6408a/pd.py b/decoders/tca6408a/pd.py
index 73de1b9..0e60767 100644
--- a/decoders/tca6408a/pd.py
+++ b/decoders/tca6408a/pd.py
@@ -41,6 +41,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
self.chip = -1
diff --git a/decoders/timing/pd.py b/decoders/timing/pd.py
index ab963bb..61eab1e 100644
--- a/decoders/timing/pd.py
+++ b/decoders/timing/pd.py
@@ -74,6 +74,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.last_samplenum = None
self.last_n = deque()
diff --git a/decoders/tlc5620/pd.py b/decoders/tlc5620/pd.py
index 3ca1415..6fe8ae1 100644
--- a/decoders/tlc5620/pd.py
+++ b/decoders/tlc5620/pd.py
@@ -71,6 +71,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.bits = []
self.ss_dac_first = None
self.ss_dac = self.es_dac = 0
diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py
index 16729cc..8993271 100644
--- a/decoders/uart/pd.py
+++ b/decoders/uart/pd.py
@@ -160,6 +160,9 @@ class Decoder(srd.Decoder):
self.put(s - floor(halfbit), self.samplenum + ceil(halfbit), self.out_binary, data)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.samplenum = 0
self.frame_start = [-1, -1]
diff --git a/decoders/usb_packet/pd.py b/decoders/usb_packet/pd.py
index 3983f2c..489e58e 100644
--- a/decoders/usb_packet/pd.py
+++ b/decoders/usb_packet/pd.py
@@ -222,6 +222,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.bits = []
self.packet = []
self.packet_summary = ''
diff --git a/decoders/usb_power_delivery/pd.py b/decoders/usb_power_delivery/pd.py
index 3258ac3..a2d6b4d 100644
--- a/decoders/usb_power_delivery/pd.py
+++ b/decoders/usb_power_delivery/pd.py
@@ -439,6 +439,9 @@ class Decoder(srd.Decoder):
return -1 # No Start Of Packet
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.idx = 0
self.packet_seq = 0
diff --git a/decoders/usb_request/pd.py b/decoders/usb_request/pd.py
index 1bd2878..a480284 100644
--- a/decoders/usb_request/pd.py
+++ b/decoders/usb_request/pd.py
@@ -136,6 +136,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.request = {}
self.request_id = 0
diff --git a/decoders/usb_signalling/pd.py b/decoders/usb_signalling/pd.py
index 7a885c0..424117d 100644
--- a/decoders/usb_signalling/pd.py
+++ b/decoders/usb_signalling/pd.py
@@ -135,6 +135,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.samplerate = None
self.oldsym = 'J' # The "idle" state is J.
self.ss_block = None
diff --git a/decoders/wiegand/pd.py b/decoders/wiegand/pd.py
index 3edefc5..ea873ea 100644
--- a/decoders/wiegand/pd.py
+++ b/decoders/wiegand/pd.py
@@ -48,6 +48,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self._samples_per_bit = 10
self._d0_prev = None
diff --git a/decoders/xfp/pd.py b/decoders/xfp/pd.py
index fcadab9..0bc6724 100644
--- a/decoders/xfp/pd.py
+++ b/decoders/xfp/pd.py
@@ -37,6 +37,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
# Received data items, used as an index into samplenum/data
self.cnt = -1
# Start/end sample numbers per data item
diff --git a/decoders/z80/pd.py b/decoders/z80/pd.py
index 76e1858..b7ff9a5 100644
--- a/decoders/z80/pd.py
+++ b/decoders/z80/pd.py
@@ -111,6 +111,9 @@ class Decoder(srd.Decoder):
)
def __init__(self):
+ self.reset()
+
+ def reset(self):
self.prev_cycle = Cycle.NONE
self.op_state = self.state_IDLE