From b56455ffbb3a73cd4e0ef4c965adddd7d2a5e6d7 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 11 Aug 2021 10:48:39 -0700 Subject: [PATCH] Allow sleep while paused --- ports/atmel-samd/common-hal/pulseio/PulseIn.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ports/atmel-samd/common-hal/pulseio/PulseIn.c b/ports/atmel-samd/common-hal/pulseio/PulseIn.c index 49cef92478..507db7e437 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseIn.c +++ b/ports/atmel-samd/common-hal/pulseio/PulseIn.c @@ -272,6 +272,9 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) { void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) { uint32_t mask = 1 << self->channel; EIC->INTENCLR.reg = mask << EIC_INTENSET_EXTINT_Pos; + #ifdef SAMD21 + rtc_end_pulse(); + #endif } void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, @@ -299,6 +302,9 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, EIC->INTFLAG.reg = mask << EIC_INTFLAG_EXTINT_Pos; EIC->INTENSET.reg = mask << EIC_INTENSET_EXTINT_Pos; + #ifdef SAMD21 + rtc_start_pulse(); + #endif pulsein_set_config(self, true); }