Using the RTC

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Using the RTC

Post by jgriessen » Sat Apr 28, 2018 5:11 pm

I found a post from a year ago where they changed this in main.c to get RTC going:

Code: Select all

main.c:    rtc_init_start(false);
Is that still required?

Testing similar to
viewtopic.php?f=12&t=3086&hilit=RTC+set ... =10#p18398

shows that main.c is OK as is now -- the RTC is counting,
and calling

Code: Select all

rtc = pyb.RTC()
rtc.init()
stops the RTC now where it was running before that command.
John Griessen blog.kitmatic.com

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Using the RTC

Post by pythoncoder » Sun Apr 29, 2018 6:02 am

Perhaps the C code is hardware dependent?

As for the Python I've never initialised it on a Pyboard and never knew it had an init method. I just instantiate the RTC and, if it's not battery-backed, set it.
Peter Hinch
Index to my micropython libraries.

User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

Re: Using the RTC

Post by jgriessen » Sun Apr 29, 2018 8:38 pm

I just instantiate the RTC and, if it's not battery-backed, set it.
Yes, I'm doing that and getting results. The rtc.init() was from a while back searching through the forum posts.
John Griessen blog.kitmatic.com

Post Reply