summaryrefslogtreecommitdiff
path: root/ports/esp32/machine_touchpad.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/esp32/machine_touchpad.c')
-rw-r--r--ports/esp32/machine_touchpad.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ports/esp32/machine_touchpad.c b/ports/esp32/machine_touchpad.c
index 335157b15..168ac16d0 100644
--- a/ports/esp32/machine_touchpad.c
+++ b/ports/esp32/machine_touchpad.c
@@ -31,7 +31,11 @@
#if CONFIG_IDF_TARGET_ESP32
#include "driver/gpio.h"
+#if CONFIG_IDF_TARGET_ESP32
#include "driver/touch_pad.h"
+#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
+#include "driver/touch_sensor.h"
+#endif
typedef struct _mtp_obj_t {
mp_obj_base_t base;
@@ -39,6 +43,7 @@ typedef struct _mtp_obj_t {
touch_pad_t touchpad_id;
} mtp_obj_t;
+#if CONFIG_IDF_TARGET_ESP32
STATIC const mtp_obj_t touchpad_obj[] = {
{{&machine_touchpad_type}, GPIO_NUM_4, TOUCH_PAD_NUM0},
{{&machine_touchpad_type}, GPIO_NUM_0, TOUCH_PAD_NUM1},
@@ -51,6 +56,24 @@ STATIC const mtp_obj_t touchpad_obj[] = {
{{&machine_touchpad_type}, GPIO_NUM_33, TOUCH_PAD_NUM8},
{{&machine_touchpad_type}, GPIO_NUM_32, TOUCH_PAD_NUM9},
};
+#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
+STATIC const mtp_obj_t touchpad_obj[] = {
+ {{&machine_touchpad_type}, GPIO_NUM_1, TOUCH_PAD_NUM1},
+ {{&machine_touchpad_type}, GPIO_NUM_2, TOUCH_PAD_NUM2},
+ {{&machine_touchpad_type}, GPIO_NUM_3, TOUCH_PAD_NUM3},
+ {{&machine_touchpad_type}, GPIO_NUM_4, TOUCH_PAD_NUM4},
+ {{&machine_touchpad_type}, GPIO_NUM_5, TOUCH_PAD_NUM5},
+ {{&machine_touchpad_type}, GPIO_NUM_6, TOUCH_PAD_NUM6},
+ {{&machine_touchpad_type}, GPIO_NUM_7, TOUCH_PAD_NUM7},
+ {{&machine_touchpad_type}, GPIO_NUM_8, TOUCH_PAD_NUM8},
+ {{&machine_touchpad_type}, GPIO_NUM_9, TOUCH_PAD_NUM9},
+ {{&machine_touchpad_type}, GPIO_NUM_10, TOUCH_PAD_NUM10},
+ {{&machine_touchpad_type}, GPIO_NUM_11, TOUCH_PAD_NUM11},
+ {{&machine_touchpad_type}, GPIO_NUM_12, TOUCH_PAD_NUM12},
+ {{&machine_touchpad_type}, GPIO_NUM_13, TOUCH_PAD_NUM13},
+ {{&machine_touchpad_type}, GPIO_NUM_14, TOUCH_PAD_NUM14},
+};
+#endif
STATIC mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
const mp_obj_t *args) {