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

API to wake-up from deepsleep using gpio #3

Closed
wants to merge 9 commits into from

Conversation

Projects
None yet
2 participants
@jagruthp
Copy link

commented Apr 2, 2017

Added API to wake-up from deepsleep using gpio pins.

@danicampora

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2017

@jagruthp thanks for your contribution. Looks good but I have a few remarks that should be easy for you to work on:

Modified as per Daniel's comments
1) Use keyword arguments
2) raise an exception with a message
3) removed the timeout parameter, and won't start the deep sleep process here
4) changed the API to wakeup_trigger
@jagruthp

This comment has been minimized.

Copy link
Author

commented Apr 2, 2017

@danicampora - I have made the changes according to your remarks. Also, I misunderstood what was required from the mail. I thought I had to create an API to set the trigger of the pin and also put the system to deepsleep. But now since only the triggers are set, I have changed the name of the API to wakeup_trigger as this would make more sense than the name deepsleep.

@danicampora

This comment has been minimized.

Copy link
Contributor

commented on esp32/mods/machpin.c in 5bff4c7 Apr 3, 2017

Are you sure this works? Normally we use MP_DEFINE_CONST_FUN_OBJ_KW for methods that receive keyword arguments. Did you see the examples I gave you from the SPI class?

@jagruthp

This comment has been minimized.

Copy link
Author

commented Apr 3, 2017

Yes this works. I tested it on the board before I committed it. I saw the examples from the SPI class. I also saw the methods used in the Pin class.

I see what you mean by using MP_DEFINE_CONST_FUN_OBJ_KW but the API works because my args are of type MP_ARG_INTand not MP_ARG_OBJ/MP_ARG_KW. In mp_arg_parse_all() in argcheck.c, after executing till line 84, line 106 gets executed next which gives me the int value of the entered trigger level.

Could you please test it out at your end and let me know if I am wrong ? If you still want me to use MP_DEFINE_CONST_FUN_OBJ_KW, I can do that and commit it by EOD.

@danicampora

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2017

@jagruthp OK, yes that works, but for consistency please change it to MP_DEFINE_CONST_FUN_OBJ_KW. Thanks :-)

@jagruthp

This comment has been minimized.

Copy link
Author

commented Apr 3, 2017

@danicampora - I've modified the API to use MP_DEFINE_CONST_FUN_OBJ_KW :-)

Removed mperror_enable_heartbeat(), bt_deinit() and wlan_deinit() bec…
…ause they are anyways invoked in machine deepsleep

@danicampora danicampora closed this Jun 2, 2017

@danicampora danicampora force-pushed the pycom:master branch from 5bed5e9 to d584271 Jun 2, 2017

iwahdan88 added a commit that referenced this pull request Dec 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.