pcf8563 - PCF8563 Real Time Clock module

This library supports the use of the PCF8563-based RTC in CircuitPython. It contains a base RTC class used by all Adafruit RTC libraries. This base class is inherited by the chip-specific subclasses.

Functions are included for reading and writing registers and manipulating datetime objects.

Author(s): Philip R. Moyer and Radomir Dopieralski for Adafruit Industries. Date: November 2016 Affiliation: Adafruit Industries

Implementation Notes

Hardware:

Software and Dependencies:

Notes:

  1. Milliseconds are not supported by this RTC.

  2. The alarm does not support seconds. It will always fire on full minutes.

  3. This RTC has a single timer. The class Timer implements the interface to timer-specfic registers.

  4. The class Clock implements the configuration of the clkout-pin.

  5. Datasheet: http://cache.nxp.com/documents/data_sheet/PCF8563.pdf

class adafruit_pcf8563.pcf8563.PCF8563(i2c_bus: I2C)

Interface to the PCF8563 RTC.

Parameters:

i2c_bus (I2C) – The I2C bus object

alarm = 9

Alarm time for the alarm. Note that the value of the seconds-fields is ignored, i.e. alarms only fire at full minutes. For short-term alarms, use a timer instead.

alarm_interrupt = 1

True if the interrupt pin will output when alarm is alarming.

alarm_status = 1

True if alarm is alarming. Set to False to reset.

clockout_enabled = 13

True if clockout is enabled (default). To disable clockout, set to False

property datetime: struct_time

Gets the current date and time or sets the current date and time then starts the clock.

datetime_compromised = 2

True if the clock integrity is compromised.

datetime_register = 2

Current date and time.

property lost_power: bool

Compatibility property for PCF8523-lib

timer - PCF8563 Timer module

This class supports the timer of the PCF8563-based RTC in CircuitPython.

Functions are included for reading and writing registers and manipulating timer objects.

The class supports stand-alone usage. In this case, pass an i2-bus object to the constructor. If used together with the PCF8563 class (rtc), instantiate the rtc-object first and then pass the i2c_device attribute of the rtc to the constructor of the timer.

Author(s): Bernhard Bablok Date: March 2023

Implementation Notes

Hardware:

Software and Dependencies:

Notes:

  1. Datasheet: http://cache.nxp.com/documents/data_sheet/PCF8563.pdf

class adafruit_pcf8563.timer.Timer(i2c: I2C | adafruit_bus_device.i2c_device.I2CDevice)

Interface to the timer of the PCF8563 RTC.

Parameters:

i2c_bus (I2C) – The I2C bus object

TIMER_FREQ_1HZ = 2

Timer frequency of 1 Hz

TIMER_FREQ_1_60HZ = 3

Timer frequency of 1/60 Hz

TIMER_FREQ_4KHZ = 0

Timer frequency of 4 KHz

TIMER_FREQ_64HZ = 1

Timer frequency of 64 Hz

timer_enabled = 14

True if the timer is enabled. Default is False.

timer_frequency = 2

Timer clock frequency. Default is 1/60Hz. Possible values are as shown (selection value - frequency). 00 - 4.096kHz 01 - 64Hz 10 - 1Hz 11 - 1/60Hz

timer_interrupt = 1

True if the interrupt pin will assert when timer has elapsed. Defaults to False.

timer_pulsed = 1

True if timer asserts INT as a pulse. The default value False asserts INT permanently.

timer_status = 1

True if timer has elapsed. Set to False to reset.

timer_value = 8

Timer value (0-255). The default is undefined. The total countdown duration is calcuated by timer_value/timer_frequency. For a higher precision, use higher values and frequencies, e.g. for a one minute timer you could use value=1, frequency=1/60Hz or value=60, frequency=1Hz. The latter will give better results. See the PCF85x3 User’s Manual for details.

clock - PCF8563 Clock module

This class supports the clkout-feature of the PCF8563-based RTC in CircuitPython.

Functions are included for reading and writing registers to configure clklout frequency.

The class supports stand-alone usage. In this case, pass an i2-bus object to the constructor. If used together with the PCF8563 class (rtc), instantiate the rtc-object first and then pass the i2c_device attribute of the rtc to the constructor of the clock.

Author(s): Bernhard Bablok Date: March 2023

Implementation Notes

Hardware:

Software and Dependencies:

Notes:

  1. Datasheet: http://cache.nxp.com/documents/data_sheet/PCF8563.pdf

class adafruit_pcf8563.clock.Clock(i2c: I2C | adafruit_bus_device.i2c_device.I2CDevice)

Interface to the clkout of the PCF8563 RTC.

Parameters:

i2c_bus (I2C) – The I2C bus object

CLOCKOUT_FREQ_1HZ = 3

Clock frequency of 1 Hz

CLOCKOUT_FREQ_1KHZ = 1

Clock frequency of 4 KHz

CLOCKOUT_FREQ_32HZ = 2

Clock frequency of 32 Hz

CLOCKOUT_FREQ_32KHZ = 0

Clock frequency of 32 KHz

clockout_enabled = 13

True if clockout is enabled (default). To disable clockout, set to False

clockout_frequency = 2

Clock output frequencies generated. Default is 32.768kHz. Possible values are as shown (selection value - frequency). 00 - 32.768khz 01 - 1.024kHz 10 - 0.032kHz (32Hz) 11 - 0.001kHz (1Hz)