Using Interrupts

Other interrupts, such as peripheral I/O interrupts, run without issues under REXIS. In fact, REXIS is designed so that interrupt handlers can be used to deal with the urgent nature of the interrupts while the real work is pushed to user tasks, to maximize the real-time performance of the whole system.

For example, as shown in the example above, a worker task waits for a mailbox message in a forever loop, and an interrupt handler sends the data from a peripheral I/O device to the worker task when the data arrives.

Instead of using a mailbox, a different solution would be for a worker task to use the function REXIS_TaskHibernate to go into “hibernation”. The task will not be run again until it is awakened by a REXIS_TaskWakeupFromISR call.

Depending on your requirements, one solution may be preferred over another. For example, if the interrupt handler needs to pass information to the worker task, then a mailbox is more appropriate. However, if no information needs to be transferred, then the worker task going into hibernation is the simpler solution.