Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlock SPI before deinit #65

Merged
merged 1 commit into from
Sep 4, 2024
Merged

Unlock SPI before deinit #65

merged 1 commit into from
Sep 4, 2024

Conversation

dhalbert
Copy link
Contributor

@dhalbert dhalbert commented Sep 3, 2024

See adafruit/circuitpython#9586. As of adafruit/circuitpython#9164, on Espressif, SPI.deinit() waits for the SPI lock to be unlocked before doing the deinit. This causes DotStar.deinit() to hang. The DotStar object has exclusive access to the SPI it creates and does not bother to lock and unlock it each time.

So just unlock the SPI lock before doing the deinit(). This may become unnecessary when adafruit/circuitpython#9586 is addressed, but it's safer anyway.

@dhalbert dhalbert requested review from tannewt and a team September 3, 2024 19:13
Copy link
Member

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! While this should probably be fixed in the core, it doesn't hurt to make this small change especially for people on older versions of the core.

@dhalbert dhalbert merged commit 49b7a48 into main Sep 4, 2024
2 checks passed
@dhalbert dhalbert deleted the unlock-spi-before-deinit branch September 4, 2024 01:23
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Sep 4, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_DotStar to 2.2.12 from 2.2.11:
  > Merge pull request adafruit/Adafruit_CircuitPython_DotStar#65 from adafruit/unlock-spi-before-deinit

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
@s-light
Copy link

s-light commented Sep 18, 2024

thanks dhalbert for the fix. 👍

i just run into this hang -
and only found it after a big digging where the hell my code stops working....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants