Skip to content

Commit dea853d

Browse files
committed
docs: Document pyb.stop, pyb.standby and pyb.RTC.wakeup.
1 parent 4735c45 commit dea853d

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

docs/library/pyb.RTC.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ Methods
3838

3939
``subseconds`` counts down from 255 to 0
4040

41+
.. method:: rtc.wakeup(timeout, callback=None)
42+
43+
Set the RTC wakeup timer to trigger repeatedly at every ``timeout``
44+
milliseconds. This trigger can wake the pyboard from both the sleep
45+
states: :meth:`pyb.stop` and :meth:`pyb.standby`.
46+
47+
If ``timeout`` is ``None`` then the wakeup timer is disabled.
48+
49+
If ``callback`` is given then it is executed at every trigger of the
50+
wakeup timer. ``callback`` must take exactly one argument.
51+
4152
.. method:: rtc.info()
4253

4354
Get information about the startup time and reset source.

docs/library/pyb.rst

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,33 @@ Power related functions
133133

134134
.. function:: wfi()
135135

136-
Wait for an interrupt.
137-
This executies a ``wfi`` instruction which reduces power consumption
138-
of the MCU until an interrupt occurs, at which point execution continues.
136+
Wait for an internal or external interrupt.
137+
138+
This executes a ``wfi`` instruction which reduces power consumption
139+
of the MCU until any interrupt occurs (be it internal or external),
140+
at which point execution continues. Note that the system-tick interrupt
141+
occurs once every millisecond (1000Hz) so this function will block for
142+
at most 1ms.
143+
144+
.. function:: stop()
145+
146+
Put the pyboard in a "sleeping" state.
147+
148+
This reduces power consumption to less than 500 uA. To wake from this
149+
sleep state requires an external interrupt or a real-time-clock event.
150+
Upon waking execution continues where it left off.
151+
152+
See :meth:`rtc.wakeup` to configure a real-time-clock wakeup event.
139153

140154
.. function:: standby()
141155

156+
Put the pyboard into a "deep sleep" state.
142157

143-
.. function:: stop()
158+
This reduces power consumption to less than 50 uA. To wake from this
159+
sleep state requires an external interrupt or a real-time-clock event.
160+
Upon waking the system undergoes a hard reset.
161+
162+
See :meth:`rtc.wakeup` to configure a real-time-clock wakeup event.
144163

145164
Miscellaneous functions
146165
-----------------------

0 commit comments

Comments
 (0)