diff options
author | Angus Gratton <angus@redyak.com.au> | 2024-11-06 18:06:48 +1100 |
---|---|---|
committer | Angus Gratton <gus@projectgus.com> | 2024-11-28 15:45:39 +1100 |
commit | 154d1419659795aa6785778e4ddd6f23f09f2861 (patch) | |
tree | 5df627f68fc012b18d380a17f0c3fdc4c1c0b862 /docs/esp32 | |
parent | 66e699e8a538ed7c1dc2d65035e5d93643e56667 (diff) | |
download | micropython-154d1419659795aa6785778e4ddd6f23f09f2861.tar.gz micropython-154d1419659795aa6785778e4ddd6f23f09f2861.zip |
docs,esp32: Update machine.TouchPad docs for ESP32-S2 and ESP32-S3.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'docs/esp32')
-rw-r--r-- | docs/esp32/quickref.rst | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index b9ca0f8225..5cce96d687 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -751,20 +751,33 @@ APA102 (DotStar) uses a different driver as it has an additional clock pin. Capacitive touch ---------------- -Use the ``TouchPad`` class in the ``machine`` module:: +ESP32, ESP32-S2 and ESP32-S3 support capacitive touch via the ``TouchPad`` class +in the ``machine`` module:: from machine import TouchPad, Pin t = TouchPad(Pin(14)) t.read() # Returns a smaller number when touched -``TouchPad.read`` returns a value relative to the capacitive variation. Small numbers (typically in -the *tens*) are common when a pin is touched, larger numbers (above *one thousand*) when -no touch is present. However the values are *relative* and can vary depending on the board -and surrounding composition so some calibration may be required. - -There are ten capacitive touch-enabled pins that can be used on the ESP32: 0, 2, 4, 12, 13 -14, 15, 27, 32, 33. Trying to assign to any other pins will result in a ``ValueError``. +``TouchPad.read`` returns a value proportional to the capacitance between the +pin and the board's Ground connection. On ESP32 the number becomes smaller when +the pin (or connected touch pad) is touched, on ESP32-S2 and ESP32-S3 the number +becomes larger when the pin is touched. + +In all cases, a touch causes a significant change in the return value. Note the +returned values are *relative* and can vary depending on the board and +surrounding environment so some calibration (i.e. comparison to a baseline or +rolling average) may be required. + +========= ============================================== +Chip Touch-enabled pins +--------- ---------------------------------------------- +ESP32 0, 2, 4, 12, 13, 14, 15, 27, 32, 33 +ESP32-S2 1 to 14 inclusive +ESP32-S3 1 to 14 inclusive +========= ============================================== + +Trying to assign to any other pins will result in a ``ValueError``. Note that TouchPads can be used to wake an ESP32 from sleep:: |