Page 1 of 1

Minor potential inconsistency in the documentation

Posted: Sun Jul 25, 2021 6:48 am
by ArmyrAntSEC
This refers to the following section: https://docs.micropython.org/en/latest/ ... interrupts

The section stars with
All pins except number 16 can be configured to trigger a hard interrupt if their input changes. You can set code (a callback function) to be executed on the trigger.
(My emphasis)

The example the continues with the following sample code for configuring the interrupts:

Code: Select all

>>> p0.irq(trigger=Pin.IRQ_FALLING, handler=callback)
>>> p2.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=callback)
The minor issue here is that the above code will not create hard interrupts but soft interrupts according to the documentation found here: https://docs.micropython.org/en/latest/ ... ne.Pin.irq The test at this link clearly states that interrupts are created as soft interrupts by default.

Can someone either explain to my why my logic is wrong, or point me to a place where I can create a pull request or similar for an update to the tutorial?

Re: Minor potential inconsistency in the documentation

Posted: Sun Jul 25, 2021 10:19 am
by Christian Walther
ArmyrAntSEC wrote:
Sun Jul 25, 2021 6:48 am
This refers to the following section: https://docs.micropython.org/en/latest/ ... interrupts

The section stars with
All pins except number 16 can be configured to trigger a hard interrupt if their input changes. You can set code (a callback function) to be executed on the trigger.
(My emphasis)
This part seems wrong to me. To my recollection, the ESP8266 port does not support hard interrupts, and the source seems to confirm that: https://github.com/micropython/micropyt ... pin.c#L386

The documentatiion source is here: https://github.com/micropython/micropyt ... l/pins.rst

Re: Minor potential inconsistency in the documentation

Posted: Sun Jul 25, 2021 10:22 am
by Roberthh
I do not see a problem here. You post states correctly that there is not inconsistency in the documentation. Only not all possible variants of setting up a Pin interrupt are shown as examples.

If you want to raise an issue or submit a PR for additions to the documentation: The link to the Micropython repository is shown at the MicroPython home page as https://github.com/micropython/micropython.

Re: Minor potential inconsistency in the documentation

Posted: Sun Jul 25, 2021 10:25 am
by Roberthh
@christian walther: The ESP8266 had hard interrupts, and I used and needed them for a project. It was a pity that this feature was dropped.