Skip to content

Commit a68d6aa

Browse files
authored
Merge pull request #57 from mikeysklar/ds3231-alarm2-minute-status
alarm2 changes
2 parents d373491 + 531bc36 commit a68d6aa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

adafruit_register/i2c_bcd_alarm.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# SPDX-License-Identifier: MIT
44
# pylint: disable=too-few-public-methods
5+
# pylint: disable=too-many-branches
56

67
"""
78
`adafruit_register.i2c_bcd_alarm`
@@ -23,7 +24,7 @@
2324
from circuitpython_typing.device_drivers import I2CDeviceDriver
2425

2526
FREQUENCY_T = Literal[
26-
"monthly", "weekly", "daily", "hourly", "secondly", "minutely"
27+
"monthly", "weekly", "daily", "hourly", "minutely", "secondly"
2728
]
2829
except ImportError:
2930
pass
@@ -115,6 +116,9 @@ def __get__(
115116
frequency = "minutely"
116117
seconds = _bcd2bin(self.buffer[1] & 0x7F)
117118
i = 2
119+
else:
120+
frequency = "minutely"
121+
seconds = _bcd2bin(self.buffer[i] & 0x7F)
118122
minute = 0
119123
if (self.buffer[i] & 0x80) == 0:
120124
frequency = "hourly"
@@ -169,7 +173,7 @@ def __set__(
169173
raise ValueError(error_message)
170174

171175
frequency = FREQUENCY.index(frequency_name)
172-
if frequency <= 1 and not self.has_seconds:
176+
if frequency < 1 and not self.has_seconds:
173177
raise ValueError(error_message)
174178

175179
# i is the index of the minute byte

0 commit comments

Comments
 (0)