adafruit / Adafruit_CircuitPython_DS3231

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

correct register width when retrieving calibration register (fixes #30) #32

Closed MattyJeronimo closed 3 years ago

MattyJeronimo commented 3 years ago

Register width parameter of call to i2c_bits.RWBits specifies the width of the register in bytes. However, in the following call, register width is passed as 8.

_calibration = i2c_bits.RWBits(8, 0x10, 0, 8, signed=True)

This results in an 8 byte register (64 bit). This fails on feather m0 adalogger because maximum integer value for a python int on this platform is (2^30)-1

The register should only be 1 byte, the 8 is probably a typo because the other arguments passed are in bits.

Fixes: #30

travisby commented 3 years ago

I can't speak to the correctness of the change, but I can say that with this patch my gemma M0 that was previously failing to import ds3231 now succeeds :).

Thanks for the fix @MattyJeronimo !