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.
Addresses #19
This is a simple approach to fixing the issue of not properly using all of the Masks and Filters available on the MCP2515. This update does the following.
As far as I can tell, the previous code was using the _masks_in_use array to store the mask register being used, not the actual mask value. The only purpose for this array seemed to be for checking the array length to determine how many masks were in use. By placing the actual mask value in the _masks_in_use array, we're able to also search for it so more than one filter can be paired with each mask. This change shouldn't affect the checks used to ensure the max number mask/filter pairs is enforced.
This change also expands the documentation for '.listen()', adding details on how to use the matches array to setup the masks and filters on the MCP2515 using this library.
I've tested this change on an RP2040 CAN Bus Feather