summaryrefslogtreecommitdiff
path: root/decoders/ds1307
diff options
context:
space:
mode:
authorLibor Gabaj <libor.gabaj@gmail.com>2019-01-23 21:58:26 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2019-01-29 23:29:50 +0100
commitb3f6033022006c8f4ee88a70155f3571bee1a2ca (patch)
tree185e85165f8ff94b9b2da1a3955ce75123bf8476 /decoders/ds1307
parent30d27bd438ce90162ffa4911bc61a9661db3d39f (diff)
downloadlibsigrokdecode-b3f6033022006c8f4ee88a70155f3571bee1a2ca.tar.gz
libsigrokdecode-b3f6033022006c8f4ee88a70155f3571bee1a2ca.zip
DS1307: Bugs fixes.
- Square wave frequencies above 1 Hz are in Hz not in kHz. - AM/PM flag is in the bit 5 of hours register not in bit 6. - AM flag is valid at 0 value of AM/PM flag not at 1 value.
Diffstat (limited to 'decoders/ds1307')
-rw-r--r--decoders/ds1307/pd.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/decoders/ds1307/pd.py b/decoders/ds1307/pd.py
index 414da65..0bb1fb2 100644
--- a/decoders/ds1307/pd.py
+++ b/decoders/ds1307/pd.py
@@ -39,9 +39,9 @@ bits = (
rates = {
0b00: '1Hz',
- 0b01: '4096kHz',
- 0b10: '8192kHz',
- 0b11: '32768kHz',
+ 0b01: '4096Hz',
+ 0b10: '8192Hz',
+ 0b11: '32768Hz',
}
DS1307_I2C_ADDRESS = 0x68
@@ -121,7 +121,7 @@ class Decoder(srd.Decoder):
ampm_mode = True if (b & (1 << 6)) else False
if ampm_mode:
self.putd(6, 6, [13, ['12-hour mode', '12h mode', '12h']])
- a = 'AM' if (b & (1 << 6)) else 'PM'
+ a = 'PM' if (b & (1 << 5)) else 'AM'
self.putd(5, 5, [14, [a, a[0]]])
h = self.hours = bcd2int(b & 0x1f)
self.putd(4, 0, [15, ['Hour: %d' % h, 'H: %d' % h, 'H']])