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

Track creation of board.I2C(), etc. #5951

Merged
merged 2 commits into from
Jan 31, 2022

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Jan 31, 2022

Before #5422, the singletons for board.I2C() were stored as i2c_singleton, etc. and were NULL if not instantiated. #5422 allowed multiple board, objects, but removed the separate singleton storage slots, and relied on checking whether the objects were deinited() or not to see if they were valid. But all-zero objects were not recognized as deinited() in some ports (which caused crashes). For instance, in atmel-samd, deinited() checked for a pin being NO_PIN (which is 0xFF).

So restore tracking the creation of the singletons, and don't use deinited() to check their existence. This PR tracks them as booleans, instead of as pointers. The changed code now looks more like the code pre-#5422.

Tested on a Metro M4, with an I2C program that uses the default I2C object.

Copy link
Collaborator

@jerryneedell jerryneedell left a comment

Choose a reason for hiding this comment

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

Tested on PyPortal - boots OK
Thank you!

@jerryneedell
Copy link
Collaborator

Looks like the "ru" build is just a few bytes over on a few of the samd21 builds.

@dhalbert dhalbert force-pushed the track-board-default-objects branch from c1baac0 to 20a17be Compare January 31, 2022 14:16
@kmatch98
Copy link
Collaborator

I verified this PR now boots properly on the pyportal. Thanks @dhalbert!

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you for the quick fix.

@tannewt tannewt merged commit 43dae6c into adafruit:main Jan 31, 2022
@dhalbert dhalbert deleted the track-board-default-objects branch February 6, 2022 15:07
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.

SAMD51 build not working at all after #5422 (multiple board buses) PYPORTAL -- latest builds won't boot
4 participants