diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-05-15 10:31:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-15 10:31:05 -0700 |
| commit | 0d8bca92e208e705150097d26db6a5390dc9eb9b (patch) | |
| tree | 122acb729c3e0e629642bc39f7f2ee9db3fc084a /shared-bindings/rtc/RTC.c | |
| parent | bd78ab3c2812f7772021be7863f89a9650589d80 (diff) | |
| parent | 8ac3e7977f87219454dbab50264a723e797b877a (diff) | |
Merge pull request #2810 from dherrada/master
Pyi integration
Diffstat (limited to 'shared-bindings/rtc/RTC.c')
| -rw-r--r-- | shared-bindings/rtc/RTC.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/shared-bindings/rtc/RTC.c b/shared-bindings/rtc/RTC.c index 07d170ee6..58fe308f5 100644 --- a/shared-bindings/rtc/RTC.c +++ b/shared-bindings/rtc/RTC.c @@ -38,14 +38,12 @@ const rtc_rtc_obj_t rtc_rtc_obj = {{&rtc_rtc_type}}; -//| .. currentmodule:: rtc +//| class RTC: +//| """Real Time Clock""" //| -//| :class:`RTC` --- Real Time Clock -//| -------------------------------- -//| -//| .. class:: RTC() -//| -//| This class represents the onboard Real Time Clock. It is a singleton and will always return the same instance. +//| def __init__(self, ): +//| """This class represents the onboard Real Time Clock. It is a singleton and will always return the same instance.""" +//| ... //| STATIC mp_obj_t rtc_rtc_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { // No arguments @@ -55,25 +53,24 @@ STATIC mp_obj_t rtc_rtc_make_new(const mp_obj_type_t *type, size_t n_args, const return (mp_obj_t)&rtc_rtc_obj; } -//| .. attribute:: datetime +//| datetime: time.struct_time = ... +//| """The current date and time of the RTC as a `time.struct_time`. //| -//| The current date and time of the RTC as a `time.struct_time`. +//| This must be set to the current date and time whenever the board loses power:: //| -//| This must be set to the current date and time whenever the board loses power:: +//| import rtc +//| import time //| -//| import rtc -//| import time +//| r = rtc.RTC() +//| r.datetime = time.struct_time((2019, 5, 29, 15, 14, 15, 0, -1, -1)) //| -//| r = rtc.RTC() -//| r.datetime = time.struct_time((2019, 5, 29, 15, 14, 15, 0, -1, -1)) //| +//| Once set, the RTC will automatically update this value as time passes. You can read this +//| property to get a snapshot of the current time:: //| -//| Once set, the RTC will automatically update this value as time passes. You can read this -//| property to get a snapshot of the current time:: -//| -//| current_time = r.datetime -//| print(current_time) -//| # struct_time(tm_year=2019, tm_month=5, ...) +//| current_time = r.datetime +//| print(current_time) +//| # struct_time(tm_year=2019, tm_month=5, ...)""" //| STATIC mp_obj_t rtc_rtc_obj_get_datetime(mp_obj_t self_in) { timeutils_struct_time_t tm; @@ -97,12 +94,11 @@ const mp_obj_property_t rtc_rtc_datetime_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| .. attribute:: calibration -//| -//| The RTC calibration value as an `int`. +//| calibration: int = ... +//| """The RTC calibration value as an `int`. //| //| A positive value speeds up the clock and a negative value slows it down. -//| Range and value is hardware specific, but one step is often approximately 1 ppm. +//| Range and value is hardware specific, but one step is often approximately 1 ppm.""" //| STATIC mp_obj_t rtc_rtc_obj_get_calibration(mp_obj_t self_in) { int calibration = common_hal_rtc_get_calibration(); |
