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

digitalRead event pin naming clarification #16

Closed
nebrius opened this issue Sep 17, 2018 · 2 comments
Closed

digitalRead event pin naming clarification #16

nebrius opened this issue Sep 17, 2018 · 2 comments

Comments

@nebrius
Copy link
Contributor

nebrius commented Sep 17, 2018

I was reading over the spec for digitalRead while working on nebrius/j5-io#6, and I realized there's some ambiguity at play in https://github.com/rwaldron/io-plugins#digitalreadpin-handler.

When data is read, we're supposed to emit an event with the name digital-read-${pin}. Now here's the rub: is pin supposed to be the normalized pin, or the value passed to digitalRead?

In Raspi IO, these will pretty much always be different (e.g. GPIO10 normalizes to 12). Currently, Raspi IO emits digital-read-GPIO10 instead of digital-read-12, but I kinda feel like it should be the other way around. Thoughts?

@rwaldron
Copy link
Owner

Interesting... In Tessel-io, I use an "index":

Index Port Pin Number Johnny-Five Compatible Name
0 A 0 "a0" or "A0"
1 A 1 "a1" or "A1"
2 A 2 "a2" or "A2"
3 A 3 "a3" or "A3"
4 A 4 "a4" or "A4"
5 A 5 "a5" or "A5"
6 A 6 "a6" or "A6"
7 A 7 "a7" or "A7"
8 B 0 "b0" or "B0"
9 B 1 "b1" or "B1"
10 B 2 "b2" or "B2"
11 B 3 "b3" or "B3"
12 B 4 "b4" or "B4"
13 B 5 "b5" or "B5"
14 B 6 "b6" or "B6"
15 B 7 "b7" or "B7"

I think that event name can be whatever naming/numbering convention, as long as it's consistent within the IO Plugin itself.

@nebrius
Copy link
Contributor Author

nebrius commented Feb 7, 2019

Makes sense. I'll switch to the new naming scheme and mark it as a breaking change (there's several in the upcoming version already).

@nebrius nebrius closed this as completed Feb 7, 2019
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

2 participants