PreviousNext
Idle
Help > Custom DPA Handler > Events > Idle

This event is periodically raised when the main loop is waiting for incoming RF (or interface) messages to handle. The time spent handling this event is critical. When there is no RF signal then the event is raised in STD mode approximately every 1.0 ms. When there is an RF signal, the time might be up to 2.8 ms.

 

Note that the frequency at which the event is called depends mainly on the time spent inside the RFRXpacket IQRF OS function (used to receive network packets) located in the main DPA loop. In the case when there is a full IQMESH network consisting of 239 devices and the timeslot equals 100 ms, the Idle event might not be called even for 239 × 100 ms = 23.9 s. Even a long time the Idle event is not called can happen during FRC and especially discovery.

 

Example

 

 case DpaEvent_Idle:

        // Go sleep?

        if ( sleepTime != 0 )

        {

              // Prepare OS Sleep DPA Request

              // Time in 2.097 s units

              _DpaMessage.PerOSSleep_Request.Time = sleepTime;

              sleepTime = 0;

              _PNUM = PNUM_OS;

              _PCMD = CMD_OS_SLEEP;

              // LEDG flash after wake up

              _DpaMessage.PerOSSleep_Request.Control = 0b0100;

              _DpaDataLength = sizeof ( TPerOSSleep_Request );

              // Perform local DPA Request

              // BeforeSleep and AfterSleep events will not be called in this case!

              DpaApiLocalRequest();

        }

 

        // Return user DPA value

        UserDpaValue = myUserDpaValue;

        return Carry;

 

See example code CustomDpaHandler-Timer.c, CustomDpaHandler-Coordinator-ReflexGame.c for more details.