@@ -176,8 +176,7 @@ Notes:
176
176
177
177
* Pins 34-39 are input only, and also do not have internal pull-up resistors
178
178
179
- * The pull value of some pins can be set to ``Pin.PULL_HOLD `` to reduce power
180
- consumption during deepsleep.
179
+ * See :ref: `Deep_sleep_Mode ` for a discussion of pin behaviour during sleep
181
180
182
181
There's a higher-level abstraction :ref: `machine.Signal <machine.Signal >`
183
182
which can be used to invert a pin. Useful for illuminating active-low LEDs
@@ -498,6 +497,8 @@ See :ref:`machine.WDT <machine.WDT>`. ::
498
497
wdt = WDT(timeout=5000)
499
498
wdt.feed()
500
499
500
+ .. _Deep_sleep_mode :
501
+
501
502
Deep-sleep mode
502
503
---------------
503
504
@@ -517,15 +518,28 @@ Notes:
517
518
* Calling ``deepsleep() `` without an argument will put the device to sleep
518
519
indefinitely
519
520
* A software reset does not change the reset cause
520
- * There may be some leakage current flowing through enabled internal pullups.
521
- To further reduce power consumption it is possible to disable the internal pullups::
522
521
523
- p1 = Pin(4, Pin.IN, Pin.PULL_HOLD)
522
+ Some ESP32 pins (0, 2, 4, 12-15, 25-27, 32-39) are connected to the RTC during
523
+ deep-sleep and can be used to wake the device with the ``wake_on_ `` functions in
524
+ the :mod: `esp32 ` module. The output-capable RTC pins (all except 34-39) will
525
+ also retain their pull-up or pull-down resistor configuration when entering
526
+ deep-sleep.
527
+
528
+ If the pull resistors are not actively required during deep-sleep and are likely
529
+ to cause current leakage (for example a pull-up resistor is connected to ground
530
+ through a switch), then they should be disabled to save power before entering
531
+ deep-sleep mode::
532
+
533
+ from machine import Pin, deepsleep
524
534
525
- After leaving deepsleep it may be necessary to un-hold the pin explicitly (e.g. if
526
- it is an output pin) via::
535
+ # configure input pin with pull-up on boot
536
+ pin = Pin(2, Pin.IN, Pin.PULL_UP)
537
+
538
+ # put the device to sleep for 10 seconds
539
+ pin.init(pull=None)
540
+ machine.deepsleep(10000)
527
541
528
- p1 = Pin(4, Pin.OUT, None)
542
+ Non-RTC GPIO pins will be disconnected by default on entering deep-sleep.
529
543
530
544
SD card
531
545
-------
0 commit comments