urtc module¶
DS1307¶
-
class
urtc.DS1307(i2c, address=0x68)¶ -
datetime(datetime)¶ Get or set the current time.
The
datetimeis an 8-tuple of the format(year, month, day, weekday, hour, minute, second, millisecond)describing the time to be set. If not specified, the method returns a tuple in the same format.
-
memory(address, buffer=None)¶ Read or write the non-volatile random acces memory.
-
stop(value=None)¶ Get or set the status of the stop clock flag. This can be used to start the clock at a precise moment in time.
-
DS3231¶
-
class
urtc.DS3231(i2c, address=0x68)¶ -
datetime(datetime)¶ Get or set the current time.
The
datetimeis an 8-tuple of the format(year, month, day, weekday, hour, minute, second, millisecond)describing the time to be set. If not specified, the method returns a tuple in the same format.
-
alarm_time(self, datetime=None)¶ Get or set the alarm time.
The
datetimeis a tuple in the same format as fordatetime()method.Only
day,hour,minuteandweekdayvalues are used, the rest is ignored. If a value isNone, it will also be ignored. When the values match the current date and time, the alarm will be triggered.
-
lost_power()¶ Return
Trueif the clock lost the power recently and needs to be re-set.
-
alarm(value=None)¶ Get or set the value of the alarm flag. This is set to
Truewhen an alarm is triggered, and has to be cleared manually.
-
stop(value=None)¶ Get or set the status of the stop clock flag. This can be used to start the clock at a precise moment in time.
-
PCF8523¶
-
class
urtc.PCF8523(i2c, address=0x68)¶ -
datetime(datetime)¶ Get or set the current time.
The
datetimeis an 8-tuple of the format(year, month, day, weekday, hour, minute, second, millisecond)describing the time to be set. If not specified, the method returns a tuple in the same format.
-
alarm_time(self, datetime=None)¶ Get or set the alarm time.
The
datetimeis a tuple in the same format as fordatetime()method.Only
day,hour,minuteandweekdayvalues are used, the rest is ignored. If a value isNone, it will also be ignored. When the values match the current date and time, the alarm will be triggered.
-
lost_power()¶ Return
Trueif the clock lost the power recently and needs to be re-set.
-
alarm(value=None)¶ Get or set the value of the alarm flag. This is set to
Truewhen an alarm is triggered, and has to be cleared manually.
-
stop(value=None)¶ Get or set the status of the stop clock flag. This can be used to start the clock at a precise moment in time.
-
reset()¶ Perform a software reset of the clock module.
-
battery_low()¶ Return
Trueif the battery is discharged and needs to be replaced.
-
Utilities¶
-
class
urtc.DateTimeTuple¶ A
NamedTupleof the format required by thedatetimemethods.
-
urtc.datetime_tuple(year, month, day, weekday, hour, minute, second, millisecond)¶ A factory function for
DateTimeTuple.
-
urtc.tuple2seconds(datetime)¶ Convert
datetimetuple into seconds since Jan 1, 2000.
-
urtc.seconds2tuple()¶ Convert seconds since Jan 1, 2000 into a
DateTimeTuple.