Skip to content

Commit

Permalink
ESP32-S2: Initialize touch in proper order
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalbert committed Jan 18, 2021
1 parent 6a76b60 commit ee48e4b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ports/esp32s2/peripherals/touch.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ void peripherals_touch_init(const touch_pad_t touchpad) {
if (!touch_inited) {
touch_pad_init();
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
}
// touch_pad_config() must be done before touch_pad_fsm_start() the first time.
// Otherwise the calibration is wrong and we get maximum raw values if there is
// a trace of any significant length on the pin.
touch_pad_config(touchpad);
if (!touch_inited) {
touch_pad_fsm_start();
touch_inited = true;
}
touch_pad_config(touchpad);
}

0 comments on commit ee48e4b

Please sign in to comment.