Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

esp32s3 TouchPad not working #13178

Closed
@wangshujun-tj

Description

@wangshujun-tj
frommachineimportTouchPad,Pinimporttimet=TouchPad(Pin(5))foriinrange(100):time.sleep(0.5)print("%X"%t.read())

The same code changes the number with touch on ESP32, but the reading does not change on ESP32s3

Adjusting the initialization code as follows works fine, but I am not familiar enough with ESP32 and have not fully tested it, for reference only. Additionally, I suspect that the same issue also exists in ESP32s2
The changes are minimal, move the touch_Pad_Fsm_Start to touch_Pad_config After

STATICmp_obj_tmtp_make_new(constmp_obj_type_t*type,size_tn_args,size_tn_kw,constmp_obj_t*args) {mp_arg_check_num(n_args,n_kw,1,1, true);gpio_num_tpin_id=machine_pin_get_id(args[0]);constmtp_obj_t*self=NULL;for (inti=0;i<MP_ARRAY_SIZE(touchpad_obj);i++) {if (pin_id==touchpad_obj[i].gpio_id) {self=&touchpad_obj[i];break;        }    }if (!self) {mp_raise_ValueError(MP_ERROR_TEXT("invalid pin for touchpad"));    }staticintinitialized=0;if (!initialized) {touch_pad_init();touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);initialized=1;    }#ifCONFIG_IDF_TARGET_ESP32esp_err_terr=touch_pad_config(self->touchpad_id,0);#elifCONFIG_IDF_TARGET_ESP32S2||CONFIG_IDF_TARGET_ESP32S3esp_err_terr=touch_pad_config(self->touchpad_id);touch_pad_fsm_start();#endifif (err==ESP_OK) {returnMP_OBJ_FROM_PTR(self);    }mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp