diff --git a/ports/atmel-samd/common-hal/touchio/TouchIn.c b/ports/atmel-samd/common-hal/touchio/TouchIn.c index 0677d5b3a1..eda1b72c43 100644 --- a/ports/atmel-samd/common-hal/touchio/TouchIn.c +++ b/ports/atmel-samd/common-hal/touchio/TouchIn.c @@ -114,7 +114,14 @@ void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t* self) { } void touchin_reset() { - // TODO(tannewt): Reset the PTC. + Ptc* ptc = ((Ptc *) PTC); + if (ptc->CTRLA.bit.ENABLE == 1) { + ptc->CTRLA.bit.ENABLE = 0; + while (ptc->CTRLA.bit.ENABLE == 1) {} + + ptc->CTRLA.bit.SWRESET = 1; + while (ptc->CTRLA.bit.SWRESET == 1) {} + } } bool common_hal_touchio_touchin_get_value(touchio_touchin_obj_t *self) { diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 8e6f2b1857..cd122843de 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -53,6 +53,7 @@ #include "common-hal/pulseio/PulseOut.h" #include "common-hal/pulseio/PWMOut.h" #include "common-hal/rtc/RTC.h" +#include "common-hal/touchio/TouchIn.h" #include "common-hal/usb_hid/Device.h" #include "shared-bindings/rtc/__init__.h" #include "clocks.h" @@ -240,8 +241,10 @@ void reset_port(void) { i2sout_reset(); #endif audio_dma_reset(); -// touchin_reset(); //pdmin_reset(); +#endif +#ifdef SAMD21 + touchin_reset(); #endif pulsein_reset(); pulseout_reset();