diff --git a/adafruit_register/i2c_bcd_alarm.py b/adafruit_register/i2c_bcd_alarm.py index 4f18cbc..74c8a77 100644 --- a/adafruit_register/i2c_bcd_alarm.py +++ b/adafruit_register/i2c_bcd_alarm.py @@ -2,6 +2,7 @@ # # SPDX-License-Identifier: MIT # pylint: disable=too-few-public-methods +# pylint: disable=too-many-branches """ `adafruit_register.i2c_bcd_alarm` @@ -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 @@ -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" @@ -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