Skip to content

Commit 656d8ba

Browse files
committed
PCF8523: Add additional registers
This adds the following registers: * cap_sel, True to add additional capacitance to clock pins * calibration_mode, select one of two different clock calibration methods * calibration, set the clock calibration (offset) value in ~4ppm steps By accurately measuring the crystal frequency, these values can be selected to improve the calibration of the RTC from "minutes per month" to "seconds per month".
1 parent 25c1e8b commit 656d8ba

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

adafruit_pcf8523.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ class PCF8523:
101101
battery_low = i2c_bit.ROBit(0x02, 2)
102102
"""True if the battery is low and should be replaced."""
103103

104+
cap_sel = i2c_bit.RWBit(0x00, 7)
105+
"""True for high oscillator capacitance (12.5pF), otherwise lower (7pF)"""
106+
107+
calibration_mode = i2c_bit.RWBit(0x0e, 7)
108+
"""False to offset every 2 hours (1 LSB = 4.340ppm); True to offset every minute (1 LSB = 4.069ppm). The factory default, False, consumes less power"""
109+
110+
calibration = i2c_bits.RWBits(7, 0xe, 0, signed=True)
111+
"""Calibration offset to apply, from -64 to +63. See the PCF8523 datasheet figure 18 for the offset calibration calculation workflow."""
112+
104113
def __init__(self, i2c_bus):
105114
self.i2c_device = I2CDevice(i2c_bus, 0x68)
106115

0 commit comments

Comments
 (0)