Executing MicroPython program in non-blocking fashion
Posted: Sat Feb 05, 2022 2:47 pm
If I call "mp_call_function_0(...)" my program is blocked until that function returns (i.e. when MP program finishes). Is it possible to execute MP program in non-blocking fashion? Something like "mp_call_function_0_start(...)" and it returns immediately and later I call "mp_call_function_0_continue(...)" multiple times until it says that MP code execution is done.
I already asked this question in Forum / The MicroPython Language / General Discussion and Questions, but didn't get any valuable reply (probably wrong thread for these type of questions), so I later posted more clarification what I want to accomplish (slightly edited here):
This is more of a question how to run embedded MicroPython interpreter inside some firmware and not how to write MicroPython code in non-blocking way. I don't want my firmware to be blocked while python interpreter is running. I could use for example FreeRTOS and run MP interpreter in another thread, but if I have single threaded firmware I'm wondering is it possible at the same time to run both MicroPython interpreter and some other firmware code independent from MicroPython interpreter.
I already asked this question in Forum / The MicroPython Language / General Discussion and Questions, but didn't get any valuable reply (probably wrong thread for these type of questions), so I later posted more clarification what I want to accomplish (slightly edited here):
This is more of a question how to run embedded MicroPython interpreter inside some firmware and not how to write MicroPython code in non-blocking way. I don't want my firmware to be blocked while python interpreter is running. I could use for example FreeRTOS and run MP interpreter in another thread, but if I have single threaded firmware I'm wondering is it possible at the same time to run both MicroPython interpreter and some other firmware code independent from MicroPython interpreter.