How to invoke a MP callback function from Native MPY driver? #15720
Unanswered
haldark
asked this question in
Libraries & Drivers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am planning to write HSPI Slave for ESP8266 as a MP module. The code is written in C and will follow Arduino esp8266 implementation. The code will be then compiled as a Native dynamically loadable module (.mpy), that can be loaded using "import".
The Arduino C code fires few interrupts when slave receives data or status transactions. These interrupts invoke C callback functions and pass pointer to a 64B long receive buffer. The callback function processes content of this buffer.
My main python code allocates a 64B buffer/array. I want my python code to pass python callback function, along with this buffer pointer.
When interrupt fires and invokes C callback function, they will copy content from C buffer to Python buffer and invoke python callback function.
I was looking in example/natmod directory for some reference code, but could not find any example to show peripheral interrupt from C world calling function of python world.
Is there any driver in micropython repository that I can refer to?
Any help, with some example code will be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions