adafruit / adafruit/Adafruit_CircuitPython_MCP2515
Making full use of all hardware masks and filters
- Dominant language
- Python
- Stars
- 29
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
It appears that the current behavior of calling `listen` with `Match`es will assign one (unused) mask and one (unused) filter for each `Match` provided, regardless if masks can be shared across multiple filters. This means the user can only utilize up to two filters out of the MCP2515's six. An improved behavior might roughly look like this:
```py
MASKS = {
_RXM0SIDH: None
_RXM1SIDH: None
}
FILTERS = {
_RXM0SIDH: {
_RXF0SIDH: None
_RXF1SIDH: None
}
# mask 1 ...
}
def listen(matches):
for match in matches:
mask_id = self._get_or_create_mask(match)
# create filter ...
def _get_or_create_mask(match):
mask_id = 0
for reg, value in MASKS.values():
if match.mask == value and has_free_filters:
break # mask already exists, has free filters
if value is None:
break # otherwise use first available mask
```
If this looks good, I can help updating the current implementation.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the current listen implementation and compare its mask/filter allocation with the proposed _get_or_create_mask flow. Confirm the change lets matching filters share masks and use all six hardware filters, then verify the behavior against the MCP2515 hardware limits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100