diff options
| author | root <siehputz@gmail.com> | 2021-03-08 23:23:51 -0600 |
|---|---|---|
| committer | root <siehputz@gmail.com> | 2021-03-08 23:23:51 -0600 |
| commit | 576da73a17bd6847e93efcf4260a787813ccdf45 (patch) | |
| tree | b5b830ae2d029f527664cddd9524efcbf85ed63e | |
| parent | 95b7a59156f634fbe48cd7bb8e5bee0181e43446 (diff) | |
Added check for maxlen
| -rw-r--r-- | ports/raspberrypi/common-hal/pulseio/PulseIn.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.c b/ports/raspberrypi/common-hal/pulseio/PulseIn.c index fb05876b9..6377fa7a9 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.c @@ -1,4 +1,4 @@ -b/* +/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) @@ -163,7 +163,7 @@ void common_hal_pulseio_pulsein_interrupt() { irq_clear(self->pio_interrupt); hw_clear_bits(&self->state_machine.pio->inte0, 1u << self->state_machine.state_machine); self->state_machine.pio->irq = 1u << self->state_machine.state_machine; -// check for a pulse thats too long (2000 us) or maxlen reached, and reset +// check for a pulse thats too long (4000 us) or maxlen reached, and reset if (( level_count > 4000 ) || (buf_index >= self->maxlen)) { pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, false); pio_sm_init(self->state_machine.pio, self->state_machine.state_machine, self->state_machine.offset, &self->state_machine.sm_config); |
