pyboard - pin wake syntax

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

pyboard - pin wake syntax

Post by devnull » Fri Jun 01, 2018 1:35 pm

If I read this correctly, according to this:

Code: Select all

https://docs.micropython.org/en/latest/pyboard/library/machine.Pin.html
and this:

Code: Select all

https://github.com/micropython/micropython/blob/master/docs/library/machine.Pin.rst
This should work:

Code: Select all

import machine as mc
door = mc.Pin('X1',mc.Pin.IN)
door.irq(handler=None, trigger=(mc.Pin.IRQ_FALLING | mc.Pin.IRQ_RISING),wake=mc.DEEPSLEEP)
However this results in:

Code: Select all

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'DEEPSLEEP'
What am I doing wrong ??

UPDATE

OK, I see the documentation has not been updated, it should be DEEPSLEEP_RESET, however this results in another error:

Code: Select all

door.irq(handler=None, trigger=(mc.Pin.IRQ_FALLING | mc.Pin.IRQ_RISING),wake=mc.DEEPSLEEP_RESET)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: extra keyword arguments given
So what is the correct syntax to trigger wakeup on pin ?

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: pyboard - pin wake syntax

Post by shaoziyang » Fri Jun 01, 2018 2:58 pm

wake feature is still not available now.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: pyboard - pin wake syntax

Post by pythoncoder » Sat Jun 02, 2018 7:02 am

You might find this repo micropython-micropower helpful here.
Peter Hinch
Index to my micropython libraries.

Post Reply