Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RTC_DS3231: handle negative temperatures
RTC_DS3231::getTemperature() assumes the temperature register stores a positive integer whereas, according to the datasheet,[1] it is a signed number in two’s complement format. Fix the method by transferring this register into a signed 16-bit integer. As the CPU uses two’s complement natively, no further conversion is needed other than scaling by a factor (1/256.0). Fixes adafruit#287. [1] https://www.analog.com/media/en/technical-documentation/data-sheets/DS3231.pdf#page=15
- Loading branch information