Is it safe to use _io_read functions from an interrupt if IO_SERIAL_NON_BLOCKING has been set? Documentation is a bit ambiguous.
Hi Billnd,
The best practice for interrupt is to just flag or signalize something (semaphore, mutex, etc) you shall not execute functions. The stack accumulation could cause a stack overflow in the stack level. I would recomend to start a high priority task that just goes and read when you receive an interruption. The isr will just start the task. Then the task will go, read and go back to sleep.
I hope this helps you.
Regards,
Garabo
As Garabo said, it is not correct approach (use _io_read functions from an interrupt).
In fact, there also depends on IO driver implementation.
It is obvious that IO drivers which using interrupts cannot be used inside interrupt routine – for example SPI driver in MQX4.0.2.
Some of IO drivers could work when pooling method is used in driver – for example Legacy SPI driver in MQX4.0.2 but this is rather side effect of trivial implementation of this driver.
So, general recommendation is not to use _io_read functions from an interrupt.