]> sigrok.org Git - libsigrokdecode.git/commitdiff
srd: decoders: Rename obsolete timeoffset/duration.
authorUwe Hermann <redacted>
Thu, 12 Jan 2012 21:49:41 +0000 (22:49 +0100)
committerUwe Hermann <redacted>
Thu, 12 Jan 2012 21:49:41 +0000 (22:49 +0100)
decoders/ddc.py
decoders/i2c.py
decoders/mx25lxx05d.py
decoders/nunchuk.py
decoders/spi.py
decoders/srd_usb.py
decoders/transitioncounter.py
decoders/uart.py

index cdeae6dafcee752827a5fd6c2fc4e5fb44e4b948..9b5bc5fdd525a053892993a8e32362c12305792d 100644 (file)
@@ -52,9 +52,9 @@ class Decoder(srd.Decoder):
     def start(self, metadata):
         self.out_ann = self.add(srd.OUTPUT_ANN, 'ddc')
 
     def start(self, metadata):
         self.out_ann = self.add(srd.OUTPUT_ANN, 'ddc')
 
-    def decode(self, start_sample, end_sample, i2c_data):
+    def decode(self, ss, es, data):
         try:
         try:
-            cmd, data, ack_bit = i2c_data
+            cmd, data, ack_bit = data
         except Exception as e:
             raise Exception('malformed I2C input: %s' % str(e)) from e
 
         except Exception as e:
             raise Exception('malformed I2C input: %s' % str(e)) from e
 
@@ -74,6 +74,5 @@ class Decoder(srd.Decoder):
             if cmd == 'DATA_READ':
                 # There shouldn't be anything but data reads on this
                 # address, so ignore everything else.
             if cmd == 'DATA_READ':
                 # There shouldn't be anything but data reads on this
                 # address, so ignore everything else.
-                self.put(start_sample, end_sample, self.out_ann,
-                         [0, ['0x%.2x' % data]])
+                self.put(ss, es, self.out_ann, [0, ['0x%.2x' % data]])
 
 
index 967899ed5c24d282e86809403a0aa2b5f2398ba0..cfaacb0f86864b916fffe7778f4a922b6560afc6 100644 (file)
@@ -269,7 +269,7 @@ class Decoder(srd.Decoder):
         # TODO: 0-0 sample range for now.
         super(Decoder, self).put(0, 0, output_id, data)
 
         # TODO: 0-0 sample range for now.
         super(Decoder, self).put(0, 0, output_id, data)
 
-    def decode(self, timeoffset, duration, data):
+    def decode(self, ss, es, data):
         for samplenum, (scl, sda) in data:
             self.samplecnt += 1
 
         for samplenum, (scl, sda) in data:
             self.samplecnt += 1
 
index 82a43cfd4fda438a912066b8849850ef9336d2a6..8055c638668413f29c73d3aced9b563f16af8284 100644 (file)
@@ -310,7 +310,7 @@ class Decoder(srd.Decoder):
 
         self.out += o
 
 
         self.out += o
 
-    def decode(self, timeoffset, duration, data):
+    def decode(self, ss, es, data):
         self.out = []
 
         # Iterate over all SPI MISO/MOSI packets. TODO: HOLD#, WP#/ACC?
         self.out = []
 
         # Iterate over all SPI MISO/MOSI packets. TODO: HOLD#, WP#/ACC?
index 8bf0228e03b5b722970cd5c207422e1cd8b063ba..bda374522e43bce637597b98a67dceaff659c055 100644 (file)
@@ -91,7 +91,7 @@ class Decoder(srd.Decoder):
     def report(self):
         pass
 
     def report(self):
         pass
 
-    def decode(self, timeoffset, duration, data):
+    def decode(self, ss, es, data):
         out = []
         o = {}
 
         out = []
         o = {}
 
