summaryrefslogtreecommitdiff
path: root/decoders/rtc8564/pd.py
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2014-02-02 01:07:20 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2014-02-02 01:07:20 +0100
commit64134a4c84459474a1f1d767314f9a9ecf928539 (patch)
treeb34228ba4b1eb63ca41ca92fbaad7a1baab06ddf /decoders/rtc8564/pd.py
parent6e256b1c2c19ba37b79e75b01a4ce67462ba0e1f (diff)
downloadlibsigrokdecode-64134a4c84459474a1f1d767314f9a9ecf928539.tar.gz
libsigrokdecode-64134a4c84459474a1f1d767314f9a9ecf928539.zip
rtc8564: Handle century bit.
Diffstat (limited to 'decoders/rtc8564/pd.py')
-rw-r--r--decoders/rtc8564/pd.py7
1 files changed, 4 insertions, 3 deletions
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)