Skip to content

fix(objectfled): clockless ObjectFLED leaks the GPR26 bank on deinit (same as the SPI path fixed in #5148) #5395

Closed

Description

@zackees

Split from #5065. #5148 fixed the SPI-mode path only.

Defect

The clockless ObjectFLED driver remaps each output pad from GPIO6-9 to GPIO1-4 by clearing its bit in IOMUXC_GPR_GPR26..29 during begin(), and nothing ever restores it. src/third_party/object_fled/src/ObjectFLED.cpp.hpp:273-274 does *(&IOMUXC_GPR_GPR26 + offset) &= ~mask; per pin. ObjectFLED::~ObjectFLED() (:923-940) waits for DMA and frees the frame buffer, but leaves the GPR bank select, GDIR and pad mux/control as begin() set them. Teensy pinMode()/digitalWrite() and FastPin drive GPIO6-9, so after the driver is destroyed or reconfigured, ordinary GPIO on those pins is silently disconnected from the pad. #5148 fixed the identical leak for SPI mode via objectfled_pad_state.h (ObjectFLEDPadState capture/restore). The clockless path does not use it.

Acceptance criteria

  • A host test, modelled on tests/platforms/arm/teensy/teensy4_common/drivers/objectfled/objectfled_pad_state.cpp, that runs the clockless begin/destroy sequence against the pad register model and fails on current master because the GPR26-29 bits stay cleared after destruction.
  • After the fix: the GPR bank bits, GDIR bits and pad mux/control values of only the driven pins are restored on destruction (and on any init failure path). Bank select is restored first, and unrelated bits in the shared registers are untouched.
  • teensy40 and teensy41 builds pass. The fix reuses ObjectFLEDPadState rather than adding a second copy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sanitized

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions