Skip to content
Merged
Changes from all commits
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
8 changes: 6 additions & 2 deletions adafruit_register/i2c_bcd_alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: MIT
# pylint: disable=too-few-public-methods
# pylint: disable=too-many-branches

"""
`adafruit_register.i2c_bcd_alarm`
Expand All @@ -23,7 +24,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 +116,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 +173,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