diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2014-08-16 21:19:05 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2014-08-16 21:37:21 +0200 |
commit | 7d74799011f28796bbb8165dc3bcd4c8cca12052 (patch) | |
tree | 7300efa5a324a5c768a5ffd3d31b8659bc81438c | |
parent | 53908ef10d1c5e3d77c3551703fa1633303b9242 (diff) | |
download | libsigrokdecode-7d74799011f28796bbb8165dc3bcd4c8cca12052.tar.gz libsigrokdecode-7d74799011f28796bbb8165dc3bcd4c8cca12052.zip |
ds1307: Correctly handle address wrap-around.
-rw-r--r-- | decoders/ds1307/pd.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/decoders/ds1307/pd.py b/decoders/ds1307/pd.py index d9aa3d5..ca6faf6 100644 --- a/decoders/ds1307/pd.py +++ b/decoders/ds1307/pd.py @@ -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 |