ExtInt

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Hansg
Posts: 4
Joined: Fri Sep 11, 2015 12:58 pm

ExtInt

Post by Hansg » Thu Nov 19, 2015 2:20 pm

Hello all,
My purpose is to read a value from a transducer through I2C on interrupt base in my pyboard.
In the interruptservice routine I want to read the value(global)
Is this possible?
I have trouble with my callback function.
Thanks a lot for any help.
Hans

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

Re: ExtInt

Post by dhylands » Thu Nov 19, 2015 4:18 pm

You can't allocate memory inside an interrupt callback.

If you try to call I2C.recv and pass in a number of bytes, it will try to allocate a buffer, which will fail from within an interrupt callback. If you try to call I2C.recv and pass in a previously allocated buffer instead, then it will use that buffer.

Post Reply