Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
alarm2 changes
ds3231:
minute support
status
frequency re-order
  • Loading branch information
mikeysklar committed Sep 11, 2024
commit c9d03ff186ceb743ce8c1a750b6453c30a8923cd
7 changes: 5 additions & 2 deletions adafruit_register/i2c_bcd_alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from circuitpython_typing.device_drivers import I2CDeviceDriver

FREQUENCY_T = Literal[
"monthly", "weekly", "daily", "hourly", "secondly", "minutely"
"monthly", "weekly", "daily", "hourly", "minutely", "secondly"
]
except ImportError:
pass
Expand Down Expand Up @@ -115,6 +115,9 @@ def __get__(
frequency = "minutely"
seconds = _bcd2bin(self.buffer[1] & 0x7F)
i = 2
else:
frequency = "minutely"
seconds = _bcd2bin(self.buffer[i] & 0x7F)
minute = 0
if (self.buffer[i] & 0x80) == 0:
frequency = "hourly"
Expand Down Expand Up @@ -169,7 +172,7 @@ def __set__(
raise ValueError(error_message)

frequency = FREQUENCY.index(frequency_name)
if frequency <= 1 and not self.has_seconds:
if frequency < 1 and not self.has_seconds:
raise ValueError(error_message)

# i is the index of the minute byte
Expand Down