Skip to content

Commit 154d141

Browse files
committed
docs,esp32: Update machine.TouchPad docs for ESP32-S2 and ESP32-S3.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 66e699e commit 154d141

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

docs/esp32/quickref.rst

+21-8
Original file line numberDiff line numberDiff line change
@@ -751,20 +751,33 @@ APA102 (DotStar) uses a different driver as it has an additional clock pin.
751751
Capacitive touch
752752
----------------
753753

754-
Use the ``TouchPad`` class in the ``machine`` module::
754+
ESP32, ESP32-S2 and ESP32-S3 support capacitive touch via the ``TouchPad`` class
755+
in the ``machine`` module::
755756

756757
from machine import TouchPad, Pin
757758

758759
t = TouchPad(Pin(14))
759760
t.read() # Returns a smaller number when touched
760761

761-
``TouchPad.read`` returns a value relative to the capacitive variation. Small numbers (typically in
762-
the *tens*) are common when a pin is touched, larger numbers (above *one thousand*) when
763-
no touch is present. However the values are *relative* and can vary depending on the board
764-
and surrounding composition so some calibration may be required.
765-
766-
There are ten capacitive touch-enabled pins that can be used on the ESP32: 0, 2, 4, 12, 13
767-
14, 15, 27, 32, 33. Trying to assign to any other pins will result in a ``ValueError``.
762+
``TouchPad.read`` returns a value proportional to the capacitance between the
763+
pin and the board's Ground connection. On ESP32 the number becomes smaller when
764+
the pin (or connected touch pad) is touched, on ESP32-S2 and ESP32-S3 the number
765+
becomes larger when the pin is touched.
766+
767+
In all cases, a touch causes a significant change in the return value. Note the
768+
returned values are *relative* and can vary depending on the board and
769+
surrounding environment so some calibration (i.e. comparison to a baseline or
770+
rolling average) may be required.
771+
772+
========= ==============================================
773+
Chip Touch-enabled pins
774+
--------- ----------------------------------------------
775+
ESP32 0, 2, 4, 12, 13, 14, 15, 27, 32, 33
776+
ESP32-S2 1 to 14 inclusive
777+
ESP32-S3 1 to 14 inclusive
778+
========= ==============================================
779+
780+
Trying to assign to any other pins will result in a ``ValueError``.
768781

769782
Note that TouchPads can be used to wake an ESP32 from sleep::
770783

0 commit comments

Comments
 (0)