index e6a59bf6cbdda9e49482ddc0d3667f8fea2e3d00..662b059afc766cfafa754c805c3c73ac061f316d 100644 (file)
@@ -51,7 +51,7 @@ class Decoder(srd.Decoder):
     def report(self):
         return 'SPI: %d bytes received' % self.bytesreceived
 
     def report(self):
         return 'SPI: %d bytes received' % self.bytesreceived
 
-    def decode(self, timeoffset, duration, data):
+    def decode(self, ss, es, data):
         # HACK! At the moment the number of probes is not handled correctly.
         # E.g. if an input file (-i foo.sr) has more than two probes enabled.
         for (samplenum, (sdata, sck, x, y, z, a)) in data:
         # HACK! At the moment the number of probes is not handled correctly.
         # E.g. if an input file (-i foo.sr) has more than two probes enabled.
         for (samplenum, (sdata, sck, x, y, z, a)) in data:
@@ -65,7 +65,7 @@ class Decoder(srd.Decoder):
 
             # If this is first bit, save timestamp
             if self.rxcount == 0:
 
             # If this is first bit, save timestamp
             if self.rxcount == 0:
-                self.time = timeoffset # FIXME
+                self.time = ss # FIXME
             # Receive bit into our shift register
             if sdata:
                 self.rxdata |= 1 << (7 - self.rxcount)
             # Receive bit into our shift register
             if sdata:
                 self.rxdata |= 1 << (7 - self.rxcount)
@@ -74,8 +74,8 @@ class Decoder(srd.Decoder):
             if self.rxcount != 8:
                 continue
             # Received a byte, pass up to sigrok
             if self.rxcount != 8:
                 continue
             # Received a byte, pass up to sigrok
-            outdata = {'time':self.time,
-                'duration':timeoffset + duration - self.time,
+            outdata = {'time':self.time, # FIXME
+                'duration':ss + es - self.time, # FIXME
                 'data':self.rxdata,
                 'display':('%02X' % self.rxdata),
                 'type':'spi',
                 'data':self.rxdata,
                 'display':('%02X' % self.rxdata),
                 'type':'spi',
index 9998e5b1550b2fa370f55402e3397029a46eb34a..25736395e4463019ad68e4fb9c4e49def3654e1e 100644 (file)
@@ -133,7 +133,7 @@ class Decoder(srd.Decoder):
         self.scount = 0
         self.packet = ''
 
         self.scount = 0
         self.packet = ''
 
-    def decode(self, timeoffset, duration, data):
+    def decode(self, ss, es, data):
         out = []
 
         # FIXME
         out = []
 
         # FIXME
index 40fa3a899041420269d91e4f156c8a3dc3c1697f..2247248bee6e99c21c82c782fd46ded30d81e9ab 100644 (file)
@@ -46,7 +46,7 @@ class Decoder(srd.Decoder):
     def report(self):
         pass
 
     def report(self):
         pass
 
-    def decode(self, timeoffset, duration, data):
+    def decode(self, ss, es, data):
 
         for (samplenum, s) in data:
 
 
         for (samplenum, s) in data:
 
index 9243bbc3e33741e38ec09e033dd88258aa5bb3a3..f0f3bf85065eda1fc3f9a3e1a7ea595f550f72db 100644 (file)
@@ -416,7 +416,7 @@ class Decoder(srd.Decoder):
         self.put(self.samplenum, self.samplenum, self.out_ann,
                  [ANN_ASCII, ['Stop bit', 'Stop', 'P']])
 
         self.put(self.samplenum, self.samplenum, self.out_ann,
                  [ANN_ASCII, ['Stop bit', 'Stop', 'P']])
 
-    def decode(self, timeoffset, duration, data): # TODO
+    def decode(self, ss, es, data): # TODO
         # for (samplenum, (rx, tx)) in data:
         for (samplenum, (rx,)) in data:
 
         # for (samplenum, (rx, tx)) in data:
         for (samplenum, (rx,)) in data: