This event is not raised at [C] devices. The event is called whenever an MCU interrupt occurs. Interrupt events might be blocked by IQRF OS during packet reception so the event might not be suitable for high frequency and low jitter interrupts.
Please make sure the following rules are met when implementing an Interrupt event:
1. The time spent handling this event is critical. If there is no
interrupt to handle then return immediately otherwise keep the code as fast as
possible.
Make sure the event is the 1st case in the main switch
statement at the handler routine. This ensures that the event is handled as the
1st one.
This event should be handled with an immediate return Carry; even if it
is not used by the custom handler because the Interrupt event is raised on
every MCU interrupt and the “empty” return Carry; handler
ensures the shortest possible interrupt routine response time.
2. Only global variables or local ones marked by a keyword static can be used to allow reentrancy.
3. Make sure race condition does not occur when accessing those variables at other places.
4. Make sure (inspect .lst file generated by C compiler) compiler does not create any hidden temporary local variable (occurs when using division, multiplication, or bit shifts) at the event handler code. The name of such a variable is usually Cnumbercnt. Such hidden variables would cause memory overwrites and code malfunction.
5. Do not call any OS functions except setINDFx. Use direct reading by FSRx or INDFx registers instead of calling obsolete and ineffective getINDFx/readFromRAM IQRF OS functions.
6. Do not use any OS variables especially for writing access.
7. All the above rules apply also to any other function being called from the Interrupt event handler code, although calling any function from the Interrupt event is not recommended because of additional MCU stack usage that might result in stack overflow and HW device reset.
Example
case DpaEvent_Interrupt:
if
( !TMR6IF )
return Carry;
TMR6IF = FALSE;
// timerOccured is (must be) a global or static variable
timerOccured = TRUE;
return Carry;
☼ See example code CustomDpaHandler-Timer.c or CustomDpaHandler-TimerCalibrated.c for more details.