Skip to content
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: presence of both Shutdown and Close confuses #25

Open
rakyll opened this issue Jun 23, 2016 · 7 comments
Open

piglow: presence of both Shutdown and Close confuses #25

rakyll opened this issue Jun 23, 2016 · 7 comments
Assignees

Comments

@rakyll
Copy link
Contributor

rakyll commented Jun 23, 2016

Isn't it possible to do the shutdown in Close? Is there a reason why Shutdown has to be a separate method?

@mattetti
Copy link
Contributor

I was wondering the same. Is there value in shutting down without closing?

@zankich
Copy link
Member

zankich commented Jun 23, 2016

Shutdown puts the PiGlow into a "software shutdown" mode, but it does not sever the connection to the PiGlow. Most of the methods in the PiGlow package are mapped directly to their register functions according to the api specification.

@mattetti
Copy link
Contributor

@zankich can you think of a good reason why someone would want to shutdown and not close the device? If you do, we should probably keep both methods, but either way, I think that we should always shutdown during closing tho, what do you think?

@zankich
Copy link
Member

zankich commented Jun 23, 2016

@mattetti I can imagine a case where you want to set a persistent color on your PiGlow, but do not want to have a program running in the background. Some process may wake up and set the colors to a specific pattern and then exit, or if you have a more complex system a routine which opens a connection to the PiGlow and and then closes the connection when it's finished. If you sent the PiGlow a Shutdown, the lights would turn off.

@mattetti
Copy link
Contributor

Hmm that's very interesting. That's a totally realistic use case IMHO and does justify the 2 methods. Maybe some documentation might clarify why there are two methods. After all both Burcu and I were surprised.

@zankich
Copy link
Member

zankich commented Jun 23, 2016

Yeah the documentation could be clearer for sure. I took a first stab at it with my PR, but there is definitely room to improve.

@rakyll
Copy link
Contributor Author

rakyll commented Jun 23, 2016

I can imagine a case where you want to set a persistent color on your PiGlow, but do not want to have a program running in the background.

You can close the file descriptor and it will keep using displaying the latest state. These devices are state machines, not going to stop working when you close the I2C connection through devfs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants