Pin change interrupts for PyBoard v1.1?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
hybotics
Posts: 10
Joined: Tue Apr 03, 2018 2:58 am

Pin change interrupts for PyBoard v1.1?

Post by hybotics » Sun Dec 02, 2018 10:35 pm

Hi,

I am working on a port of an Arduino library to Micropython, and am having some difficulty, I think this is because the Arduino library uses pin change interrupts, and Micropython does not seem to support that. Falling or Rising Edge does not get me the results I need.

Is there a way that Micropython can do this now, or will be able to it in the future?

8-Dale

User avatar
dhylands
Posts: 2904
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Pin change interrupts for PyBoard v1.1?

Post by dhylands » Sun Dec 02, 2018 11:32 pm

The STM32F4 used by the pyboard has a module called EXTINT, and the micropython support for that is documented here:
https://docs.micropython.org/en/latest/ ... xtInt.html

This is capable is generating interrupts on rising or falling edges, or both, but not on levels.

Note that there are 16 lines, and you need to look at the cpu pin to figure out which line is used. C5 uses line 5, and B4 uses line 4. This means that you can't have ExtInt configured for both C4 and B4, only one or the other. You can use the quick reference to determine the cpu pins for a given pin: https://docs.micropython.org/en/latest/ ... ckref.html

Post Reply