A delay is needed after `rtc_set_datetime()` before the newly set value can be read back. Co-authored-by: Rene Greiner <reneg973@gmail.com>
This commit is contained in:
parent
4039929324
commit
2cb4d4aa1a
@ -32,6 +32,10 @@ int main() {
|
||||
rtc_init();
|
||||
rtc_set_datetime(&t);
|
||||
|
||||
// clk_sys is >2000x faster than clk_rtc, so datetime is not updated immediately when rtc_get_datetime() is called.
|
||||
// tbe delay is up to 3 RTC clock cycles (which is 64us with the default clock settings)
|
||||
sleep_us(64);
|
||||
|
||||
// Print the time
|
||||
while (true) {
|
||||
rtc_get_datetime(&t);
|
||||
|
||||
Reference in New Issue
Block a user