Question about allocating memory in interrupts

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Question about allocating memory in interrupts

Post by pfalcon » Mon Jan 30, 2017 11:08 am

pythoncoder wrote:It seems that the capabilities of callbacks from ESP8266 virtual timers are somewhat undefined.
That's actually not the case. The machine module, on any system/port, deals directly with hardware, even if via a very thin shim, as in the case of "virtual timers" (there're no wonders what are they - they are a list of data structures, which a hardware interrupt handler goes thru and calls right from itself). Trying to do high-level networking in a hardware timer interrupt is akin to jumping up, and at the highest point to have a breakfast.

Docs http://docs.micropython.org/en/latest/e ... chine.html http://docs.micropython.org/en/latest/e ... Timer.html now make explicit the requirement above (of all machine module callbacks to be considered to be run in IRQ context).

If you need to pass time, time.sleep_ms() is your friend. If you need to do more complex scheduling, uasyncio.core is now in good shape for ESP8266 (or any other system). Networking scheduling is done via main uasyncio module and so far experimental on ESP8266.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply