File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -560,6 +560,25 @@ deep-sleep mode::
560
560
561
561
Non-RTC GPIO pins will be disconnected by default on entering deep-sleep.
562
562
563
+ Pin configuration on *any * output-capable pin - including output level - can be
564
+ retained during deep-sleep by enabling pad hold during deep-sleep and
565
+ configuring a pin with pad hold::
566
+
567
+ from machine import Pin, deepsleep
568
+ import esp32
569
+
570
+ # enable pad hold in deep-sleep
571
+ esp32.gpio_deep_sleep_hold(True)
572
+
573
+ opin = Pin(2, Pin.OUT, value=1, hold=True) # hold output level
574
+ ipin = Pin(21, Pin.IN, Pin.PULL_UP, hold=True) # hold pull-up
575
+
576
+ # put the device to sleep for 10 seconds
577
+ deepsleep(10000)
578
+
579
+ The pin configuration - including the pad hold - will be retained on wake from
580
+ sleep. See :ref: `Pins_and_GPIO ` above for a further discussion of pad holding.
581
+
563
582
SD card
564
583
-------
565
584
Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ Functions
30
30
or a tuple/list of valid Pin objects. *level * should be ``esp32.WAKEUP_ALL_LOW ``
31
31
or ``esp32.WAKEUP_ANY_HIGH ``.
32
32
33
+ .. function :: gpio_deep_sleep_hold(enable)
34
+
35
+ Configure whether pin configuration is retained during deep-sleep mode for
36
+ held pads. *enable * should be a boolean value.
37
+
33
38
.. function :: raw_temperature()
34
39
35
40
Read the raw value of the internal temperature sensor, returning an integer.
You can’t perform that action at this time.
0 commit comments