• extending the existing option with a custom interrupt handler function property

    If you're executing an arbitrary JS function for the interrupt itself then surely there's no need to use the setWatch event queue? You could just emit an event, or do any number of other things.

    it could make Espruino instable

    It's worse than that - the interpreter wasn't designed for reentrancy. While I'm allocating variables in IRQs for the nRF52, it's something I'm actually considering taking out. The issue is that occasionally the interpreter will have to do a GC pass - and it'll do that outside of an IRQ. During that time, any IRQs that fires won't be able to allocate variables.

    But all this seems needlessly complicated - if Espruino isn't too busy, any function supplied to setWatch should execute almost immediately anyway - despite running outside of an IRQ.

About

Avatar for Gordon @Gordon started