You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DS3231: Add calibration, temperature, and force_conversion
This device has a temperature sensor with 0.25C precision,
and an "aging offset" which can be used to calibrate the crystal
frequency for increased timekeeping accuracy.
Expose these as properties.
This requires
adafruit/Adafruit_CircuitPython_Register#39 as the
temperature and calibration registers hold signed values.
"""Returns the last temperature measurement. Temperature is updated only every 64 seconds, or when a conversion is forced."""
124
+
returnself._temperature/4
125
+
126
+
defforce_conversion(self):
127
+
"""Forces a conversion and returns the new temperature"""
128
+
whileself._busy:
129
+
pass
130
+
self._conv=True
131
+
whileself._busy:
132
+
pass
133
+
returnself.temperature
134
+
135
+
@property
136
+
defcalibration(self):
137
+
"""Calibration values range from -128 to 127; each step is approximately 0.1ppm, and positive values decrease the frequency (increase the period). When set, a temperature conversion is forced so the result of calibration can be seen directly at the 32kHz pin after the next temperature conversion."""
0 commit comments