]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/timing/pd.py
uart: Immediately skip reception of parity bits when not applicable
[libsigrokdecode.git] / decoders / timing / pd.py
index 98677b9f20d0e7d3529834fef808c8665b0bc8f9..19836b0b3014cbfc00edbbdef928fc082f5778f2 100644 (file)
@@ -15,8 +15,7 @@
 ## GNU General Public License for more details.
 ##
 ## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
 ##
 
 import sigrokdecode as srd
@@ -47,7 +46,7 @@ def normalize_time(t):
         return '%f' % t
 
 class Decoder(srd.Decoder):
-    api_version = 2
+    api_version = 3
     id = 'timing'
     name = 'Timing'
     longname = 'Timing calculation with frequency and averaging'
@@ -83,12 +82,14 @@ class Decoder(srd.Decoder):
 
     def start(self):
         self.out_ann = self.register(srd.OUTPUT_ANN)
+        self.initial_pins = [0]
 
-    def decode(self, ss, es, data):
+    def decode(self):
         if not self.samplerate:
             raise SamplerateError('Cannot decode without samplerate.')
+        while True:
+            pin = self.wait({0: 'e'})
 
-        for (self.samplenum, (pin,)) in data:
             if self.oldpin is None:
                 self.oldpin = pin
                 self.last_samplenum = self.samplenum