@@ -51,6 +51,8 @@ class is inherited by the chip-specific subclasses.
51
51
from adafruit_register import i2c_bits
52
52
from adafruit_register import i2c_bcd_alarm
53
53
from adafruit_register import i2c_bcd_datetime
54
+ from busio import I2C
55
+ from time import struct_time
54
56
55
57
STANDARD_BATTERY_SWITCHOVER_AND_DETECTION = 0b000
56
58
BATTERY_SWITCHOVER_OFF = 0b111
@@ -136,7 +138,7 @@ class PCF8523:
136
138
"""Calibration offset to apply, from -64 to +63. See the PCF8523 datasheet
137
139
figure 18 for the offset calibration calculation workflow."""
138
140
139
- def __init__ (self , i2c_bus ):
141
+ def __init__ (self , i2c_bus : I2C ):
140
142
self .i2c_device = I2CDevice (i2c_bus , 0x68 )
141
143
142
144
# Try and verify this is the RTC we expect by checking the timer B
@@ -151,13 +153,13 @@ def __init__(self, i2c_bus):
151
153
raise ValueError ("Unable to find PCF8523 at i2c address 0x68." )
152
154
153
155
@property
154
- def datetime (self ):
156
+ def datetime (self ) -> struct_time :
155
157
"""Gets the current date and time or sets the current date and time then starts the
156
158
clock."""
157
159
return self .datetime_register
158
160
159
161
@datetime .setter
160
- def datetime (self , value ):
162
+ def datetime (self , value : struct_time ):
161
163
# Automatically sets lost_power to false.
162
164
self .power_management = STANDARD_BATTERY_SWITCHOVER_AND_DETECTION
163
165
self .datetime_register = value
0 commit comments