Good practices

Beware of interferences

Waspmote’s UART1 and interruption pins are the same microcontroller pins. Thus, it is mandatory to separate the usage of these pins to perform as UART or interruption pins. It is not recommended to use them as both UART and interruption pins at the same time because interference problems will appear, i.e. loss of interruption events, continuous interruptions due to UART communication, etc.
Figure : Interruption-UART1 interference lines
It is important to switch off the modules connected to UART1 through the multiplexer when setting up interruptions in order to avoid interferences. For that purpose, the muxOFF1() function permits to switch off the UART1 multiplexer.
// switch off multiplexer in UART1

Code Robustness

Sometimes, it is possible to lose some interruption events due to any reason. This is dangerous because it could happen that in the case the interruption event is lost, the interruption source keeps the interruption signal masking the UART and interruption lines. This does not permit to receive any other interruption.
The clearInterruptionPin() function permits to check each monitoring pin in order to know if there are active interruption signals. Besides, the function disables the interruption source solving the problem.