-
Notifications
You must be signed in to change notification settings - Fork 586
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
Board: Improve I²C device management to avoid null reference exceptions #2032
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
11b5d35
I2cBusExtensions.PerformBusScan() cleanup
swharden 5d1f7e5
Revert "I2cBusExtensions.PerformBusScan() cleanup"
swharden a3d98bb
Ft232HI2c: dispose without nulling the I²C bus
swharden 85856b7
Ft232HI2c: simplify code comment
swharden 7b4f08e
Ft232H sample: I2C bus scan
swharden cb1c639
Ft232HI2c: null settings in destructor
swharden 7157c5b
Revert "Ft232H sample: I2C bus scan"
swharden 0432fe5
Merge remote-tracking branch 'upstream/main' into bugfix-i2c-scan
swharden a507d62
Ft232HI2cBus: add/remove device NoCheck
swharden 0f39615
Ft232hI2cDevice: set bus to null in destructor
swharden 72e2ea0
Ft232h sample: opening and closing i2c devices
swharden e35b187
ProtocolTests: reorder usings
swharden e38addd
ProtocolTests: repeat creation of the same I2C device
swharden 7d435a1
ProtocolTests: explicitly remove I2C device
swharden 0abc40e
ProtocolTests: scan for I2C devices
swharden 3e4d18f
BoardTest: remove and recreate I2C device
swharden 6cef0f2
BoardTest: dispose and recreate I2C device
swharden ef2c62f
Revert "Ft232h sample: opening and closing i2c devices"
swharden 4c679a0
disable Board I2cBusManager device caching
swharden 3dfa427
Ft232HI2c → Ft232HI2cDevice
swharden ad7bc86
mark Ft232HI2c obsolete
swharden a1a30d3
Ft232HI2c: inherit from I2cDevice
swharden c28125c
delete Ft232HI2c
swharden 8cb4e2c
I2cBusManager: CreateDevice() remembers newest device
swharden a22bd02
Update CompatibilitySuppressions
pgrawehr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at this point we should consider making
_devices
eitherHashSet<I2cDevice>
orDictionary<int, HashSet<I2cDevice>>
- perhaps even change design so thatRemoveDevice(int)
is replaced withRemoveDevice(I2cDevice)
. Alternatively we should throw on CreateDevice if it was created again (we should also check if it was already disposed though). My personal favor is we should change the design.@pgrawehr thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would probably be better, but I'm not sure it's worth the effort. Would need to make the changes and then check whether they show any benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's do it separately if needed in that case - current state is still better than it was - that's why I approved in the first place