]> sigrok.org Git - libsigrokdecode.git/commitdiff
ds1307: Correctly handle address wrap-around.
authorUwe Hermann <redacted>
Sat, 16 Aug 2014 19:19:05 +0000 (21:19 +0200)
committerUwe Hermann <redacted>
Sat, 16 Aug 2014 19:37:21 +0000 (21:37 +0200)
decoders/ds1307/pd.py

index d9aa3d5805f1fd1ed9bddc741bb9d788b03f3647..ca6faf6c92c9ea199912dce2e95f9fa6878813fd 100644 (file)
@@ -187,7 +187,11 @@ class Decoder(srd.Decoder):
         r = self.reg if self.reg < 8 else 0x3f
         fn = getattr(self, 'handle_reg_0x%02x' % r)
         fn(b)
+        # Honor address auto-increment feature of the DS1307. When the
+        # address reaches 0x3f, it will wrap around to address 0.
         self.reg += 1
+        if self.reg > 0x3f:
+            self.reg = 0
 
     def decode(self, ss, es, data):
         cmd, databyte = data