diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.c b/ports/raspberrypi/common-hal/pulseio/PulseIn.c index 346c0951ed0f..70d542246ed3 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.c @@ -173,8 +173,10 @@ uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t *self) { mp_raise_IndexError_varg(translate("pop from empty %q"), MP_QSTR_PulseIn); } uint16_t value = self->buffer[self->start]; + common_hal_mcu_disable_interrupts(); self->start = (self->start + 1) % self->maxlen; self->len--; + common_hal_mcu_enable_interrupts(); return value; }