From: Uwe Hermann Date: Sat, 16 Aug 2014 19:03:00 +0000 (+0200) Subject: ds1307: Handle SRAM register accesses. X-Git-Tag: libsigrokdecode-0.4.0~187 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=903e9b14c84400579e0d786b7a96e9e587b5849b;p=libsigrokdecode.git ds1307: Handle SRAM register accesses. --- diff --git a/decoders/ds1307/pd.py b/decoders/ds1307/pd.py index d718c93..2447af5 100644 --- a/decoders/ds1307/pd.py +++ b/decoders/ds1307/pd.py @@ -171,6 +171,10 @@ class Decoder(srd.Decoder): 'Square wave rate: %s' % r, 'SQW rate: %s' % r, 'Rate: %s' % r, 'RS: %s' % s, 'RS', 'R']]) + def handle_reg_0x3f(self, b): # RAM (bytes 0x08-0x3f) + self.putd(7, 0, [8, ['RAM', 'R']]) + self.putd(7, 0, [23, ['SRAM: 0x%02X' % b, '0x%02X' % b]]) + def decode(self, ss, es, data): cmd, databyte = data @@ -209,7 +213,8 @@ class Decoder(srd.Decoder): return # Otherwise: Get data bytes until a STOP condition occurs. if cmd == 'DATA WRITE': - handle_reg = getattr(self, 'handle_reg_0x%02x' % self.reg) + r = self.reg if self.reg < 8 else 0x3f + handle_reg = getattr(self, 'handle_reg_0x%02x' % r) handle_reg(databyte) self.reg += 1 # TODO: Check for NACK! @@ -233,7 +238,8 @@ class Decoder(srd.Decoder): pass # TODO elif self.state == 'READ RTC REGS2': if cmd == 'DATA READ': - handle_reg = getattr(self, 'handle_reg_0x%02x' % self.reg) + r = self.reg if self.reg < 8 else 0x3f + handle_reg = getattr(self, 'handle_reg_0x%02x' % r) handle_reg(databyte) self.reg += 1 # TODO: Check for NACK!