Added check for maxlen
This commit is contained in:
parent
95b7a59156
commit
576da73a17
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user