Page 1 of 1

ExtInt

Posted: Thu Nov 19, 2015 2:20 pm
by Hansg
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

Re: ExtInt

Posted: Thu Nov 19, 2015 4:18 pm
by dhylands
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.