Skip to content

esp32_camera: lock and unlock i2c bus around any ops that might access it #6940

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

Merged
merged 2 commits into from
Sep 24, 2022

Conversation

jepler
Copy link

@jepler jepler commented Sep 23, 2022

Now, if the i2c bus is locked, camera operations that might access the bus will raise an exception instead of using the bus without taking the lock.

Testing performed:

  • ran a random demo on esp32-s3-eye
  • in repl, verified that when the bus is locked the error is raised, and not otherwise
>>> i = board.I2C()
>>> cam = ...
>>> cam.vflip
False
>>> i.try_lock()
True
>>> cam.vflip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 11] EAGAIN
>>> i.unlock()
>>> cam.vflip
False

Closes: #6837
Closes: #6836

Copy link
Collaborator

@microdev1 microdev1 left a comment

Choose a reason for hiding this comment

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

LGTM!

@microdev1 microdev1 merged commit 68386fa into adafruit:main Sep 24, 2022
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.

esp32_camera: make sure it locks/unlocks the i2c bus Incorrect parameters in esp32_camera documentation
2 participants