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

Easygpio: module for reading bits from sensors #1017

Closed
wants to merge 1 commit into from
Closed

Easygpio: module for reading bits from sensors #1017

wants to merge 1 commit into from

Conversation

romanchyla
Copy link

  • easygpio: generic bit-banging
  • added documentation
  • added short tutorial for writing a c module for nodemcu

I've taken the opportunity to provide a short tutorial. I remember how hard it was when I tried to write my first module few months back (at that time, one had to edit 4 files). And for beginners it is really a very steep hill to climb.

Please consider it as suggestion, the easygpio module doesn't have to be enabled by default. But I'm hoping it could be useful.

@marcelstoer
Copy link
Member

Here's my 2 cents:

@TerryE
Copy link
Collaborator

TerryE commented Feb 8, 2016

My immediate reaction is that this is really the equivalent of gpio.serout, but for input. It makes sense to combine these two sets into one module. See #428 for some of the difficulties here. As these are a niche use, I suspect that these would be better in a separate module -- but not "easy"gpio. However, we are in the middle of tidying up / reworking the gpio implementation, so do you mind if we keep this on hold for a few weeks?

@romanchyla
Copy link
Author

Thank you for suggestions, I'll split the PR into two parts - I belive the cmodule.md tutorial is uncontroversial (and for beginners, it would be great to have it); I'll make a separate PR for it.

@TerryE I also thought it better to keep the functionality in a separate module (maybe also serout could be extracted?). Can I somehow help with the gpio module itself? [ie: I'd like to avoid having to track several repositories for my project which depend on the bit-banging]

@romanchyla
Copy link
Author

I've changed the PR as indicated above. If you would like me to do something else or help with the gpio, please let me know. Thank you.


platform_gpio_write(pin_clk, initial_clk_write);

while (platform_gpio_read(pin_data) != ready_state);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can hang forever if the device doesn't respond (well, the watchdog will kill it eventually).

@marcelstoer
Copy link
Member

@romanchyla pls address Philip's comment, rebase on current dev to fix the merge conflicts and then push to your branch again (GitHub will auto-update here).

@romanchyla
Copy link
Author

ok, will do - give me few days...

- use bit-banging to read sensors
- added documentation
@romanchyla
Copy link
Author

ok, updated - it is trying 1000 times before giving up (not sure that is the right solution, but can't think of anything else&simple: is that bad/low/too arbitrary?)

@pjsg
Copy link
Member

pjsg commented Apr 25, 2016

I looked at the code, and I don't see any assignment to PIN_CLK (the global variable).

It also isn't clear that the info() method provides much value....

`gpioser.read(pin_clk, pin_out, num_bits, after_ticks, delay_us, initial_val, ready_state)`

#### Parameters
`pin_clk` pin number of the sensor (the CLOCK channel), type is number
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the parameters are missing the list markers ('- ').

@marcelstoer
Copy link
Member

Thanks Roman for the update.

this is really the equivalent of gpio.serout, but for input. It makes sense to combine these two sets into one module

So, gpio.serout could be transferred to this new module even if #428 isn't addressed yet. Or the other way around...The more I think about this the more I tend to the latter. It's not that gpio.c would grow beyond a manageable size if it also included a serin function.

It also isn't clear that the info() method provides much value

I have to agree.

@romanchyla
Copy link
Author

romanchyla commented Apr 27, 2016

I vaguely remember looking at the gpio.serout (seems more flexible), the
code was hard to read though. It received a table with wait times. It will
be slower but how much (and if that matters) I don't know. Will try to do
some work on it next week.

For my edification: any idea how long the gpio_read() takes? And if it's
safe to call it 1000 times?

@marcelstoer
Copy link
Member

What a pity this has been stuck in the PR queue for so long. Terry/Philip would it be unfair argue it should be closed as no one seems to have come forward in the mean time stating they really missed what this PR would provide?

@TerryE
Copy link
Collaborator

TerryE commented May 17, 2019

Terry/Philip would it be unfair argue it should be closed as no one seems to have come forward in the mean time stating they really missed what this PR would provide?

It is also pretty out of date and would need work to make it compatible with current builds. Time to let it die a natural death.

@TerryE TerryE closed this May 17, 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

Successfully merging this pull request may close these issues.

4 participants