adafruit / Adafruit_CircuitPython_DS3231

Adafruit CircuitPython drivers for the DS3231 realtime clock.
MIT License
21 stars 19 forks source link

DS3231: Add calibration, temperature, and force_conversion #27

Closed jepler closed 4 years ago

jepler commented 4 years ago

This device has a temperature sensor with 0.25°C precision, and an "aging offset" which can be used to calibrate the crystal frequency for increased timekeeping accuracy.

Expose these as properties.

This requires https://github.com/adafruit/Adafruit_CircuitPython_Register/pull/39 as the temperature and calibration registers hold signed values.

With these changes, I was able to use a precision frequency meter to "tune" the RTC so that it would have less than .01 seconds per day of error at 27°C, by assigning the best value to the calibration register.