stm32-rs / stm32l0xx-hal

A hardware abstraction layer (HAL) for the STM32L0 series microcontrollers written in Rust
BSD Zero Clause License
96 stars 60 forks source link

RTC API revamp based on the rtcc crate #191

Closed dbrgn closed 2 years ago

dbrgn commented 2 years ago

The rtc::RTC struct has been renamed to rtc::Rtc and includes a big refactoring and a few API changes. It now implements the traits from the rtcc crate and uses date/time types from Chrono.

Because additional dependencies were added, the rtc module is now behind an optional rtc feature (enabled by default).

The changes also include a fix for RTC year handling. Previously, the implementation incorrectly assumed that the BCD year 00 corresponds to 1970, but this results in a wrong leap year calculation. The correct time base is the year 2000.