Skip to content

Conversation

@c0de111
Copy link

@c0de111 c0de111 commented Sep 1, 2025

Summary

  • Corrects DS3231 temperature conversion to 0.25°C resolution using proper 10‑bit sign‑extended value.
  • Adds ds3231_clear_alarm1() and ds3231_clear_alarm2() helpers (prototypes + implementations).

Changes

  • libraries/ds3231/ds3231.c: replace incorrect temp math with sign‑extend + 0.25f scale; add clear_alarm1/2 implementations.
  • libraries/ds3231/ds3231.h: declare clear_alarm1/2 prototypes.
  • Total: 2 files, 27 additions, 2 deletions.

Details

  • Temperature: combine MSB/LSB, right‑shift by 6, sign‑extend 10 bits, multiply by 0.25f for correct quarter‑degree granularity.
  • Alarms: read DS3231_CONTROL_STATUS_REG, clear A1F/A2F bits (0/1), write back to acknowledge alarms.

Testing

  • Build and flash; observe temperature changes in ~0.25°C increments near ambient.
  • Manually trigger A1/A2; call ds3231_clear_alarm1/2(); re‑read status to confirm flags cleared; no regressions in RTC/timekeeping.

Compatibility

  • Non‑breaking: temp fix is internal; new alarm clear APIs are additive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant