From: Uwe Hermann Date: Sun, 2 Feb 2014 00:07:20 +0000 (+0100) Subject: rtc8564: Handle century bit. X-Git-Tag: libsigrokdecode-0.3.0~118 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=64134a4c84459474a1f1d767314f9a9ecf928539;p=libsigrokdecode.git rtc8564: Handle century bit. --- diff --git a/decoders/rtc8564/pd.py b/decoders/rtc8564/pd.py index 9e5fedd..ed55d4c 100644 --- a/decoders/rtc8564/pd.py +++ b/decoders/rtc8564/pd.py @@ -105,7 +105,7 @@ class Decoder(srd.Decoder): self.putx([1, [ann]]) - def handle_reg_0x02(self, b): # Seconds / Voltage-low flag + def handle_reg_0x02(self, b): # Seconds / Voltage-low bit s = self.seconds = bcd2int(b & 0x7f) self.putx([2, ['Second: %d' % s, 'Sec: %d' % s, 'S: %d' % s]]) vl = 1 if (b & (1 << 7)) else 0 @@ -128,10 +128,11 @@ class Decoder(srd.Decoder): w = self.weekdays = bcd2int(b & 0x07) self.putx([6, ['Weekday: %d' % w, 'WD: %d' % w]]) - def handle_reg_0x07(self, b): # Months / century - # TODO: Handle century bit. + def handle_reg_0x07(self, b): # Months / century bit m = self.months = bcd2int(b & 0x1f) self.putx([7, ['Month: %d' % m, 'Mon: %d' % m]]) + c = 1 if (b & (1 << 7)) else 0 + self.putx([11, ['Century: %d' % c, 'Cent: %d' % c, 'C: %d' % c]]) def handle_reg_0x08(self, b): # Years y = self.years = bcd2int(b & 0xff)