stm32duino / STM32RTC

Arduino RTC library for STM32.
127 stars 48 forks source link

Added `getPrescaler( );` `setPrescaler( );` for calibrating STM32F1xx during runtime. #38

Closed HamidSaffari closed 2 years ago

HamidSaffari commented 4 years ago

Added getPrescaler(uint32_t *prescaler); and setPrescaler(uint32_t prescaler); for calibrating STM32F1xx during runtime.

FRASTM commented 2 years ago

The stm32F1 has a different prescaler setting from other stm32 devices. It is purely asynchronous 8+16 bit factor, hold on a 32bit value. Setting the prescaler is writing the (write-only) PRL registers Reading the prescaler (on the Read-only reg DIV).

That's why (I guess) new API is proposed for stm32F1 serie using a single 32bit factor.

Another proposal is to keep the existing STM32RTC::setPrediv and STM32RTC::getPrediv giving a 32bit value (as the 1st param and ignoring the second) in case of stm32F1

fpistm commented 2 years ago

Thanks @HamidSaffari for your contribution and sorry for the delay to handle this PR. I close this PR as it is superseded by #56.