Skip to content

Commit 9ec4b83

Browse files
Heikotwenrich
authored andcommitted
docs/library/machine.RTC.rst: added description of method machine.RTC.memory (micropython#5199)
1 parent 47be6a2 commit 9ec4b83

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/library/machine.RTC.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,25 @@ Methods
7575
- ``wake`` specifies the sleep mode from where this interrupt can wake
7676
up the system.
7777

78+
.. method:: RTC.memory([data])
79+
80+
Stores ``data`` (byte literal) into RTC memory, which is kept stored in deep sleep mode of the ESP8266 or ESP32.
81+
The data is stored together with a magic word to detect that the RTC memory is valid.
82+
An uninitialized or cleared RTC memory has no magic word and will deliver ``b''``.
83+
Without ``data`` the method delivers the RTC memory content.
84+
In the ESP8266 are max. 492 bytes and in the ESP32 are max. 2048 Bytes storeable by this method.
85+
86+
Example::
87+
88+
import machine
89+
rtc = machine.RTC()
90+
writedata = b'test'
91+
rtc.memory(writedata) # this command writes writedata into the RTC memory
92+
readdata = rtc.memory() # this command puts the RTC memory into readdata
93+
print(readdata)
94+
95+
Availability: ESP8266, ESP32
96+
7897
Constants
7998
---------
8099

0 commit comments

Comments
 (0)