-
Notifications
You must be signed in to change notification settings - Fork 136
STM32 RTC Hardware Support & User Interface for Watch and Calendar #128
Conversation
Added a menu to view and configure RTC parameters. It is activated by pressing 'TIME' button in retro-go main menu.
Enable LSE oscillator and enable it as RTC clock source. Additionally enable CRS Sync LSE.
Added time display to RTC menu and also modified RTC initialization code so that it does not set the RTC date and time. Assuming that a fresh RTC has sensible values.
Added date display to time menu
Fixed predivs for LSE clock
Consolidate all RTC functions to rg_rtc. So far getters have been implemented only.
Setters for Time have been implemented and Time setup has been added into the UI to use them.
Date setup with callbacks added
Modified the time menu to display and update in real time.
Github doesn't let me comment on unchanged lines, but I think this should be changed as well: RCC_OscInitStruct.LSIState = RCC_LSI_ON; to RCC_OscInitStruct.LSIState = RCC_LSI_OFF; |
Need to test with LSI OFF but I would assume it is ok to turn it off too! It works with both LSI and LSE active though, at least in my testing. |
Unix time is returned as a 64-bit time_t. Casting to uint32_t will yield time in seconds since 1st Jan 1970.
Did a quick test with RCC_LSI_OFF. Seems to work fine! Clock runs and a game runs. |
Fixing warnings about wrong setter return type.
Missed the .h while updating return types of setters.
Add a nicer year display
There is a quite annoying migration issue here. If I go from the main branch to this directly, from a running target, This is normally not a problem if you have an open unit and can power cycle easily, but I think many have made mods where they can keep the unit closed. Not sure what the best way to proceed here, maybe setting |
I did run with both on and did not see issues from software perspective. It does mean that LSI is also on and that could have a negative impact on the power consumption of the device. How big of an impact, I do not know, but it does consume some extra power to have both LSI and LSE on at the same time. |
Ideally we should measure with a µA meter as it may impact standby performance. I don't think it'll be that bad in any case, so let's just set RCC_LSI_ON for now. |
This should fix an issue with DACs that causes Brightness control not to work.
Added a commit to restore the LSI bits |
Here is an implementation of the STM32 RTC Hardware Support for the retro-go Game and Watch fork. The time can be viewed when pressing the "TIME" button on the main retro-go menu and by selecting Time or Date the aforementioned can be adjusted.