Skip to content

Added deep and light sleep functions #31

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

Merged
merged 7 commits into from
Dec 4, 2020

Conversation

makermelissa
Copy link
Collaborator

@makermelissa makermelissa commented Dec 3, 2020

Fixes #20. This adds the deep and light sleep functions.

@makermelissa makermelissa requested a review from a team December 3, 2020 18:32
Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Later, it will also be possible to wake up on button pushes (or pin changes). So you might think about how this will fit into the proposed API. The time arguments could become optional, and there would also be optional button or pin arguments. You may want to make the time arguments require a keyword in that case.

@makermelissa
Copy link
Collaborator Author

Thanks Dan. We can make the time parameter optional once we have the button press wake feature added. I think it will work as it is for now.

Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Thanks for your patience. This is OK by me now. @tannewt any further comments?

@makermelissa
Copy link
Collaborator Author

Just for completeness, here's the test script I used to test neopixels for light sleep:

import time
from adafruit_magtag.magtag import MagTag

magtag = MagTag()
magtag.add_text()
magtag.set_text("Hello")
magtag.peripherals.neopixels.fill(0xFF0000)
time.sleep(2)

magtag.set_text("Going to sleep")
# Exit program and restart in 10 seconds.
magtag.enter_light_sleep(10)

magtag.set_text("I'm awake")
time.sleep(5)

For deep sleep, I basically used a slightly modified version of Dan's script at adafruit/circuitpython#3767 (comment)

Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

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

i like!

@makermelissa makermelissa merged commit d27b2c6 into adafruit:main Dec 4, 2020
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Looks good to me too! Thanks!

@makermelissa
Copy link
Collaborator Author

Excellent :)

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 5, 2020
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.

Still drawing >50mA during time.sleep()
4 participants