machine.RTC docs inaccurate?

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
User avatar
andrew
Posts: 22
Joined: Sun Aug 10, 2014 9:22 am

machine.RTC docs inaccurate?

Post by andrew » Thu Oct 22, 2015 6:20 pm

I think the machine.RTC docs need looking at and updating for WiPy.
class RTC – real time clock

The RTC is and independent clock that keeps track of the date and time.

Example usage:

rtc = machine.RTC()
rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))
print(rtc.datetime())

Constructors
class machine.RTC(id=0, ...)
Create an RTC object. See init for parameters of initialization.

Methods
rtc.init(id, datetime)
Initialise the RTC. Datetime is a tuple of the form:

(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])

Code: Select all

>>> rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: no such attribute
>>>
>>> rtc.datetime()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: no such attribute
>>>
doesn't work.

Code: Select all

>>> rtc = RTC(id=0, datetime=(2015, 10, 22, 19, 9))
>>> rtc.now()
(2015, 10, 22, 19, 9, 7, 685000, None)
>>> rtc.now()
(2015, 10, 22, 19, 9, 10, 655000, None)
works but

Code: Select all

>>> rtc.init(id=0, datetime=(2015, 10, 22, 19, 9))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: argument num/types mismatch
>>>
doesn't.

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: machine.RTC docs inaccurate?

Post by danicampora » Thu Oct 22, 2015 6:25 pm

You are right Andrew, thanks for the info. I fixed and pushed to the repo. It will be visible when we generate the docs again.

Post Reply