Page 1 of 1

enabling/disabling interrupts in assembly

Posted: Mon Nov 13, 2017 7:44 pm
by v923z
Hi all,

In a critical section of my code, I have to toggle a couple of pins in assembly, because speed/accuracy is essential. I have separated this part of the code in a single function (I don't care about the overhead of calling the function), and decorated it with @micropython.asm_thumb

But this is useful only, if absolutely no interrupts occur while the function is being executed. I can, of course, call disable_irq() and enable_irq() immediately before, and after the function, but this is not particularly elegant, and even worse, prone to errors. I think it would be much better, if I could enable/disable the interrupts in the function that is decorated. What would be the assembler equivalent of the two above-mentioned functions?

Thanks,

Zoltán

Re: enabling/disabling interrupts in assembly

Posted: Mon Nov 13, 2017 8:23 pm
by Roberthh
Look here on the use of cpsie() and cpsid():
http://docs.micropython.org/en/latest/p ... _misc.html

Re: enabling/disabling interrupts in assembly

Posted: Mon Nov 13, 2017 8:44 pm
by v923z
Robert,

Thanks for the pointer!

Zoltán