summaryrefslogtreecommitdiffstatshomepage
path: root/docs/esp32
diff options
context:
space:
mode:
authorJonathan Hogg <me@jonathanhogg.com>2022-03-07 09:21:11 +0000
committerDamien George <damien@micropython.org>2022-03-21 23:55:02 +1100
commit7684c996bc2b2521fa4bd023e4fa24622092cd5f (patch)
tree28366ad141c00b4a1f4ba0b9fd96eaaa91fbd366 /docs/esp32
parent5887dfeea6a4899e8f30ac1435159d760a985642 (diff)
downloadmicropython-7684c996bc2b2521fa4bd023e4fa24622092cd5f.tar.gz
micropython-7684c996bc2b2521fa4bd023e4fa24622092cd5f.zip
esp32/machine_pin: Add new hold keyword argument and remove PULL_HOLD.
The current pull=Pin.PULL_HOLD argument doesn't make a lot of sense in the context of what it actually does vs what the ESP32 quickref document says it does. This commit removes PULL_HOLD and adds a new hold=True|False keyword argument to Pin()/Pin.init(). Setting this to True will cause the ESP32 to lock the configuration of the pin – including direction, output value, drive strength, pull-up/-down – such that it can't be accidentally changed and will be retained through a watchdog or internal reset. Fixes issue #8283, and see also #8284.
Diffstat (limited to 'docs/esp32')
-rw-r--r--docs/esp32/quickref.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst
index 0778425f2f..dd7e515f1b 100644
--- a/docs/esp32/quickref.rst
+++ b/docs/esp32/quickref.rst
@@ -177,6 +177,14 @@ safe maximum source/sink currents and approximate internal driver resistances:
- ``Pin.DRIVE_2``: 20mA / 30 ohm (default strength if not configured)
- ``Pin.DRIVE_3``: 40mA / 15 ohm
+The ``hold=`` keyword argument to ``Pin()`` and ``Pin.init()`` will enable the
+ESP32 "pad hold" feature. When set to ``True``, the pin configuration
+(direction, pull resistors and output value) will be held and any further
+changes (including changing the output level) will not be applied. Setting
+``hold=False`` will immediately apply any outstanding pin configuration changes
+and release the pin. Using ``hold=True`` while a pin is already held will apply
+any configuration changes and then immediately reapply the hold.
+
Notes:
* Pins 1 and 3 are REPL UART TX and RX respectively
@@ -549,6 +557,10 @@ deep-sleep mode::
pin.init(pull=None)
machine.deepsleep(10000)
+Output-configured RTC pins will also retain their output direction and level in
+deep-sleep if pad hold is enabled with the ``hold=True`` argument to
+``Pin.init()``.
+
Non-RTC GPIO pins will be disconnected by default on entering deep-sleep.
SD card