2929#include "modmachine.h"
3030#include "driver/gpio.h"
3131
32- #if SOC_TOUCH_SENSOR_SUPPORTED
32+ #if SOC_TOUCH_SENSOR_SUPPORTED && ! CONFIG_IDF_TARGET_ESP32P4
3333
3434#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL (5 , 3 , 0 )
3535#if SOC_TOUCH_VERSION_1
@@ -80,6 +80,21 @@ static const mtp_obj_t touchpad_obj[] = {
8080 {{& machine_touchpad_type }, GPIO_NUM_12 , TOUCH_PAD_NUM12 },
8181 {{& machine_touchpad_type }, GPIO_NUM_13 , TOUCH_PAD_NUM13 },
8282 {{& machine_touchpad_type }, GPIO_NUM_14 , TOUCH_PAD_NUM14 },
83+ #elif CONFIG_IDF_TARGET_ESP32P4
84+ {{& machine_touchpad_type }, GPIO_NUM_2 , TOUCH_PAD_NUM0 },
85+ {{& machine_touchpad_type }, GPIO_NUM_3 , TOUCH_PAD_NUM1 },
86+ {{& machine_touchpad_type }, GPIO_NUM_4 , TOUCH_PAD_NUM2 },
87+ {{& machine_touchpad_type }, GPIO_NUM_5 , TOUCH_PAD_NUM3 },
88+ {{& machine_touchpad_type }, GPIO_NUM_6 , TOUCH_PAD_NUM4 },
89+ {{& machine_touchpad_type }, GPIO_NUM_7 , TOUCH_PAD_NUM5 },
90+ {{& machine_touchpad_type }, GPIO_NUM_8 , TOUCH_PAD_NUM6 },
91+ {{& machine_touchpad_type }, GPIO_NUM_9 , TOUCH_PAD_NUM7 },
92+ {{& machine_touchpad_type }, GPIO_NUM_10 , TOUCH_PAD_NUM8 },
93+ {{& machine_touchpad_type }, GPIO_NUM_11 , TOUCH_PAD_NUM9 },
94+ {{& machine_touchpad_type }, GPIO_NUM_12 , TOUCH_PAD_NUM10 },
95+ {{& machine_touchpad_type }, GPIO_NUM_13 , TOUCH_PAD_NUM11 },
96+ {{& machine_touchpad_type }, GPIO_NUM_14 , TOUCH_PAD_NUM12 },
97+ {{& machine_touchpad_type }, GPIO_NUM_15 , TOUCH_PAD_NUM13 },
8398 #else
8499 #error "Please add GPIO mapping for this SoC"
85100 #endif
@@ -168,4 +183,4 @@ MP_DEFINE_CONST_OBJ_TYPE(
168183 locals_dict , & mtp_locals_dict
169184 );
170185
171- #endif // SOC_TOUCH_SENSOR_SUPPORTED
186+ #endif // SOC_TOUCH_SENSOR_SUPPORTED
0 commit comments