-
Notifications
You must be signed in to change notification settings - Fork 33
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
piglow: Setup needs to be done at Open #26
Comments
Agreed, I think that's a pattern that was used in GoBot which might be why it was done here. I don't think it's needed and would also prefer to have |
I don't know if I agree with having logic in the |
That's the approach we've taken for all the existing libs. Note that it is not a good argument it itself, consistency however is important. I do think it's worth talking through the API. There are 3 main arguments being brought up so far:
I personally don't think that reconnection is worth adding a new method and therefore increasing the API complexity. Reconnection is or at least should be an exceptional scenario, in which case, I think a reset is not really an issue. @zankich you have more experience using GoBot, how often and in what kind of scenarios did disconnections/reconnections happen? |
Not having logic in your Granted most of the time I've had to deal with reconnects have been with devices over serial/http/(some remote type thing). Having something time out unexpectedly while you're reading or waiting for an event does happen. In the case of an i2c device connected directly to your raspberry pi, if you unexpectedly lose connection to it, chances are something bad just happened. I 100% agree with having a consistent API, which makes sense and is not more complicated than it has to be. I do however want to expose as many of the raw operations that the device support and not try to mash functionality together into a larger method because the program reads a little cleaner. In my experience this creates libraries which work really well up until the point you need to do something advanced, and then you're out of luck. These device drivers should be fairly low level and give the consumer the ultimate say in how their program interacts with their hardware. |
What about naming Setup to Clear or Reset? I don't think Setup reflects what the method is doing and hence there is this issue. Setup gives me an impression this is a startup-time sequence I need to run. |
The I'm completely open to changing the name to something more descriptive. What about instead of needing to explicitly call |
Activate or Enable might be better names On Thu, Jun 23, 2016, 18:10 Adrian Zankich [email protected] wrote:
|
An optional argument to Open sounds best to me. |
Open functions are also responsible to run the initialization sequences. I don't see a good reason why there is both Open and Setup.
The text was updated successfully, but these errors were encountered: