Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTC_DS3231: correctly handle negative temperatures #303

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on May 6, 2024

  1. 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
    edgar-bonet committed May 6, 2024
    Configuration menu
    Copy the full SHA
    5002b54 View commit details
    Browse the repository at this point in the history