Skip to content

Commit 46a4393

Browse files
committed
espressif: fix deinit to track that it freed its pcnt unit
otherwise, check_for_deinit would not notice the unit was deinitialized, and calling deinit a second time could release resources in use by another object.
1 parent f8c5aab commit 46a4393

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ports/espressif/common-hal/rotaryio/IncrementalEncoder.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ void common_hal_rotaryio_incrementalencoder_deinit(rotaryio_incrementalencoder_o
9797
reset_pin_number(self->pin_a);
9898
reset_pin_number(self->pin_b);
9999
peripherals_pcnt_deinit(&self->unit);
100+
self->unit = PCNT_UNIT_MAX;
100101
}
101102

102103
mp_int_t common_hal_rotaryio_incrementalencoder_get_position(rotaryio_incrementalencoder_obj_t *self) {

0 commit comments

Comments
 (0)