-
Notifications
You must be signed in to change notification settings - Fork 39
Add real-time-clock implementation #98
base: master
Are you sure you want to change the base?
Conversation
I have something similar here https://github.com/TeXitoi/stm32f103xx-rtc I'll try to review your PR, but I think that LSE initialisation must be done in clocks. Look at #38 and #93. |
Yea, that makes sense now that I think about it. I suppose my implementation would break if someone else with I'll try and look into moving LSE into clocks when I find some time :) |
I finally got around to updating this PR. Unfortunately it wasn't as easy as I thought originally because the backup domain is a bit special. Modifying it seems to require both enabling it in apb1 and in the pwr register. Ideally, I think we should enable LSE in freeze, but requiring The solution I came up with is to add a second function to the RccExt trait that performs the initialisation of the backup domain. This function returns a token that is used to ensure that backup domain initialisation was performed. I'm not super comfortable with this solution however so feel free to suggest something better. |
This PR adds a basic implementation of the RTC module. It is basic in the sense that it only supports counting up one second at a time and doesn't expose all the functionality of the module.
I had to expose a few more registers in the
rcc
module and I hope that implementation is correct. Would it make sense to make a separate PR which does the same thing to all the registers inrcc
or is there a reason that they are hidden as they are now?