adafruit / Adafruit_CircuitPython_Register

Python data descriptor classes to represent hardware registers on I2C devices.
MIT License
52 stars 24 forks source link

Why is the alarm year & month hardcoded to Jan 2017? #53

Open maholli opened 5 months ago

maholli commented 5 months ago

When reading an alarm set point, the tm_year attribute is hardcoded to return 2017 and tm_mon to return 1. Is this intentional? Caused by a limitation somewhere?

https://github.com/adafruit/Adafruit_CircuitPython_Register/blob/d37349183b82cd7d05af57a77eb3765e17e7be3f/adafruit_register/i2c_bcd_alarm.py#L154

In contrast, reading the datetime properly returns the year reported from the RTC:

https://github.com/adafruit/Adafruit_CircuitPython_Register/blob/d37349183b82cd7d05af57a77eb3765e17e7be3f/adafruit_register/i2c_bcd_datetime.py#L88

tannewt commented 5 months ago

I don't remember. It was probably just a known point in time to base the frequency on. Maybe look in the DS3231 (iirc) datasheet for clues.

maholli commented 5 months ago

@tannewt yeah the DS3231 alarm registers specify the time up to the day (date). Not sure how you want this helper library to handle it, but at the very least the docs should include a warning.

tannewt commented 5 months ago

PR to update the doc would be great!