-
Notifications
You must be signed in to change notification settings - Fork 15
addressing feedback from @jepler #1
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
Conversation
@jepler Were you able to test this? |
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.
I didn't re-test.
One doc change requested, and a general feeling of annoyance with myself about the semantics of send. ugh I'm sorry about that.
adafruit_mcp2515/__init__.py
Outdated
:param ~busio.SPI spi: The SPI bus used to communicate with the MCP2515 | ||
:param ~digitalio.DigitalInOut cs_pin: SPI bus enable pin | ||
:param int baudrate: The bit rate of the bus in Hz, using a 16Mhz crystal. All devices on the bus must agree on this value. Defaults to 250000. | ||
:param bool loopback: Receive only packets sent from this device, and send only to this device. Requires that `silent` is also set to `False`, but only prevents transmission to other devices. Otherwise the send/receive behavior is normal. |
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.
please update (requires that silent
be True
)
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.
fixed
if loopback and not silent: | ||
raise AttributeError("Loopback mode requires silent to be set") | ||
if auto_restart: | ||
raise AttributeError("`auto-restart` is not supported by hardware") |
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.
would it be useful to emulate this by restarting at any in_waiting(), receive() or send() call? is the checking expensive (I could believe that)
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.
I think it makes sense to defer implementation until its absence is raised as an issue
# TODO: Timeout | ||
tx_buff = self._get_tx_buffer() # info = addr. | ||
if tx_buff is None: | ||
raise RuntimeError("No transmit buffer available to send") |
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.
OK this does implement what the core docs say. It's not what core does. sigh. We can let some actual experience inform us as to what is preferable, and then implement it across the various chips, I don't want it to hold things back at this point.
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.
I agree that we should wait and see how things go.
elif self.silent and not self.loopback: | ||
raise AttributeError( | ||
"Hardware does not support setting `matches` in when\ | ||
`silent`==`True` and `loopback` == `False`" |
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.
interesting restriction.
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.
I think they imagine that if you're in the monitoring mode that you want to "hear" everything?
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.
I have totally lost the thread here. Things look fine and if anything's not we can revisit later.
heya @jepler, this should address your feedback. I also left some comments on the google doc.
This is going to fail because I hate RST and am tired of futzing with it