Minor potential inconsistency in the documentation

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
ArmyrAntSEC
Posts: 7
Joined: Sat Jul 17, 2021 7:26 pm

Minor potential inconsistency in the documentation

Post by ArmyrAntSEC » 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)

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?

Christian Walther
Posts: 169
Joined: Fri Aug 19, 2016 11:55 am

Re: Minor potential inconsistency in the documentation

Post by Christian Walther » Sun Jul 25, 2021 10:19 am

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

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Minor potential inconsistency in the documentation

Post by Roberthh » Sun Jul 25, 2021 10:22 am

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.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Minor potential inconsistency in the documentation

Post by Roberthh » Sun Jul 25, 2021 10:25 am

@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.

Post Reply